Beck
Docs /YAML schema

YAML schema

A Beck document is a YAML mapping that opens with a root type: declaring what kind of diagram it is. The type picks the layout engine and the top-level keys; everything else — theming, animation, fenced-block rendering — is shared. Only ids are required; every other field has a default, filled in before the diagram is laid out.

type what it draws top-level keys
architecture the layered boxes-and-lines system diagram meta nodes groups edges flow
sequence participants, lifelines, and ordered messages meta participants messages flow
state a state machine of pills and transitions meta states transitions flow
class UML class cards and relations meta classes relations groups flow
flowchart a decision/process graph meta steps links flow
mindmap a nested topic tree meta root topics flow

The flow block has its own page: Flow & animation. For a visual tour of these constructs, see the syntax cheatsheet.

yaml
type: architecture   # architecture | sequence | state | class
meta:    { ... }     # optional — title, direction, theme, fit, spacing
nodes:   [ ... ]     # the boxes
groups:  [ ... ]     # optional — labelled boundaries
edges:   [ ... ]     # optional — the connections
flow:    { ... }     # optional — scripted animation (see the flow reference)

Note

A document without a type: still renders as an architecture diagram, but that form is deprecated — the engine logs a console warning. Always declare the type.

meta

Shared by every diagram type; all keys are optional. (direction and spacing.rank only affect the layered types — architecture, state, class.)

key type default description
title string Title drawn above the diagram.
subtitle string Muted line under the title.
direction TB BT LR RL TB Primary layout axis: top-to-bottom, bottom-to-top, left-to-right, right-to-left.
theme auto light dark auto auto follows the host page.
style string classic Visual style token — one of the nine built-ins (classic, minimal, terminal, blueprint, glow, brutalist, sketch, extrude, circuit) or a registered custom style. See Pick a built-in style and the style system reference.
animate bool true false renders a static frame and never loads the motion runtime.
loop bool true false plays the flow once (forces flow.repeat: 0).
fit shrink scroll shrink What a diagram wider than its container does: shrink scales it down to fit; scroll keeps it at natural size and scrolls horizontally. Vertical size is never constrained.
spacing mapping see below Layout gaps and corner radius.
narrate bool or mapping true Narration caption bar: false suppresses it; a mapping tunes the reading-time pace. See below.

spacing keys:

key type default description
rank number (px) 96 (state/class 130) Gap between ranks, along the flow direction.
node number (px) 32 (state/class 72) Gap between nodes within a rank, across the flow.
cornerRadius number (px) 16 Corner radius on cards and edge bends.

narrate keys (a mapping value; a bare boolean just toggles enabled):

key type default description
enabled bool true false suppresses the caption bar entirely.
wpm number 170 Reading pace, words per minute — drives each caption's auto hold.
min number (s) 1.4 Floor on a caption's on-screen time.
pad number (s) 0.5 Extra seconds on top of the reading time.

Captions are supplied by a narrate flow step or a connector note: (see edges, messages, transitions below); meta.narrate only paces and toggles them.

nodes (type: architecture)

A list of nodes. Each needs a unique id; everything else is optional.

