Lightweight layered modular monolith backend for SlimeyQuest (HTTP JSON REST + PostgreSQL + Redis).
- Go 1.26+
- PostgreSQL (default database:
slimeyquest) - Redis
-
Copy environment template:
cp .env.example .env
-
Ensure PostgreSQL and Redis are running and match
.env(or defaults in.env.example). -
Build and run:
make build ./bin/server
Or:
go run ./cmd/server
-
Verify:
curl http://localhost:8080/health
Example response:
{"status":"ok","version":"dev","uptime":"1m2s"}HTTP API documentation:
../docs/api/http-v1.md(中文契约)Architecture:
../docs/architecture/· MVP loop:../docs/chest-opener-loop.md
cmd/server/ Entry point
cmd/http-smoke/ HTTP API smoke test client
internal/app/ Application wiring and lifecycle
internal/entity/ JSON API request/response types
internal/config/ Environment + embedded gameplay config
internal/logger/ Structured logging (slog)
internal/api/ Gin HTTP routing (domain handlers)
internal/middleware/ Bearer auth middleware
pkg/response/ Unified JSON error responses
internal/services/login/ Authentication and session flow
internal/services/player/ Player domain, equipment, chest loop
internal/services/idle/ Idle reward calculation and claims
internal/services/reward/ Reward application
internal/services/stage/ Stage progression
internal/services/session/ In-memory session tokens
internal/data/playerrepo/ ent-backed player repository
internal/data/storage/ PostgreSQL, Redis, ent client
internal/config/data/ Embedded gameplay CSV/YAML config
All client/server gameplay integration uses HTTP JSON under /api/v1. See ../docs/api/http-v1.md.
Keep business logic in internal/services and call it from thin HTTP handlers.
The ent schema lives in the separate github.com/slimeyquest/ent module. Local development uses replace github.com/slimeyquest/ent => ../ent in go.mod.
With the server running:
make http-smoke