Language Reference

FractalForm diagrams are plain-text scripts for animated system diagrams.

client -> api: GET /users

Basic request

Loading preview

Edges and state updates create components automatically. Add declarations, stages, notes, overlays, artifacts, playback directives, and control blocks only when the diagram needs them.

Quick Reference

Minimal syntax for each FractalForm construct.

Construct
Minimal form
Details
component api "API"
shape:server,#warning
<icon:check #success>
style:#7c3aed
api -> db: query
api: Ready
api:
  <pairs>
    status: ok
group "Backend"
  component api
end
# stage: Send request
# note: Explain next action
# overlay pause: Five minutes later
api -> user: issue %token
text "Callout"
shape circle "Label"
tree "Routing" shape:decision
  - Valid?
    ? yes
      - Route
end
--wait 1s
repeat 3
  api -> db
end
parallel
  api -> db
  api -> cache
end
block healthcheck
  api -> db
end
*repeat
  monitor -> api
end
$state.count++
Backend
  - api

Components

Declare topology nodes when you need a label, shape, icon, tier, tags, or hierarchy. Edges and state updates still create undeclared components automatically.

Syntax

component key "Display Name" shape:shape,tier,many,#color icon:name,badge [tags]

Details

ParameterDescriptionExample
keyAddressable identifier.
component api
"Display Name"Quoted label.
component api "API"
shape:shape,tierVisual shape and size tier.
shape:server,lg
Shapesdefault, circle, database, hexagon, diamond, note, actor, icon, cloud, external, browser, server, funnel, code.
shape:cloud
Tiersxl, lg, md, sm, xs. Modifier-only shape tokens use the default shape.
shape:lg
manyRender one logical component as a stacked or repeated visual.
shape:server,many
#colorTheme color token or hex color for visual emphasis.
shape:hexagon,#warning
icon:name,badgeIcon or badge metadata.
icon:server,badge
[tags]Short visual metadata; tags can carry colors.
[backend, public #info]

Examples

Component Declaration

FractalForm script
# Declarations set labels, shapes, icons, and tags.
component api "API" shape:server,lg icon:server,badge [backend]
component db "Database" shape:database icon:database,badge

api -> db: query
Loading preview

Colors

Color modifiers are visual metadata used across components, groups, tags, edges, notes, overlays, artifacts, text, and shapes. Named colors adapt to the active diagram theme; hex colors keep the authored value.

Syntax

#success
#error
#warning
#info
#red #blue #green #yellow #purple #gray #orange #pink #cyan #primary #secondary
#abc #7c3aed #7c3aedff

Details

TokenVisualUse
#successGreenSuccessful, healthy, complete, accepted.
#errorRedFailed, blocked, rejected, unavailable.
#warningAmber or orangeRisk, degraded, retry, needs attention.
#infoBlueNeutral status, context, informational callout.
#primaryTheme accentPrimary emphasis aligned with the active theme.
#secondaryMutedSubtle metadata or secondary visual weight.
#red, #blue, ...Named palette colorNon-semantic grouping.
#abc, #7c3aed, #7c3aedffExact hex colorOne-off brand or diagram-specific accents.

Examples

Semantic Color Tokens

FractalForm script
# Semantic colors carry meaning and follow the active theme.
component api "API" shape:server,#info icon:server,#info [public #info]
component worker "Worker" shape:hexagon,#warning icon:cpu,#warning [retry #warning]
component db "Database" shape:database,#success icon:database,#success [healthy #success]

api -> worker: retry <icon:alert-triangle #warning>
worker -> db state:#success: write <icon:check #success>
worker -> api state:dropped,#error: timeout <icon:x #error>
# note pause #warning: Retry is safe, but it needs attention.
api -> worker: retry again
Loading preview

Edges

Edges define interactions between components. Labels are plain text; rich data belongs in component or artifact state.

Syntax

source -> target: label
source -> middle -> target: label
source -> [target-a, target-b]: label
source -> target state:dropped,#error: label

Details

ArrowMeaning
->Synchronous call
->>Async fire-and-forget
~>Streaming
-->Optional or conditional
-->>Async optional or conditional
..>Inferred or weak
..>>Async inferred or weak
<->Bidirectional
<~>Bidirectional streaming
<-->Bidirectional optional or conditional
<..>Bidirectional inferred or weak

Examples

Basic Edges

FractalForm script
# Plain edges create components if needed.
client -> api: request
api -> db: query
Loading preview

State

State sets visible content on a component. Use plain text for simple status and structured or Markdown state when the component has useful internal detail.

Syntax

component: content
component:
  Markdown body
component:
  <pairs>
    status: ok
component state:destroyed: content
component <state:destroyed>: content

Details

FormDescriptionExample
TextSimple status.
api: Processing
StructuredDecorated state body.
api:
  <pairs>
    status: ok
Markdown bodyIndented Markdown after a state opener.
api:
Timeline stateTransient node treatment.
session state:destroyed: removed

Examples

Component State

FractalForm script
# State updates change what a component displays.
api: Processing request

api:
  <pairs>
    status: ok
    count: 3

api:
  Handles **requests**.
  - validates input
Loading preview

Content Rendering

Indented bodies can render as Markdown or as decorated content. The same body forms work in component state, artifact state, attached or standalone text, and shape bodies. Decorated bodies use a small YAML-like syntax.

Markdown Bodies

A body with plain indented text renders as Markdown. Use this for prose, lists, headings, emphasis, code spans, and inline icons.

WhereStructureBody
Component state
api:
  Handles **requests**.
  - validates input
Markdown rendered in the component body.
Artifact state
%token:
  Signed **JWT**.
  - expires in 15m
Markdown rendered on the artifact.
Standalone text
text:
  Release **notes**.
  - watch latency
Markdown rendered as free canvas text.
Attached text
text @api |
  Handles **requests**.
  - validates input
Markdown rendered beside the target.
Shape body
shape decision diamond:
  Policy **check**.
  - allow
  - deny
Markdown rendered inside the shape.

Decorator Bodies

A body whose first content line is a decorator uses that decorator to choose the rendered shape. Decorators can be combined in the same body.

DecoratorStructureBody
<text>
api:
  <text> Ready
Plain text content.
<pairs>
api: Ready
  <pairs>
    status: ok
    count: 3
    latency: [42, ms]
Mapping rendered as labeled rows.
<list>
api: Checks
  <list>
    - auth
    - quota
Sequence rendered as bullets.
<list:ordered>
api: Steps
  <list:ordered>
    - authorize
    - capture
Sequence rendered as numbered steps.
<group:panel>
api: Details
  <group:panel> metadata
    <pairs>
      region: us-east-1
Panel groups contain decorated blocks in a collapsible section.
<table>
api: Services
  <table>
    - service: auth
      status: ok
    - service: payment
      status: <icon:check>
Sequence of mappings rendered as table rows.
<error>
api: Failed
  <error>
    code: 503
    message: Unavailable
Mapping rendered with error styling.
<group>
api: Cache
  <group> stats
    <pairs>
      hits: 12
      misses: 3
A group contains other decorated content blocks.
<markdown>
api:
  <text> Deployment note
  <markdown>
    Rollout is **healthy**.
    - canary checks passed
Markdown body inside decorated content.
<code:json>
api:
  <code:json>
    {
      "status": "ok"
    }
JSON code body after a state opener.

Examples

Text

The text decorator renders plain component content.

FractalForm script
component api "Text"

api:
  <text> Ready
Loading preview

Groups

Groups draw visual boundaries around related components, text, trees, or nested groups.

Syntax

group key "Display Name" shape:shape,stroke,tier,#color icon:name [tags]
  component key
end
group "Display Name"
  existing-key
end

Details

PartDescriptionExample
keyOptional addressable identifier; quoted-only groups get an internal key.
group backend "Backend"
"Display Name"Visible group label.
group "Infrastructure"
shapeBorder shape: rect, circle, diamond, hex, or ellipse.
shape:ellipse
strokeBorder stroke: solid, dashed, or dotted.
shape:rect,dotted
tierSize tier metadata for the group treatment.
shape:rect,lg
#colorTheme color token for the border.
shape:rect,#warning
icon:nameOptional group icon and color.
icon:cloud,#info

Examples

Group Block

FractalForm script
# Group related components under one boundary.
group backend "Backend"
  component api "API" shape:server
  component db "Database" shape:database
end

api -> db: query
Loading preview

Stages

Stages label sections of the timeline for navigation. Description lines immediately after the stage become stage context.

Syntax

# stage: Title
# Description line

Examples

Stage

FractalForm script
# Stages create timeline navigation sections.
# stage: Title
# Description line

client -> api: POST /orders
api -> db: insert
Loading preview

Notes

Notes attach explanation to the next timeline command. Put the note directly above the state or edge it explains.

Syntax

# note: Text
# note pause: Text
# note n 5s #warning: Text

Details

ModifierEffect
pauseManual advance required.
3sAuto-dismiss after duration.
nNext action number.
#warningAccent color.

Examples

Basic Note

FractalForm script
# Notes explain the next event.
# note: Client sends the request.
client -> api: request
Loading preview

Overlays

Overlays are canvas-level messages for scenario transitions, time skips, or major status changes.

Syntax

# overlay: Text
# overlay pause: Text
# overlay 10s: Text

Details

ModifierEffect
pauseManual advance required.
10sAuto-dismiss after duration.
<icon:name #color>Optional icon and accent.

Examples

Basic Overlay

FractalForm script
# Overlays narrate scene changes.
# overlay: Explain the next scene.
client -> api: start
Loading preview

Artifacts

Artifacts are data objects with identity. They can travel with edges, receive state, and be cleared independently.

Syntax

artifact key "Name" icon:name
source -> target: label %artifact
%artifact:
  Markdown body
%artifact:
  <pairs>
    status: ok
%artifact#copy

Details

FeatureSyntax
Declareartifact token "Token" icon:key-round
No declarationclient -> api: upload %file
Attach to edgeauth -> user: issue %token
Instance copy%item#copy
Multipleapi -> client: done %order %receipt
Markdown state%token: Token issued
State%token: <pairs> sub: user123
Clear--clear %token

Examples

Declared Artifact

FractalForm script
# Artifacts are data objects with identity.
artifact token "Token" icon:key-round
auth -> user: issue %token

%token:
  <pairs>
    sub: user123
    exp: 15m

user -> api: GET /profile %token
Loading preview

Text

Text creates static canvas annotations. It can stand alone or attach to a component or group with side markers.

Syntax

text "Display Text"
text @target |
  Markdown body
text @target marker:|
  Markdown body
text @target |
  <pairs>
    status: ok
text @target style:rect,#info ->
  Markdown body
// Design note

Details

FormDescriptionExample
StandaloneFree-floating annotation.
text "Request Flow"
AttachedSidecar beside a target.
text @api "Handles ingress"
:Plain markdown body.
text @api:
Decorated bodyBody rendered with a content decorator.
text @api:
  <pairs>
    status: ok
|Guide bar beside the text.
text @api |
]Bracket marker.
text @api ]
}Brace marker.
text @api }
-> / <-Arrow connector direction.
text @api ->
marker:Property form for the same marker options.
text @api marker:|
StyleText container metadata.
style:rect,#info
Design noteCanvas-scoped markdown shorthand.
// Quick note

