Maintaining These Docs
How this site is built, and what to run when the API or an app changes.
This site is a Fumadocs project in the docs/ folder. Guides are MDX files; the API reference is generated.
Layout
| Path | Holds |
|---|---|
content/docs/ | Every guide page. Each top-level folder is one section of the sidebar switcher. |
content/docs/api-reference/ | The hand-written API pages. Endpoint pages are generated next to them at build time and are not files. |
openapi/base.json | The route list extracted from the service. Generated. |
openapi/overlay/*.json | Descriptions, access rules and response examples for each endpoint. Written by hand. |
openapi/homelink.json | The merged OpenAPI document the site renders. Generated. |
public/screenshots/ | Screenshots, one folder per app. |
scripts/ | The two scripts that build the OpenAPI document. |
When an endpoint changes
cd docs
npm run apiThat runs two steps:
api:extractimports the service's routes (it starts no server and opens no database connection) and writes every method, path, validator and auth flag toopenapi/base.json.api:buildmerges the overlay files on top and writesopenapi/homelink.json, the endpoint table and the sidebar order.
The build prints two kinds of warning, and both mean the docs are out of date:
no overlay entry for POST /api/v1/...: a route exists in the code with no description. Add an entry to the matching file inopenapi/overlay/.overlay entry ... matches no route in the code: a described route was removed or renamed. Delete or rename the entry.
Run npm run api:build -- --strict in CI to fail on either.
An overlay entry
Keys are the method and the full path. Everything is optional except what you want shown.
{
"PATCH /api/v1/booking/{id}/confirm": {
"summary": "Confirm a booking",
"description": "Markdown. Rules, side effects, state changes.",
"auth": "bearer",
"roles": ["LANDLORD"],
"requirements": ["Caller must be the booking's landlordId"],
"paramDescriptions": { "id": "Booking id." },
"extraParams": [{ "name": "page", "in": "query", "type": "integer", "default": 1, "description": "Page number." }],
"bodyFieldDescriptions": { "confirmedDate": "ISO date of the visit." },
"requestExample": { "confirmedDate": "2026-12-01T10:00:00.000Z" },
"responses": [
{ "status": 200, "description": "Confirmed", "example": { "status": 200, "success": true, "message": "Booking confirmed", "data": {} } },
{ "status": 404, "description": "No such booking", "example": { "status": 404, "success": false, "message": "Booking not found", "data": null } }
]
}
}auth is one of public, bearer, optional, query-token or signature. Use bodyFields (a list of name, type, required, description) for routes that read a body without a validator, "new": true for routes the extractor cannot see (routers mounted outside /api/v1), and "remove": true to hide one.
The build adds the errors every endpoint shares, so do not repeat them: 400 for validation failures on validated routes, 401 on protected routes, 403 on role-restricted routes, and 500.
When a screen changes
Edit the page under content/docs/<section>/. Pages are MDX, so a bare { or < in prose breaks the build: put code, route parameters and JSON in backticks.
Screenshots go in public/screenshots/<app>/ and are placed with:
<Screenshot src="/screenshots/admin/users.png" alt="Users table" caption="The Users table with the status filter open." />Add device="phone" for mobile captures. Use seeded or fake accounts for screenshots, never a real customer's data.
Preview and build
npm run dev # http://localhost:3000
npm run build # production build; fails on broken MDX
npm run types:checkSearch is built in and indexes every page, including the endpoint pages.