Summary: 7Mind authors all new HTTP APIs in TypeSpec inside the api-contracts repo and ships the resulting OpenAPI 3 specs as Redoc HTML on GitHub Pages, treating the published site as a shared coordination artefact rather than as generated client code. Sources: direct code inspection of api-contracts (main.tsp, tspconfig.yaml, package.json, .github/workflows/, docker/) Last updated: 2026-05-15
What is captured
The repo defines four parallel services, each in its own root file under contracts/:
SevenMind— the consumer-facing 7Mind API (magic.7mind.de)SevenSleep— the consumer-facing 7Sleep API (magic.7sleep.de)Identity— the identity service (id.7mind.de) plus aSuperTokenssub-namespace covering deprecated direct-to-SuperTokens routesInternal— internal endpoints (admin, healthchecks, Prometheus metrics)
Within each service, bounded contexts live in subfolders matching the modulith-domain-model domains on the server side: access, activation, analytics, content, monetization, practice, prevention, user. Each context owns its own .tsp file (and optional subfolder for large contexts like practice and content).
Shared building blocks live in contracts/shared/:
common.tsp— error models (Error<S>,CommonError,PremiumError, etc.), the three auth schemes, locale and versioning header aliasesprevention_models.tsp— ZPP / prevention models reused across servicessearch.tsp— Algolia search configuration
Toolchain
.tsp files contracts/**/*.tsp
│
│ @typespec/openapi3 emitter (tspconfig.yaml)
▼
specs.<service>.yaml tsp-output/@typespec/openapi3/
│
├─ @redocly/cli ──▶ static HTML (publish/<service>/index.html)
│ │
│ └─ GitHub Pages: sevenmind.github.io/api-contracts/
│
└─ outofcoffee/imposter-all ──▶ local mock API (ports 5080-5083)
Build-time dependencies (npm, pinned to latest): @typespec/compiler, @typespec/http, @typespec/openapi3, @typespec/rest, @redocly/cli. Runtime: none.
The OpenAPI YAML is the only emitted artefact today. No client SDKs are auto-generated — mobile and web clients hand-write their wire types and use the published spec as the agreed source of truth. If automated code generation is added later, update both this page and the api-contracts repo note.
How a new endpoint gets added
- Pick the right service and bounded context (or create a new
.tspundercontracts/<service>/<context>/and import it from<service>/<context>.tsp). - Add models and an
interfacewith@route,@summary,@docdecorators. - Apply one of the three auth schemes from
Shared.Common.Requestsvia@useAuth. - Run
npm run format(orjust format) — the format check is enforced in CI. - Open a PR. A “PR Preview” comment will appear linking to
…/preview/pr_<number>with the rendered Redoc site. - After merge, push to
maintriggers the publish workflow and the live docs update.
Publish pipeline
.github/workflows/check.yml— format + compile matrix on every push..github/workflows/publish-pr-preview.yml— builds HTML on PR open/sync, uploadspr_<number>artefact (30-day retention), posts/updates the preview comment..github/workflows/publish-main.yml— on push tomain, callsreusable-publish.yml..github/workflows/reusable-publish.yml— the production GitHub Pages deploy; downloads open PR preview artefacts so previews remain visible alongside main..github/workflows/post-to-changelog.yml— posts to the#backend-squad-changelogSlack channel when a merged PR has thechangeloglabel.
What agents in other repos should know
- The published spec is design-leading, not always production-accurate. It may be ahead of elixir-backend or slightly behind it. When you spot drift, opening a PR against api-contracts is encouraged.
- Endpoints marked
#deprecatedin the contracts indicate an in-flight migration (e.g./user_identity/*is being replaced by/user/*). New clients should target the non-deprecated path. - The mock API (
localhost:5080-5083viajust serve) is useful for client development without a live backend. - Adding or changing a contract is a code-owned activity — see the
CODEOWNERSrules in the api-contracts repo note.
Related
- api-contracts — the repo this concept lives in
- api-versioning-headers — how clients declare app version and request a specific response version
- supertokens-auth — the three auth schemes are declared in
contracts/shared/common.tsp - chargebee-billing — Chargebee, Mondia and Fastspring webhook contracts live under
SevenMind.Monetization - modulith-domain-model — the contract bounded contexts mirror the backend domain layout
- elixir-backend — the primary server implementation of these contracts
- 7mind-mobile-apps-monorepo — a primary client of the contracts
- nuxt-website — another client of the contracts