Machine-readable API contracts for the Nexus platform. Single source of truth for all service boundaries.
| Spec | Service | Role |
|---|---|---|
nexus-core.yaml |
nexus-core | Headless WhatsApp backend — auth-unaware by design (PRD F1–F8) |
nexus-api.yaml |
nexus-api (no service yet) | Publicly hosted API for the Nexus app — auth-aware public edge; scaffold awaiting PRD |
Both specs target OpenAPI 3.0.3 — oapi-codegen v2 does not support 3.1.
nexus-core.yaml— source of truth for the Core REST APInexus-api.yaml— public API scaffold (do not build consumers against it yet)oapi-codegen.yaml— Core codegen config (chi-server + models + embedded-spec) →nexus-core/internal/contracts/api.gen.goredocly.yaml— lint rules;security-defineddisabled because Core is auth-unaware per PRD
- Edit the spec — Modify
nexus-core.yamlfor Core changes; never hand-editapi.gen.go. Every operation requires a camelCaseoperationId— it becomes the Go method oncontracts.ServerInterface. - Lint —
npm run contracts:lint(or:core/:apifor a single spec). - Generate —
npm run contracts:genregeneratesnexus-core/internal/contracts/api.gen.go. The generated file is committed so drift is visible in PR diffs. - Reconcile handlers —
internal/handlers/http.Handlermust satisfycontracts.ServerInterface(compile-time check inhandler.go). Routes are mounted once viacontracts.HandlerWithOptionsincmd/api/main.go; no hand-rolled route table. - Drift guard —
npm run contracts:gen:checkregenerates and diffs; fails if the committed stub is stale. Run in CI alongsidego build ./....
npm run contracts:lint # lint both specs
npm run contracts:gen:check # fail if generated stub is staleMIT — see LICENSE.