Skip to Content
OPENCBSDevelopers

Writing docs

How the two documentation sites are built and how to add a page.

There are two sites, built the same way:

SitePackageContentDev server
Developer docs@cbs/docs-developersapps/docs-developers/content/docshttp://localhost:3001
User guide@cbs/docs-usersapps/docs-users/content/docshttp://localhost:3002
yarn workspace @cbs/docs-developers dev
yarn workspace @cbs/docs-users dev

Both run Fumadocs on TanStack Start and build to static HTML, so any static host can serve them.

Add a page

Create an .mdx file in the content folder. The file path is the URL: content/docs/api/auth.mdx is served at /docs/api/auth.

---
title: Authentication
description: How a client gets and refreshes a session.
icon: KeyRound
---

Body in Markdown, with MDX components where they help.

icon takes any Lucide name. A meta.json next to the pages sets the folder title and the order. Its "..." entry stands for every page the list doesn't name; take it out and those pages drop out of the sidebar.

Components

Callout, Cards and Card work in every page without an import. Steps, tabs, file trees and the rest come from fumadocs-ui/components/*, and anything in @cbs/ui/web/* can be imported the same way.

Colours come from the design system

The sites load @cbs/docs/theme.css, which maps the Fumadocs palette onto the @cbs/ui tokens. Use token classes such as text-ink-secondary or bg-brand, never a hex value or a raw palette step.

Translate a user guide page

The user guide is in English and French. Put the French version next to the English one with a .fr suffix: index.mdx and index.fr.mdx. A page with no French version falls back to English.

Error pages

/errors and one page per code are built from apps/docs-developers/error-catalog.json. Don't edit that file by hand; regenerate it from cbs.exceptions:

python3 scripts/build-error-catalog.py

Build

yarn workspace @cbs/docs-developers build

The static site lands in dist/client. Every page is prerendered, and search reads a prebuilt index, so no server is needed.

To build both sites the way CI does, use Docker. It installs only the packages the docs need, builds the two sites in parallel, and reuses every step whose inputs did not change:

docker buildx bake -f docs.docker-bake.hcl

The sites land in dist/docs/developers and dist/docs/users, with a .gz copy of each text file for nginx. The host nginx configuration is in config/docs/nginx.

On this page