Language Reference
FractalForm diagrams are plain-text scripts for animated system diagrams. A minimal diagram can be one edge:
client -> api: GET /users
api -> client: 200 OK
Edges and state updates create components automatically. Add declarations, phases, notes, overlays, artifacts, playback directives, and control blocks only when the diagram needs them.
Quick reference
# bare declaration
component api# with title
component api "API"# title, shape, icon, tags
component api "API" shape:hexagon icon:server [backend]More…# trailing marker opens a body
# indented lines render as markdown
component api "API":
Handles HTTP ingress.# guide bar marker
component api "API":
Handles requests.
- validates input# brace marker
component policy "Policy" }
Never trusts metadata.More…# simple edge
api -> db# with label
api -> db: SELECT users# with modifier and color
api -> upstream: timeout edge:dropped,#ff4d4fMore…# expands to adjacent pairs
client -> api -> db# mixed arrow types
client -> api --> cache ->> queueMore…# synchronous
-># one-to-many
api -> [worker-a, worker-b]# fan-out with label
api -> [worker-a, worker-b]: job# fan-in
[service-a, service-b] -> api: resultMore…# visual boundary
group
...
end# display name only
group "Backend"# key, name, shape, icon
group infra "Infra" shape:rect icon:cloudMore…# free-floating canvas annotation
text title "Request Flow"# with shape and color
text title "Request Flow" shape:rect,solid,xl,#info# markdown body
text:
**Legend:** public request pathMore…# component content update
api: Processing request# phase: Authentication# phase: Authentication
# Validates credentials and issues a token.# phase: Token refresh
# Exchanges a valid refresh token for a new access token.More…# note: Text# canvas-level message
# overlay: Text# artifact travels with the message
api -> user: ... %jwt# dim a component
--dim api# clear all state
--clear# insert a delay
--wait 2s# enable from 1
--autonumber# loop N times
repeat 3
...
end# concurrent commands
parallel
...
end# fetch from cache and database together
parallel
api -> cache: read user
api -> db: SELECT user
endMore…# reusable block
block healthcheck
...
end# invoke
@healthcheck# run in background
--detach @healthcheck# wait for completion
--attach @healthcheckMore…# set a variable
$state: valueSyntax families
| Family | Form | Purpose |
|---|---|---|
| Narration comments | # phase:, # note:, # overlay: | Visible timeline narration and navigation. |
| Visual directives | shape:..., icon:..., edge:..., [tags] | Typed visual metadata for components, groups, text, edges, and tags. |
| Playback directives | --wait, --step, --speed, --clear, --dim, --show, --hide, --outline, --autonumber, --detach, --attach | Timeline, visibility, timing, numbering, and background work control. |
| Control blocks | repeat, parallel, block, *block, *repeat | Group commands for loops, concurrency, reuse, and detached work. |
Components
Declare named topology nodes. Edges and state updates auto-create components, so declarations are only needed for custom labels, shapes, icons, tiers, tags, descriptions, or hierarchy. Examples: Components, Descriptions.
Syntax:
| Parameter | Description | Example |
|---|---|---|
key | Required identifier | component api |
"Display Name" | Quoted label | component api "API Gateway" |
shape:shape,tier | Shape and visual tier | component api shape:hexagon,xl |
shape:shape,many | Stacked pool/replica rendering | component workers shape:hexagon,many |
icon:name,badge | Icon with optional badge mode | component api icon:server,badge |
[tags] | Comma-separated visual metadata | component api [backend, gateway] |
Aliases: c.
Shapes: default, circle, database, hexagon, diamond, note, actor, icon, cloud, browser, server, funnel, code.
Tiers: xl, lg, md (default), sm, xs.
# full declaration
component api "API Gateway" shape:hexagon,xl icon:server,badge [backend, gateway]
component db "PostgreSQL" shape:database,lg icon:postgresql,badge [storage]
# pools and replicas
component workers "Workers" shape:hexagon,many
component replicas "Read Replicas" shape:database,lg,many
# tier-only (default shape)
component important "Important" shape:lg
Descriptions
Add a trailing :, |, ], or } and indented markdown for permanent descriptions. Descriptions render beside the node and are not cleared by --clear.
| Marker | Style |
|---|---|
: or | | Guide bar |
] | Bracket |
} | Brace |
# guide bar (: marker)
component api "API Gateway" shape:hexagon,xl:
Handles public HTTP ingress and authentication.
# bracket (] marker)
component policy "Policy" ]
Never trusts tenant-provided ownership metadata.
# brace (} marker)
component worker "Worker" }
- uses tools
- runs in a loop
Key hierarchy
Dots create child components inside a parent. Double dots create related components that render separately but stay visually attached. Examples: Member, Related.
# child components
component app "App"
component app.cpu "CPU"
component app.mem "Memory"
# related (renders separately, visually attached)
component app "App"
component app..logs "App Logs"
app -> app..logs: write logs
Edges
Define connections between components. Edges auto-create undeclared components. Examples: Edges, Arrow styles, Chained edges, Fan-out & Fan-in, Bidirectional edges.
Syntax:
| Arrow | Meaning |
|---|---|
-> | Synchronous call |
--> | Optional or conditional |
..> | Inferred or weak |
~> | Streaming |
->> | Async fire-and-forget |
-->> | Async optional |
..>> | Async weak |
<-> | Bidirectional |
<--> | Bidirectional optional |
<..> | Bidirectional weak |
<~> | Bidirectional streaming |
# labeled edge
api -> db: SELECT users
# chained edges
client -> api -> db
# mixed arrow types
client -> api --> cache ->> queue
# fan-out
api -> [worker-a, worker-b, worker-c]: dispatch job
# fan-in
[service-a, service-b] -> aggregator: results
# bidirectional
client <-> server: WebSocket message
Edge modifiers
Inline modifiers control edge appearance. Example: Edge Icons & Modifiers.
| Modifier | Effect | Example |
|---|---|---|
<icon:name> | Icon on the edge | api -> db <icon:zap>: fast query |
<icon:name #color> | Colored icon | db -> api: rows <icon:check #success> |
edge:dropped | Particle drops at midpoint | api -> upstream: timeout edge:dropped,#error |
edge:#color | Colors the edge | api -> db: degraded edge:#warning |
api -> db <icon:zap>: fast query
db -> api: rows <icon:check #success>
api -> upstream: timeout edge:dropped,#error
api -> db: degraded edge:#warning
Icons and colors
Icons support Lucide, brand, and AWS icon names with optional color and size. Declarations use bare icon:name; inline narration uses <icon:name #color size>.
| Parameter | Values |
|---|---|
| Sizes | xs, sm, md, lg, xl |
| Semantic colors | #success, #error, #warning, #info |
| Palette colors | #red, #blue, #green, #yellow, #purple, #gray, #orange, #pink, #cyan, #primary, #secondary |
| Hex colors | #rgb, #rrggbb, #rrggbbaa |
# in edge labels
api -> db: query <icon:database #info>
api -> client: failed <icon:x #error xl>
# in overlays
# overlay: <icon:clock #warning> Token expires
# in declarations
group aws icon:cloud,#info
component api icon:server,badge
Tags
Visual metadata on components. Tags do not change behavior. Use them for role, ownership, environment, or status. Optionally colored.
Syntax:
component api "API" [backend, gateway]
component payments "Stripe" [external, payments #info]
component legacy "Legacy API" [deprecated #warning]
Text
Canvas-level annotation (titles, labels, legends, callouts). Not topology. Example: Text.
Syntax:
| Parameter | Description | Example |
|---|---|---|
id | Optional identifier | text title "Request Flow" |
"Display Text" | Quoted label | text title "Request Flow" |
shape:shape,modifiers | Shape, stroke, tier, color | text title "Title" shape:rect,solid,xl,#info |
| Markdown body | text: followed by indented lines | See below |
Aliases: t.
Shapes: rect (default), circle, diamond, hex, ellipse. Stroke modifiers: solid, dashed, dotted.
# inline text
text title "Request Flow" shape:rect,solid,xl,#info
text subtitle "One request through the backend"
# with markdown body
text warning "Dotted ellipse" shape:ellipse,dotted,#warning:
Text bodies support **Markdown**.
- headings
- lists
- inline `code`
# inside a group
group annotation-zone shape:rect,dashed,#blue
text:
Group-level annotation.
title
end
State
Set content on a component node. Examples: State, Structured Data, Markdown.
Syntax:
| Form | Description | Example |
|---|---|---|
| Text | Plain text state | api: Processing request |
| Literal | Backtick-wrapped raw string | See below |
| Structured | Curly brace object | api: {status: ok, count: 42} |
| Markdown body | Indented lines after key: | See below |
| Code block | Triple backticks with optional lang | See below |
| Adornment | node:destroyed modifier | session: <icon:trash-2> destroyed node:destroyed |
Common structured data shapes (see Content formats):
| Shape | Structure |
|---|---|
| Headline | {text: "Processing"} |
| Key-value rows | {status: ok, queue_depth: 12} |
| Bullet list | {tasks: ["one", "two"]} |
| Key/value entries | {headers: [[Content-Type, application/json]]} |
| Metrics | {metrics: [{name: latency, value: 42, unit: ms}]} |
| Table | {users: [{name: alice, role: admin, active: true}]} |
| Error panel | {error: {code: 404, message: "Not found"}} |
| Collapsible section | {cache: {hits: 12, misses: 3}} |
# text state
api: Processing request
# structured data
api: {
status: "ok",
count: 42
}
# markdown body
api:
Handles **requests**.
- validates input
- emits events
# code block with language
api: ```json
{
"status": "ok",
"data": [1, 2, 3]
}
```
Phases
Label sections of the timeline for navigation. Example: Phases.
Syntax:
| Feature | Syntax |
|---|---|
| Phase header | # phase: Authentication |
| Description | Comment lines immediately after the phase |
# phase: Authentication
# Validates credentials and issues a token.
client -> auth: POST /login
Groups
Draw visual boundaries around components and canvas text. Examples: Groups, Nested Groups.
Syntax:
| Parameter | Description | Example |
|---|---|---|
key | Addressable identifier | group infra |
"Display Name" | Quoted label | group "Backend" |
| Key and name | Both together | group infra "Infrastructure" |
shape:shape,modifiers | Shape, stroke, tier, color | group infra shape:rect,dashed,#blue |
icon:name,color | Icon with optional color | group infra icon:cloud,#info |
Aliases: g, box, b.
Shapes: rect (default), circle, diamond, hex, ellipse. Inside group bodies, the component keyword is optional.
# named group with members
group "Backend"
api "API" shape:hexagon
db "Database" shape:database
end
# with icon
group contact-center icon:aws-connect,#info
text:
Owned by support operations.
api
end
# styled, no members yet
group agents shape:solid
Notes
Attach explanation to the next timeline command. Examples: Notes, Numbered notes.
Syntax:
| Modifier | Effect | Example |
|---|---|---|
| (none) | Basic note | # note: Text |
pause | Manual advance required | # note pause: Read this first. |
3s | Auto-dismiss after duration | # note 3s: Stripe responds after fraud checks. |
1 | Explicit action number | # note 1: User makes request |
n | Next auto-number | # note n: Server validates input |
| Combined | Any order | # note pause n 5s: Inspect the retry |
# basic note
# note: Redis avoids a full Postgres round-trip here.
api -> cache: GET session
# timed note
# note 3s: Stripe responds after fraud checks.
api -> payments: charge card
# manual advance
# note pause: Read this before the next step.
api -> db: SELECT users
Overlays
Canvas-level messages for scenario transitions, time skips, or major status changes. Example: Overlays.
Syntax:
| Feature | Syntax |
|---|---|
| Basic | # overlay: 5 hours later |
| With pause | # overlay pause: Database unreachable |
| With icon | # overlay: <icon:clock> 5 hours later |
| With icon and color | # overlay: <icon:alert-triangle #warning> Database unreachable |
| Description | Comment lines immediately after the overlay |
# overlay: <icon:clock> 5 hours later
# overlay pause: <icon:alert-triangle #warning> Database unreachable
Comments
Plain # comments do not render. Special forms # phase:, # note:, and # overlay: create visible timeline content.
# This is a source comment.
# It does not render by itself.
Artifacts
Data objects with identity that travel between components. Declarations are optional; using %key in an edge label creates the artifact automatically. Example: Artifacts.
Syntax:
| Feature | Syntax | Example |
|---|---|---|
| Declaration | artifact key "Name" | artifact jwt "JWT Token" icon:key-round |
| Attach to edge | %key in label | user -> api: GET /profile %jwt |
| Instance | %key#id | %order#123 |
| Set state | %key: { ... } | %jwt: {sub: "user123", exp: 3600} |
| Clear | --clear %key | --clear %jwt |
# declare and use
artifact jwt "JWT Token" icon:key-round
auth -> user: issue %jwt
%jwt: {sub: "user123", exp: 3600}
user -> api: GET /profile %jwt
# instances
%order#123: {status: "paid"}
%order#456: {status: "pending"}
api -> queue: publish %order#123
Playback directives
Clear
Reset component state, artifact state, or everything. Example: Clear.
| Form | Effect |
|---|---|
--clear | Clear all component state |
--clear api, cache | Clear specific components |
--clear %jwt | Clear an artifact |
--clear
--clear api, cache
--clear %jwt
Visibility
Control component visibility. Example: Visibility.
| Form | Effect |
|---|---|
--dim targets | Dim components |
--show targets | Restore full visibility |
--hide targets | Remove from canvas |
--outline targets | Ghost outline |
--dim | Dim all (no targets) |
--show | Show all (no targets) |
--dim cache
--show cache
--hide legacy
--outline future-service
# apply to all
--dim
--show
Timing
Control playback speed and delays. Example: Timing controls.
| Form | Effect |
|---|---|
--wait duration | Insert a delay |
--step duration | Change default step duration |
--step | Reset step to default |
--speed multiplier | Set playback speed |
--speed | Reset speed to default |
--wait 500ms
--wait 2s
--step 750ms
--speed 5
--speed
Autonumber
Add sequential action badges to sends, receives, and state updates. Example: Autonumbering.
| Form | Effect |
|---|---|
--autonumber | Enable from 1 |
--autonumber 10 | Start from 10 |
--autonumber off | Disable |
--autonumber
--autonumber 10
--autonumber off
Detach and attach
Run blocks in the background. Example: Blocks.
| Form | Effect |
|---|---|
--detach @block | Start block in background |
--attach @block | Wait for background block |
--detach @healthcheck
api -> db: query
--attach @healthcheck
Control blocks
Repeat
Loop a set of commands. Example: Repeat & Speed.
| Form | Effect |
|---|---|
repeat n ... end | Loop N times |
*repeat name ... end | Inline detached repeat (runs until attached or timeline ends) |
repeat 3
client -> api: retry
api -> client: 503
end
*repeat heartbeat
monitor -> api: GET /health
end
Parallel
Run commands concurrently. Example: Parallel.
parallel
api -> db: write record
api -> cache: invalidate
api -> logger: audit entry
end
Blocks
Reusable named command groups. Invoked with @name. Example: Blocks.
| Form | Effect |
|---|---|
block name ... end | Define a reusable block |
@name | Invoke a block |
*block name ... end | Inline detached block (starts immediately) |
block healthcheck
api -> db: SELECT 1
db -> api: OK
end
@healthcheck
*block poll
monitor -> api: GET /health
end
Variables
Hold structured state that can be updated and rendered on components. Example: References.
| Form | Effect |
|---|---|
$name: value | Set a variable |
$name.field: value | Set a field |
$name.field++ | Increment |
$name.field-- | Decrement |
component: $name | Render variable as component state |
$state: {
text: "CLOSED",
failures: 0
}
breaker: $state
$state.failures++
$state.text: "OPEN"
breaker: $state
Full examples
For larger diagrams, use the built-in examples from the editor dropdown: