Go REST API — idempotent payment service.
cp .env.example .env
make quick-start # starts containers + runs migrations automaticallyArchitecture, request flow, payment flow, and design decisions: docs/SYSTEM_DESIGN_SHORT.md
- Go 1.24+
- Docker + Docker Compose
- air (local dev only)
go install github.com/air-verse/air@latestcp .env.example .env
# edit .env — set DATABASE_PASSWORD at minimumDocker (recommended)
make up # start all containers (app + db + redis)
make down # stop containers
make logs # tail app logsLocal with hot-reload
make dev # loads .env and runs airmake migrate-up # apply pending migrations
make migrate-down # rollback last migration
make migrate-down STEPS=3 # rollback N migrations
make migrate-status # current version
make migrate-create NAME=add_orders # create new migration files
make migrate-goto VERSION=5 # jump to specific version
make migrate-force VERSION=5 # force version (dirty state recovery)make test # run all tests
make test-coverage # run tests + generate coverage.html
make lint # run golangci-lint
make lint-fix # run golangci-lint with auto-fixmake swag # regenerate docs (available at /swagger/index.html in non-production)make build-binary # build ./bin/server binary
make run-binary # build + run binary| Method | Path | Description |
|---|---|---|
POST |
/api/v1/pay |
Submit idempotent payment |
GET |
/health |
Health check |
GET |
/metrics |
Prometheus metrics |
GET |
/swagger/* |
Swagger UI (non-production) |
All settings have defaults in configs/config.yaml. Override via .env or environment variables. See configs/config.yaml for the full list.