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
Screenshots are taken by a script, against a mock API, so they never show a real customer's data and can be retaken whenever the UI changes.
-
Start the mock API. It answers every endpoint with the example from
openapi/homelink.json, signs in any email (agent@...,lawyer@...,admin@...,tenant@...pick the role) and serves placeholder images.node scripts/mock-api.mjs -
Start each web app pointed at it, on the ports the script expects (the
docs-shot-*entries in.claude/launch.jsondo this):VITE_API_BASE_URL=http://localhost:4600 npm --prefix ../app run dev -- --port 5281 VITE_API_BASE_URL=http://localhost:4600 npm --prefix ../client-app run dev -- --port 5282 VITE_API_URL=http://localhost:4600/api/v1 npm --prefix ../admin run dev -- --port 5283 -
Take the shots. Each one is listed in
scripts/screenshots.config.mjswith its page, role and the clicks that open the right dialog.node scripts/capture-screenshots.mjs # all of them node scripts/capture-screenshots.mjs admin- # only ids starting with admin- node scripts/capture-screenshots.mjs --probe client-app /listings AGENT # look at one page
Images land in public/screenshots/<app>/<id>.jpg and are placed with:
<Screenshot src="/screenshots/admin/admin-users-table.jpg" alt="The users table" caption="The users table, with the stat cards above it." />The script drives the Chrome installed on the machine (set CHROME_PATH to use another). Mobile screens are not captured: the mobile app's API address is fixed in code.
Diagrams
State and sequence diagrams use Mermaid:
<Mermaid chart={`stateDiagram-v2
[*] --> draft
draft --> pending_verification: Publish
`} />Preview and build
npm run dev # http://localhost:3000
npm run build # static site in out/, fails on broken MDX or typesThe build is a static export: out/ can be served by any static host. Search runs in the browser and indexes every page, including the endpoint pages.
HomeLink Hub