This project uses a contract-first architecture based on a shared OpenAPI specification. All API definitions and data models are maintained in /contracts and used to generate strongly typed code for each service.
contracts/
├── openapi.yaml # Root OpenAPI specification
├── components/ # Shared schemas and models
├── paths/ # API endpoint definitions
├── views/ # Service-specific API views
└── generate.sh # Code generation entrypoint
componentscontains shared schema definitions.pathsdefines API endpoints and references schemas.viewsexpose only the APIs required by a specific service.- Generated code is derived from service views rather than the full specification.
| Service | Generated Output |
|---|---|
| Backend | backend/internal/contracts/openapi.gen.go |
| Frontend | frontend/src/lib/dashboard/api/generated.ts |
| AI Service | ai-service/contract_schemas.py |
| Browser Worker | browser-worker/internal/contracts/openapi.gen.go |
- Add or update schemas in
components. - Define or update endpoints in
paths. - Reference required endpoints in the appropriate
views. - Regenerate code:
sh contracts/generate.shAll generated files are updated automatically and should not be edited manually.
CI also runs script/ci/contracts.sh, which regenerates these artifacts and
fails when the checked-in outputs are stale.