Skip to content

API & OpenAPI

The backend is spec-first: backend/openapi.yaml is the source of truth for the REST API. The server handlers and the typed frontend client are generated from it — you change the spec first, then regenerate code, never the other way around.

The spec is split across multiple files so it stays maintainable:

backend/
openapi.yaml # root: info, servers, components, tags, and $ref index
paths/<domain>.yaml # operations, one file per tag/domain
schemas/<domain>.yaml # schemas, one file per domain

The convention is one tag = one paths/ file = one schemas/ file.

The API is organised into these domains (one paths/*.yaml file each):

GroupGroup
activitiesagents
ai-toolsapi-keys
artifactsattachments
authbackoffice
blueprintscontact
embedding-providersfeeds
githubhealth
invitationsmemories
notificationsprojects
promptssearch
subscriptionssupport
teamstypes
userwebhooks

Shared schema definitions live in schemas/common.yaml; other schemas/*.yaml files mirror the path domains.

The multi-file source is bundled into a single artifact with Redocly before linting, docs, and code generation:

Terminal window
make backend-bundle-openapi
# → backend/dist/openapi.bundled.yaml

Always consume the bundle (dist/openapi.bundled.yaml), not the source tree.

Terminal window
make backend-validate-openapi # structural validation (swagger-cli)
make backend-lint-openapi # ruleset linting (vacuum, Spectral-format ruleset)

CI runs both, so run them locally before committing.

The bundle drives oapi-codegen, which produces the strict-server bindings and shared types. The generated code is committed and must never be hand-edited:

Terminal window
make backend-generate-openapi-server

See Code Generation for the full set of generators (oapi-codegen, Wire, mockery) and the golden rules around them.

A change to the API ripples through three repos in order:

  1. Update the spec. Edit backend/paths/*.yaml / backend/schemas/*.yaml, then regenerate the server (make backend-generate-openapi-server) and implement the handler/service/repository logic. Validate and lint the spec.
  2. Release a new @vibexp/api-client. The typed client is generated from the spec in the separate api-client-js repo and published to npm.
  3. Bump the frontend dependency. Update the frontend to the new @vibexp/api-client version and use the new endpoints/types.