Publishing this documentation
Every page here is a Markdown file in docs/. The tree is the source, scripts/docs-site.mjs
turns it into a static site, and nginx serves that site at https://docs.snolla.com behind the
deployment's edge, which holds the certificate.
node scripts/docs-check.mjs # all four checks below
node scripts/docs-check.mjs --self-test # prove the link check still fails on a broken link
node scripts/docs-site.mjs # build docs-site/ locally to look at it
The checks
| Check | What it proves | What it cannot see |
|---|---|---|
| Links | Every relative link in docs/ points at a file that exists, and every anchor at a heading that exists |
A remote document moving, and a link whose target exists but is wrong |
| Reference freshness | The committed docs/reference/admin-api.md equals what the generator produces from the live contract now |
Whether the contract itself is true — a document can be regenerated and still describe the wrong behaviour |
| Inventory | Every environment variable and CLI flag the shipped code reads is mentioned somewhere in docs/ |
Whether the mention explains it, and anything that is not a variable or a flag — an exported function, a config file key |
| Site build | Every page renders, and a link between pages reaches the page that was built | Whether the rendered page reads well, and whether the remote host is up |
The inventory reads the list from the code, not from a maintained table: the sources are the files git
tracks, so build output and vendored dependencies cannot invent a knob. A name that is deliberately
left out lives in docs/.docs-inventory-baseline.json — one name per entry, never a wildcard, so a
new variable cannot hide behind an old exemption. node scripts/docs-inventory.mjs --prune drops
exemptions that have since been documented.
The site build writes to a temporary directory: the gate must not leave artefacts in the tree. The build it produces is the same one the image carries, so a link that survives the gate is a link a reader can follow.
The generated page
docs/reference/admin-api.md is not written by hand. It is a projection of the admin API's own
document at GET /docs/json, and it is regenerated rather than edited:
node scripts/docs-reference.mjs # rewrite docs/reference/admin-api.md
node scripts/docs-reference.mjs --check # compare without writing; the gate runs this
node scripts/docs-reference.mjs --out <path> # write somewhere else
Editing that page by hand is a wasted afternoon: the next run of the gate replaces it. Change the route declaration it comes from and regenerate.
A hand-written reference
The content API has no such document — its routes are the contract — so its reference is written by hand, and the freshness gate for it is a test that compares the routes it documents with the routes the routers declare, in both directions:
yarn workspace @snolla/content-api test
A route added, renamed or removed without a word in the page fails that test. What it cannot see is prose: a documented parameter or an answer shape can still be wrong while every route is listed.
Writing a page
- English, second person, and about what a reader can do. Every fact points at a source: an endpoint, a file, a generated type.
- No internal addresses, no client names, no zone names, and no internal jargon — a site is a site, not a cell.
- A relative link to a page that exists, so the link check stays green.
docs/index.mdlists every page. A page nobody links to is a page nobody finds.
Shipping a change
A page is not published until the image is rebuilt and the stack restarted. The image tag is the day of the build, so a deploy is reproducible from the tag alone.
# 1. build and push (registry credentials: pass show vds-kzntsv/full-env)
docker login registry.kzntsv.site -u "$REGISTRY_USER" --password-stdin <<< "$REGISTRY_PASS"
docker build -f deploy/docs/Dockerfile -t registry.kzntsv.site/snolla-docs:<yyyy-mm-dd> .
docker push registry.kzntsv.site/snolla-docs:<yyyy-mm-dd>
# 2. one stack file, one host: the stack is managed in Portainer (stack `docs`),
# the image tag above is the only line that changes between releases.
The stack runs one container on the edge's proxy network with a Host(\docs.snolla.com`)router and theletsEncryptresolver, so the certificate is issued per host — exactly the pattern every other service on this deployment follows. Static pages carry no build hash, so the container sendsCache-Control: no-cache`: a stale page is worse than a reload.
llms.txt is generated next to the pages: the whole tree as one file a language model can read
without crawling.
What is not here
The site has no search, no versioning and no per-branch preview: those are features of a docs framework, and this build is deliberately the smallest thing that serves the tree. Adding one is a decision with its own price — a second application in the repository to keep working.
Related
- Content API reference — the hand-written reference and its test.
- Admin API reference — the generated one.
- Sites and nodes on a deployment — the operations side of the same deployment.