Coding Standards
Go (Backend)
- Use Go 1.22+ features
- Return errors explicitly — never panic in production code
- Wrap errors with context:
fmt.Errorf("failed to create user: %w", err) - Keep HTTP handlers thin — business logic belongs in service structs or Temporal workflows
- Use dependency injection for databases and external clients
- Format with
gofmt, lint withgolangci-lint - JSON marshaling via
sonic(notencoding/json)
TypeScript / React (Web & Expo)
- Strict types everywhere —
anyis forbidden - Favor React Server Components (RSC) to reduce client bundle size
- Use
'use server'strictly for mutations (Server Actions) - Expo components must respect SafeArea insets
- Extract complex UI state into custom hooks
- Format with Prettier, lint with ESLint
Database (SQL)
- Raw PostgreSQL 16 only — no ORMs
- Queries in
/backend/db/queries/, processed by sqlc - Migrations in
/backend/db/migrations/with sequential numbering - Use CTEs, window functions, and JSONB where appropriate