Examples

Standalone Text

FractalForm script
text "Request Flow"
Loading preview

Shapes

Shapes add primitive canvas geometry independent of topology nodes.

Syntax

shape circle "Label"
shape id rect style:dashed,#color
shape id ellipse @target style:#warning "Label"
shape id diamond:
  Markdown body
shape id diamond:
  <pairs>
    status: ok

Details

PartDescriptionExample
shapeCanvas primitive command.
shape circle
PrimitiveCanvas geometry: rect, circle, diamond, ellipse, hex, or line.
shape circle
idOptional stable identifier; omitted shapes get generated ids.
shape boundary rect
@targetOptional attachment target for relative placement.
shape halo circle @api
style modifiersStroke, direction, size, and color metadata.
style:dashed,#info
Label/bodyQuoted inline label or indented body after a colon.
shape gate diamond "Policy"
Decorated bodyShape body rendered with a content decorator.
shape gate diamond:
  <pairs>
    status: ok

Examples

Circle Shape

FractalForm script
shape circle "Label"
Loading preview

Trees

Trees add supporting canvas detail for decisions, nested ideas, or ordered logic.

Syntax

tree "Title" shape:spine
  - branch
end
tree "Title" shape:spine,arrows
  - step
end
tree "Title" shape:mindmap
  - topic
