Development
Prerequisites
- Go 1.25 or later
- Task —
go install github.com/go-task/task/v3/cmd/task@latest - templ CLI —
go install github.com/a-h/templ/cmd/templ@latest(only needed when editing.templfiles) - air —
go install github.com/air-verse/air@latest(only needed fortask dev)
Commands
| Command | Description |
|---|---|
task --list |
Show all available tasks |
task build |
Build binary to bin/poolvibes |
task test |
Run tests |
task test:verbose |
Run tests with verbose output |
go test -v -run TestName ./path/to/package |
Run a single test |
task lint |
Lint |
task fmt |
Format code |
task templ |
Regenerate Go code from .templ files |
task dev |
Start dev server with live reload (templ + air) |
task run |
Build and run the server |
task clean |
Remove build artifacts |
task tidy |
Tidy dependencies |
task docker:build |
Build Docker image |
task docker:up |
Start Docker services |
task docker:down |
Stop Docker services |
Adding a Feature
New features follow the DDD layer structure:
- Domain — Define the entity in
internal/domain/entities/, add a repository interface ininternal/domain/repositories/ - Application — Create command structs in
internal/application/command/and a service ininternal/application/services/ - Infrastructure — Implement the repository in
internal/infrastructure/db/sqlite/and add a migration inmigrations/ - Interface — Add templ components in
internal/interface/web/templates/, HTTP handlers ininternal/interface/web/handlers/, and register routes inserver.go
Code Conventions
- Follow standard Go conventions (Effective Go, Go Code Review Comments)
- Use
gofmtformatting - Return errors, don't panic — wrap with
fmt.Errorf("context: %w", err) - Naming:
camelCasefor locals,PascalCasefor exports, short receiver names - Write table-driven tests
- Use
context.Contextas the first parameter where appropriate
CI
GitHub Actions runs on every push to main and on pull requests. The workflow (.github/workflows/ci.yml) runs:
go build ./...go vet ./...go test ./...
Railway's Wait for CI integration ensures deployments only proceed after CI passes.
Database Migrations
Migrations live in migrations/ and are embedded into the binary at build time. They run automatically on server startup.
To add a new migration, create up and down SQL files:
The migration runner uses golang-migrate.