Go with Gin
The Go template combines Gin, GORM, go-playground/validator, Goose migrations, and Swagger generation. Apso writes models, DTOs, handlers, services, and route registration into autogen/.
Requirements
- Go 1.23 or newer
- PostgreSQL
@apso/cli
Create and run a project
apso init --name my-api --language go --skip-platform
cd my-api
go mod tidy
apso generate
apso devGenerated structure
my-api/
├── .apsorc
├── cmd/
│ ├── main.go
│ └── migrate/
├── autogen/
│ ├── dto/
│ ├── handlers/
│ ├── models/
│ ├── routes/
│ └── services/
├── extensions/
├── migrations/
└── go.modDo not edit autogen/. Put custom middleware, handlers, services, and business rules in extensions/.
Swagger documentation
Generate the Swagger files when the route surface changes:
go install github.com/swaggo/swag/cmd/swag@latest
swag init -g cmd/main.go -o docsWith the service running on the template’s default port, open http://localhost:3000/_docs.
Manage database migrations
The template includes migration commands backed by Goose:
make migrate-up
make migrate-status
make migrate-downUse apso migrate to preview a schema change and generate the migration file from .apsorc.
Test the project
go test ./...
go vet ./...Related
Last updated on