end
tree "Title" shape:decision
  - State
    ? event
      - Next
end

Details

FormUse ForExample
shape:spineOrdered paths, routes, steps, or escalation logic.
tree "Routing" shape:spine
arrowsDraw directional connectors between tree items.
shape:spine,arrows
shape:mindmapRelated capabilities, concerns, or design areas.
tree "Platform" shape:mindmap
shape:decisionNamed choices, state machines, or policy transitions.
tree "Breaker" shape:decision
- labelA branch.
- auth check
? labelA decision/event branch in decision trees.
? failure
-> id "Label"Reference another tree node.
-> closed "Closed"

Examples

Routing Detail

FractalForm script
# Spine trees show ordered supporting detail.
tree "Routing" shape:spine
  - incoming request
  - auth check
end
Loading preview

Playback Directives

Playback directives control visibility, clearing, timing, and numbering. Visibility directives apply from their position in the timeline forward.

Syntax

--dim target
--show target
--hide target
--outline target
--clear target
--wait 1s
--travel 1s
--dwell 1s
--gap 200ms
--speed 5
--autonumber

Details

DirectiveEffect
--dimDim components.
--showRestore hidden, dimmed, or outlined components.
--hideRemove components from the canvas.
--outlineShow a ghost outline.
--clearClear state or artifacts.
--waitInsert a delay.
--travelSet edge particle travel duration.
--dwellSet readable dwell for state and artifacts.
--gapSet rest after each event.
--speedSet or reset playback speed.
--autonumberAdd action badges.