key type default description
id string Required. Unique identifier, referenced by edges and groups.
title string = id Display title.
subtitle string Muted second line.
kind enum service Archetype; sets the default icon, accent, and variant. See node kinds.
variant solid subtle ghost per kind Visual weight: subtle is dimmed; ghost is dashed and transparent.
icon icon key or inline <svg> per kind A named icon or raw SVG markup. An unknown key falls back to the kind's icon.
status string Status-pill text.
items list of strings Bulleted list rendered inside the card.
body string Wrapped paragraph rendered under the title (and items, if any).
accent token or CSS colour per kind A colour token or a raw colour.
href string Renders the card as a link (<a href>).
target string Anchor target (e.g. _blank); only meaningful with href.
surface CSS colour theme surface Override the card background.
textColor CSS colour theme text Override the card text colour.
width number (px) auto Fix the card width (prevents reflow when the status changes).
rank number auto Force the node onto a specific layout rank.
order number auto Tie-break order within a rank.
group string Inline group membership (alternative to listing the node in a group's members).

Node kinds

kind is a shorthand that sets three defaults at once. Each is independently overridable.

kind accent icon variant
service primary service solid
db info db solid
queue warn queue solid
cache warn cache solid
gateway primary gateway solid
external neutral external solid
user success user solid
ghost neutral service ghost

groups (architecture and class)

A list of labelled boxes drawn around member nodes (namespace boxes, in a class diagram).

key type default description
id string Required. Unique identifier.
label string = id Box label.
members list of node or group ids A group id member nests that group inside this one.
accent token or CSS colour neutral Box accent.

Membership is a tree: every node or group belongs to at most one parent, and a group cannot nest inside itself. A node can also join a group inline with its own group key. An edge's from/to may target a group id.

edges (type: architecture)

A list of connections. from and to are required and must resolve to a declared node or group.

key type default description
from node or group id Required. Source endpoint.
to node or group id Required. Target endpoint.
label string Drawn on the line.
kind enum data Semantic kind; sets default style, colour, and packet motion. See edge kinds.
style solid dashed per kind Line style.
curve step-round straight s step-round Routing shape: orthogonal with rounded corners, a straight line, or a smooth S-curve.
color token or CSS colour per kind Stroke colour.
arrow none end start both end Which ends carry an arrowhead. The bool true/false maps to end/none.
note string Narration caption for this hop, shown just before its packet in a derived flow. Ignored when a flow: is authored.
fromSide top bottom left right auto Pin the side the line leaves the source.
toSide top bottom left right auto Pin the side the line enters the target.

A feedback edge — one that runs back against the flow and would have to jump over the nodes between its endpoints — automatically loops out on a clear face (over the top for LR/RL, out the left for TB/BT) instead of jogging through the forward chain, so the forward edges stay straight. An adjacent back-and-forth pair (two nodes wired both ways, with nothing between them) is left inline as two parallel lines. Pin fromSide/toSide to force a specific loop face — e.g. both bottom to route the return under the row — or set curve: straight for a direct line.

Edge kinds

kind style colour packet motion
data solid edge medium dot, steady
control solid edge small dot, fast, accelerating
async dashed edge large dot, slow, eased
dependency dashed neutral small dot, no glow

The packet-motion column describes the default animation along an edge of that kind; see Flow & animation for the exact values and how to override them.

participants and messages (type: sequence)

A sequence diagram lays participants out as columns (in declared order) and draws messages as rows, in authored order. Without a flow:, the message order is the animation — one packet per message. See the sequence diagrams guide.

participants entries take the same fields as architecture nodes (id, title, subtitle, kind, icon, accent, …); layout keys (rank, order, group) are ignored.

messages entries:

key type default description
from, to participant id Required. Equal ids draw a self-message loop.
label string Drawn above the arrow.
reply bool false A return message: dashed, open arrowhead, closes the receiver's activation bar.
kind data control async dependency data (control for replies) Semantic kind; async renders dashed with an open arrowhead.
style solid dashed per kind Line style override.
color token or CSS colour worker's accent Stroke colour. Defaults to the accent of the participant doing the work — the receiver of a call, the sender of a reply — so request/reply pairs share a hue.
note string Narration caption for this message, shown just before it fires in the derived flow. See narration.
activate bool auto Force (true) or suppress (false) an activation bar on the receiver.

A list entry of the form - section: <label> (instead of a message) opens a tinted, dashed band around every message until the next section (or the end), and becomes a phase seek point in the derived animation. It takes an optional accent (token or CSS colour, default neutral) that colours the band's border, fill, and floating label.

Activation bars are automatic: a non-reply message starts a bar on its receiver when a later reply: true from that receiver back to the sender closes it. Nested request/reply pairs nest the bars.

states and transitions (type: state)

A state machine on the layered engine — states are pills, transitions are labelled edges. States referenced only by transitions are auto-created, so a terse machine needs nothing but transitions:. The token "[*]" (quote it — YAML) is the UML entry/exit pseudo-state: use it as a from for the initial dot, as a to for the final bullseye. See the state diagrams guide.

states entries (all optional refinements):

key type default description
id string Required.
title string = id Pill text.
subtitle string Muted second line.
accent token or CSS colour neutral Pill accent.
width, rank, order number auto Same as architecture nodes.

transitions entries:

key type default description
from, to state id or "[*]" Required. Equal ids draw a self-loop.
label string Drawn on the line.
style solid dashed solid Line style.
color token or CSS colour edge Stroke colour.
note string Narration caption for this transition, shown just before its packet in the derived flow. See narration.

classes and relations (type: class)

UML class cards — a «stereotype» + name header and field/method compartments — joined by relations with the classic end markers. groups (namespace boxes) work exactly as in architecture diagrams. See the class diagrams guide.

classes entries:

key type default description
id string Required.
name string = id Class name (alias: title).
stereotype string Rendered as «stereotype» above the name (e.g. interface, abstract).
fields list of strings Field compartment lines, e.g. "Id: Guid".
methods list of strings Method compartment lines, e.g. "Submit()".
accent token or CSS colour primary Header tint.
href, target string Link the card (e.g. to API docs).
group string Namespace-box membership.
width, rank, order number auto Same as architecture nodes.

relations entries — note the direction conventions:

key type default description
from, to class id Required.
kind see below association Relation kind; picks the markers, style, and layout direction.
label string Drawn on the line.
fromCard, toCard string Multiplicities near the ends, e.g. "1", "*".
color token or CSS colour per kind Stroke colour.
kind authored direction rendering
inherits child → parent solid, hollow triangle at the parent
implements class → interface dashed, hollow triangle at the interface
association source → target solid, arrowhead at the target
aggregation whole → part solid, hollow diamond at the whole
composition whole → part solid, filled diamond at the whole
dependency source → target dashed, open arrowhead at the target

Parents rank above children automatically (inherits/implements are flipped internally so the hierarchy reads top-down). Class diagrams are structural, so they don't animate by default: without a flow: the diagram renders a still frame. Script a flow: if you want a guided tour.

A decision/process graph on the layered engine. Steps referenced only by a link (never declared under steps:) are auto-created as plain process cards, so a terse flowchart needs nothing but links:. The token "[*]" (quote it — YAML) is the start/end pseudo-step: use it as a from for the start terminator, as a to for the end terminator. See the flowchart guide.

steps entries (all optional refinements):

key type default description
id string Required. Unique identifier.
text string = id Display title.
kind process decision terminator io start end process Shape: process → card, decision → diamond, terminator → pill, io → parallelogram, start/end → the start/end pseudo-shape.
subtitle string Muted second line.
accent token or CSS colour neutral Step accent — uniform across every kind.
icon icon key or inline <svg> Same icon vocabulary as architecture nodes.
href, target string Link the step.
surface, textColor CSS colour theme Same one-off overrides as architecture nodes.
width, rank, order number auto Same as architecture nodes.

links entries:

key type default description
from, to step id or "[*]" Required.
label string Drawn on the line — e.g. a decision branch's yes/no.
style solid dashed solid Line style.
color token or CSS colour edge Stroke colour.
note string Narration caption for this link, shown just before its packet in the derived flow. See narration.

root and topics (type: mindmap)

A nested topic tree drawn as a two-sided "butterfly": a central root, first-level branches split left/right, subtrees fanning outward. meta.direction is accepted but ignored — the layout is fixed. See the mind map guide.

root — the centre topic. Either a plain string (shorthand for title) or a mapping:

key type default description
title string Required (or use the plain-string shorthand).
id string auto Explicit id; defaults to an engine-assigned path-derived id.
subtitle string Muted second line.
items list of strings Bulleted list rendered inside the card.
body string Wrapped paragraph rendered under the title/items.
accent token or CSS colour primary Root accent; flows to first-level branches that don't set their own.
icon icon key or inline <svg> Same icon vocabulary as architecture nodes.
href, target, surface, textColor, width Same as architecture nodes.

topics — the first-level branches, and (via children) every deeper topic. Same fields as root, plus:

key type default description
children list of topics Nested topics, to any depth. Each is a string or a mapping with the same fields.
status string A semantic status pill on a rank-1 card; the colour follows the word (see below).
variant / ghost ghost / true Mark a not-yet-real branch: it and its whole subtree render neutral, dashed, and shadowless with a faint planned label.

Depth roles. Shape and size follow depth: the root (210×68) and every rank-1 branch (190×56) are cards; from rank 2 outward a heading is a light pill. A topic with items/body stays a card at any depth. Icons appear only on the root and rank-1 cards.

Accent cycling and inheritance. The root resolves to primary. Each first-level branch takes the next token from the cycle info, primary, success, warn, danger (wrapping; neutral is reserved for ghost branches). Every descendant inherits its parent's resolved accent unless it authors accent: explicitly — which then flows to its own children. Edges are undirected parent → child curves with no arrowhead, in a muted blend of the child's accent and the edge colour, fanning from a single point on each parent.

Status colours. complete/done → success · in progress → warn · blocked → danger · review → info · planned → neutral · anything else → the branch accent.

A mind map renders static — no packets or narration, identical to the reduced-motion frame. A flow: is accepted for forward-compatibility but is not animated.

chart series (type: chart)

A small, static data chart — bar, line, pie/donut, or scatter. Charts carry no nodes or edges and share only the meta block. Every series colour is derived from --beck-primary by the chosen palette, so the chart adopts your palette and flips light/dark. See the chart guide.

Top-level keys:

key type default description
chart bar | line | pie | donut | scatter bar The chart kind.
palette analogous | monochromatic | complementary | sequential analogous How series colours beyond the first are derived from --beck-primary.
legend right | top | bottom | none right Legend placement.
legendValues bool false Annotate each legend entry with its value (a right-hand column of single-magnitude series).
center string Pie/donut centre headline (e.g. a total).
centerLabel string Pie/donut centre sub-caption under center.
series list Required. One entry per bar, slice, line, or point cluster.

Each series entry:

key type default description
label string Series N Legend / label text.
value number A single magnitude — bar / pie / donut.
values list of numbers A value per x-step — line.
points list of [x, y] pairs Data points — scatter.
color token or CSS colour palette slot Override this series' derived colour.

Palettes. analogous steps the hue either side of the primary (categorical, the default); monochromatic mixes the primary toward the surface (ordered magnitude); complementary alternates the primary with its opposite, lightening per pair (two-way comparison); sequential fades the primary toward neutral (one continuous scale). Each is a pure color-mix/relative-colour expression over the tokens — swap --beck-primary and every series follows.

Charts render static — no flow or animation.

Icons

Set a node's icon to one of these named keys. Many keys are aliases that share a glyph. An unknown key falls back to the node kind's default icon, so a typo never drops the glyph. See every glyph rendered live in the icon reference.

category keys
Compute & services service server · function · container pod · kubernetes k8s · lambda serverless · agent
Data & storage db database · cache redis memory · bucket storage · warehouse · file · vector embeddings
Networking & edge gateway shield · loadbalancer lb · cdn · ingress · firewall · external globe · cloud
Messaging & events queue · stream kafka topic · event · webhook · mail email · bell notification
Security lock · key · vault secret
AI & ML brain model llm ai
Clients & tools user · mobile · browser · terminal · code · api · git · repo
Observability & time chart metrics analytics · monitor · search · clock scheduler cron · bolt

For anything outside the set, pass raw inline <svg>…</svg> markup as the icon value. Use fill="currentColor" or stroke="currentColor" and a 0 0 24 24 viewBox so the glyph inherits the node's accent and theme.

Colours and theme tokens

Anywhere a colour is accepted (accent, edge color, flow-step color), you can give either a token or a raw CSS colour. Tokens follow the theme and recolour in light and dark mode; raw colours are frozen.

token default
primary your site's --color-primary-600
success emerald
warn amber
danger red
info violet
neutral grey

Under the hood every colour is a --beck-* CSS custom property that defaults to your site's --color-* palette, with a literal fallback. That is why a diagram adopts the host page's colours and dark mode with no configuration. Override a token by defining the host ramp (preferred) or by setting the --beck-* variable on an ancestor — see Match your theme and colours.

variable defaults to used for
--beck-surface --color-base-50 diagram background
--beck-node-bg --color-base-50 card background
--beck-node-border --color-base-200 card border
--beck-text --color-base-800 card title text
--beck-text-muted --color-base-500 subtitles, edge labels
--beck-text-faint --color-base-400 faint detail
--beck-primary --color-primary-600 the primary token
--beck-success emerald the success token
--beck-warn amber the warn token
--beck-danger red the danger token
--beck-info violet the info token
--beck-neutral --color-base-400 the neutral token
--beck-edge --color-base-300 edge stroke
--beck-packet --beck-primary default travelling packet
--beck-icon-bg --color-base-100 icon chip background

Light and dark are handled purely by redefining the surface, text, and edge variables under [data-theme="dark"]; the accent tokens ride your host ramps in both modes. There is no per-theme JavaScript and no hardcoded hex in the renderer.