rdev/deployments/k8s/base/templates/go-api/.claude/CLAUDE.md
jordan c280a92012 feat: add operations audit system and template improvements
Operations Audit (new feature):
- Add Operation domain model with status tracking (pending, running, completed, failed, cancelled)
- Add OperationRepository with PostgreSQL implementation
- Add OperationService for CRUD and lifecycle management
- Add operations handlers (list, get, cancel endpoints)
- Add migration 015_operations.sql for operations table
- Add operation cleanup worker for stale operation handling
- Add ErrOperationNotFound to domain errors

Template Improvements:
- Add CLAUDE.md configuration files to astro-landing, default, and go-api templates
- Fix PORT template variable usage in nginx configs for app templates
- Add replace directives for local pkg module in Go templates
- Simplify Go service/worker Dockerfiles for workspace builds
- Fix TypeScript error in logger template

Other:
- Refactor landing-test.sh cookbook script
- Update CLAUDE.md version reference

Note: Some files exceed 500-line limit (pre-existing debt + new feature)
- component.go: 550 lines (unchanged, pre-existing)
- main.go: 522 lines (added operations wiring)
- operation_repo.go: 569 lines (new, needs splitting)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 19:08:57 -07:00

964 B

{{PROJECT_NAME}}

Go REST API deployed to {{DOMAIN}}.

Development

go run ./cmd/api

API runs at http://localhost:8080

Test

go test ./...

Build

go build -o app ./cmd/api

Deployment

Pushes to main auto-deploy via Woodpecker CI:

  1. Run tests
  2. Build binary
  3. Build Docker image
  4. Push to registry
  5. Update K8s deployment

Live at: https://{{DOMAIN}}

API Endpoints

Method Path Description
GET /health Health check
GET /api/v1/... Your endpoints

Constraints

  • Use chi router (github.com/go-chi/chi/v5)
  • Return JSON responses with proper status codes
  • Structured logging with slog
  • Config via environment variables
  • All DB queries with sqlx

File Structure

cmd/
  api/
    main.go         # Entry point
internal/
  handlers/         # HTTP handlers
  domain/           # Business models
  service/          # Business logic