Examples

Dim

FractalForm script
component api "API" shape:server
api: ready
--dim api
Loading preview

Control Blocks

Control blocks group commands for reuse, repetition, concurrency, and detached background work.

Syntax

repeat 3
  ...
end
parallel
  ...
end
block name
  ...
end
@name
*repeat name
  ...
end
--detach @name
--attach @name

Details

BlockEffect
repeatLoop a command sequence.
parallelRun commands concurrently.
blockDefine a reusable command group.
@nameInvoke a block.
*block / *repeatStart a detached block or repeating background lane.
--detach / --attachRun a block in the background or wait for it.
* @name / ^nameShorthand detach and attach forms.

Examples

Repeat

FractalForm script
# Repeat loops the body.
repeat 3
  client -> api: poll
end
Loading preview

Variables

Variables are illustration helpers for diagrams that need a value to change over time. Use them for small counters, statuses, or repeated values that make a concept easier to follow; they are not a general-purpose programming model.

Syntax

$name: value
$name:
  Markdown body
$name:
  <pairs>
    status: ok
$name.field: value
$name.field++
$name.field--
component:
  <pairs>
    field: $name.field

Details

FormEffect
$breaker: valueSet a variable.
$breaker.field: valueSet a field.
$breaker.field++Increment a field.
$breaker.field--Decrement a field.
$count++ / $count--Increment or decrement a scalar variable.
$summary: <pairs> status: okSet a variable with a decorated body.
component: <pairs> field: $breaker.fieldRender a variable read in a decorated body.

Examples

Declare Variable

FractalForm script
# Variables help illustrate values that change over time.
$breaker: {
  status: closed,
  failures: 0
}
Loading preview

Quick Notation

Quick Notation is a one-way authoring shorthand in the editor. It expands into a FractalForm script before runtime parsing.

Syntax

Group
  - member
[,browser] Web
[globe,browser] Web
A>B: call
== Stage
## n. Note
### Overlay 10s..
/ @api -> note

Details

Quick FormConverts To
Labelgroup "Label"
- apicomponent api
[,browser] Webcomponent web "Web" shape:browser
[globe,browser] Webcomponent web "Web" shape:browser icon:globe
(postgresql) DBcomponent db "DB" shape:database icon:postgresql
A>B: callA -> B: call
== Stage# stage: Stage
## n. Note# note n: Note
### Overlay 10s..# overlay 10s: Overlay
/ @api -> notetext @api ->

Examples

Outline

Quick input
Backend
  - api
  - worker
  (postgresql) DB
Generated script
group "Backend"
  component api
  component worker
  component db "DB" shape:database icon:postgresql
end
Loading preview