A web and API server for game content, user data, replays, leaderboards, and project's website.
Guide on how to set up your local instance of content-server.
If you are working on the frontend, you will also need:
-
Clone the repo:
git clone https://github.com/goplease-game/content-server.git cd content-server -
Setup config:
- Copy
config.sample.yamlto.config.yamland edit the values. At least a DB connection is required for startup.Tip: It's recommended to use a
_local_devsuffix for the DB name (e.g.,myapp_local_dev). The reset tool uses this convention to prevent accidental data loss. - Create test configurations in:
test/api_test/.config.yamltest/service_test/.config.yamltest/worker_test/.config.yaml
- For each test config, update the following:
- Set a test DB connection (e.g.,
myapp_local_dev_test). email.driver: "test"tracing.enabled: falsefiles.storage_driver: "in-memory-fs"
- Set a test DB connection (e.g.,
- Copy
-
Run tests:
go test ./... -
Start the server:
go run ./cmd/server/main.go
To populate the database with test data, use the CLI tool:
go run ./cmd/cli/main.go sdBy default, it seeds all available entities. You can specify a specific entity and count:
- Example:
go run ./cmd/cli/main.go sd users 1000(creates 1000 users). - Help:
go run ./cmd/cli/main.go ? sdfor detailed options.
If you need a clean state, run:
go run ./cmd/cli/main.go rdeThis command recreates the database, applies migrations, and creates a default user.
go tool templ generate --watch --proxy="http://localhost:8080" --cmd="go run ./cmd/server/main.go"tailwindcss -i ./frontend/assets/input.css -o ./frontend/assets/output.css --watchRequires golangci-lint
golangci-lint runRequires swag
# Format Swagger directives
swag fmt --dir server/handler
# Generate specifications
swag init --parseDependency --parseDepth 1 --dir server/handler -g handler.go -o server/docs