Writing docs
Every page on this site is a Markdown file. Public pages live under docs/ and signed-in pages under docs/private/, each in the folder of its place in the navigation, so the folders read like the sidebar: docs/reaktor/plane-data/reaktor-db.md is the Data layer page in the Data plane. A page's file name is its address, /docs/reaktor-db, whichever folder holds it, so file names are unique and moving a page to another folder keeps every link to it. Each file's frontmatter says where the page sits in the navigation, which of its sections other pages may link to, and how it relates to other pages. The sidebars, the home page index, the documentation map, llms.txt, outline.json, graph.json and the search corpus are all generated from those declarations, so the Markdown is the only thing you edit.
Place in the navigation#
Every page declares doc_catalog:
title: Data layer (Tidemark)
sidebar_label: Data layer
doc_catalog:
region: plane-data
order: 1
owner: Reaktor
kind: design
summary: One or two sentences on what the page covers, written for someone deciding whether to read it.
use: When a reader should open this page.
region places the page in exactly one region of the navigation. Regions are declared under reaktor_regions in docs/home.md for public pages and in docs/private/home.md for private ones, and they nest like folders: a region without a parent is a group in the sidebar, a region with one is a folder inside its parent, and a folder can hold folders. Each region names its folder, and a page's file sits in its region's folder, below the folders of the regions above it; the build names the folder for a file that is anywhere else. In a region with order: manual, pages go by their order and a folder sits at its position among them, or after the pages when it has none; other regions list the most recently changed page first. A region with title: null has no folder and shows its pages in its parent.
summary appears in the home page index, in search results and in llms.txt, so write it as a complete sentence. kind is a short label such as guide, module, design, tool or textbook.
Status#
doc_status tells the reader how far to trust a page. Leave it out for guides and pages that describe the code as it is.
| Status | Meaning |
|---|---|
design | A proposal. The page must say near the top which parts, if any, exist. |
implemented | The page was checked against the code. Needs verified_at, verified_revision and verification_evidence. |
qualified | Implemented and measured against stated targets. Needs the same three fields. |
When a page is replaced, delete it and fix the links to it. Git keeps the old version.
How a page is laid out#
Pages about a module or a tool follow one order, so a reader always knows where to look:
- Overview. One diagram of the whole subject and a few paragraphs that explain it at the top level, before any detail.
- Try it. A playground or a screenshot that shows the idea working, when the subject allows one.
- How it works. The details, one concept per section, each with its own diagram, screenshot or code sample.
- What it improves. A table with three columns: the usual approach, what goes wrong with it, and what Reaktor does.
- Limitations. What does not work yet, and the traps a reader should know before relying on it.
- Reference. Where the code lives, the main files and tests, and the related pages.
Graph is the model page. Long pages that predate this order keep their sections and gain an overview at the top and the improvements and limitations near the end. Design pages keep their own structure and say near the top which parts exist.
Diagrams, screenshots and playgrounds#
Diagrams are SVG files in static/img/diagrams/, written by scripts/diagrams.mjs. Edit that script and run node scripts/diagrams.mjs from services/reaktorWeb/docusaurus to regenerate them. They share one style: dashed frames group what belongs together, cards are coloured by what they hold (code green, data amber, running parts blue, operations violet, outside systems grey), and wires run from what provides to what uses. Embed a diagram as a figure:
<figure class="rk-fig"><a href="/docs/img/diagrams/graph-overview.svg"><img src="/img/diagrams/graph-overview.svg" alt="What the picture shows, in a sentence or two" width="1080" height="450"></a><figcaption>What to take from it, in one sentence.</figcaption></figure>
The build copies every SVG whose root element has the class dia into the page, so the diagram follows the site's light and dark themes. Write the alt text as a description of the picture for a reader who cannot see it.
Screenshots of Hangar live in static/img/hangar/ as WebP files, captured headlessly at twice the window's size so they stay sharp on high-density screens. Embed one the same way with class="rk-shot". A figure can hold two images with the classes is-light and is-dark, and the page shows the one that matches the theme. Wrap several figures in <div class="rk-gallery"> to lay them out in a grid.
Playgrounds are editable code boxes with a live picture beside them. Put the starting code in a fenced block inside a rk-try element, with a blank line on each side so the Markdown inside is still read:
<div class="rk-try" data-widget="wiring" data-title="Wire a checkout graph">
```kotlin
class CheckoutGraph : Graph(label = "Checkout") { … }
```
</div>
Readers without JavaScript, the search index and llms.txt see the code block, and the browser replaces it with the playground. The widgets are wiring (Kotlin graph code and the map it builds), scopes (nested graphs, dependsOn() and wire()), editor (the Hangar graph editor's rules on a graph declared in Kotlin), mailbox (messages sent to an actor, with and without its mailbox), replicas (edits on several replicas of an OR-Set, counter or register, merged as a CRDT or overwritten on sync), capabilities (machines described as capability trees and needs matched against them, with a verdict and reasons for each machine), allocations (hosts that start, lose and report a task, with leases, generations and reassignment), access (an authorization model, its tuples and checks, answered by a TypeScript copy of reaktor-auth-core's check) and affected (build nodes and changed paths, selected the way reaktor build affected selects them). Their code is in src/widgets/. When the Kotlin they copy changes, change the copy too.
Named sections#
Other pages can link to a section only when the page declares it as a port:
reaktor_graph:
version: 1
ports:
- {id: page, anchor: '', profile: document}
- {id: lifecycle, anchor: lifecycle, profile: section}
relations: []
The empty anchor stands for the whole page. Every other anchor must exist in the page, so give linked headings an explicit ID, such as ## Lifecycle {#lifecycle}, which keeps the link working when the heading text changes. Another page refers to the port as reaktor-core#lifecycle. If a heading's anchor changes or disappears, the build fails until the port is fixed or removed.
profile describes what the section is: document, section, procedure, navigation or a more specific word.
Links between pages#
A relation links a port on this page to a port on another page:
relations:
- id: lifecycle-guide
kind: explains
from: page
to: reaktor-core#lifecycle
from is a port on the page that declares the relation, and to is page-id#port-id. Declare a relation once, on one of the two pages; the other page's incoming links are computed.
A relation can also join more than two pages. List every participant with its role:
relations:
- id: service-boundary
kind: explains
participants:
- {port: page, role: explanation, ordinal: 0}
- {document: reaktor-service, port: page, role: subject, ordinal: 0}
- {document: auth-analysis, port: page, role: subject, ordinal: 1}
Leaving out document means this page. Repeated roles need distinct ordinals.
The kinds are references, requires, explains, implements, supersedes and derived-from. Use references for an ordinary citation. A Markdown link in the prose is checked for a broken target, but it does not create a relation.
The documentation map on the home page draws each relation as a wire between ports, and a relation with more than two participants as a junction.
Changing a page#
-
Edit the prose and the frontmatter together. Add or remove a port when its section appears or disappears, and update the relations that point at it.
-
Before you delete a page or a port, search the docs for
page-id#port-idand for participants that name the page. -
For a new page, put the file in its region's folder, set its
regionandorder, and declare thepageport. To move a page, move the file and change itsregiontogether. For a new region, add it to the right home page with itsfolder. -
Regenerate the navigation from
services/reaktorWeb/docusaurus:pnpm run nav -
Build the site and run the documentation checks, as Contributing describes, then look at the new sidebar and home page.
Never edit sidebars.ts, private-sidebars.ts, the generated blocks of docs/home.md or the files under static/ that the build writes. Fix the Markdown and regenerate.
What the build checks#
The build fails on a page outside every navigation group, a page whose file is not in its region's folder, two pages with the same file name, an unknown or cyclic group, a duplicate port or relation, an anchor that does not exist, a relation to an unknown page or port, and a repeated role position. Public pages cannot link to private pages in their frontmatter. Private relations appear only in the signed-in build, and never in the public map or exports.