Docs / Writing diagrams

Syntax reference

Every statement Volley understands, on one page. The pages after this one explain each part in depth.

On this page

A Volley diagram is plain text. Each line is one statement, except the lines that belong to a multi-line note or to a payload body. Blank lines are ignored, so use them freely to group related steps. Keywords such as title, note, if and end are not case-sensitive.

Quick reference

StatementFormMore
Titletitle: TextBelow
MessageFrom -> To: textLanes and arrows
Request payloadin: Title on the line after a message, then the bodyRequests and responses
Response payloadout: Title after a message or its in: block, then the bodyRequests and responses
Notenote: text, note A: text, note A, C: text, or note: alone for several linesNotes
Branchesif: label ... else: label ... else ... endBranches
Groupgroup: label ... endGroups
Divider_: text thin, -: text regular, --: text dashed, =: text boldDividers
Delay...: text or ...Delays
Lane orderorder: A, B, COrdering lanes
NumberingautonumberNumbering
Comment// textBelow

Arrows

ArrowMeaning
A -> BA request or call, drawn as a solid line with a filled head.
A --> BA reply, drawn dashed. A dashed arrow is paired with the request it answers.
A => BA bold arrow, for the step that matters most.
A ->> BAn open head, often used for asynchronous messages and events.
A -x BA lost message that never arrives, such as a timeout or a dropped request.
A <-> BBoth ways, such as a WebSocket or a sync.
A <- BDrawn right to left: a message from B to A, written with A first.
A -> AA self message, for work a lane does on its own.

The parts combine. The line can be - (solid), -- (dashed) or = (bold), and each end can have > (filled head), >> (open head) or x (lost). So -->> is a dashed arrow with an open head and <=> is a bold arrow pointing both ways. Write x heads with a space on each side of the arrow.

Title

volley
title: Sign in with a passkey

The title names the diagram. It is shown in the editor's toolbar, at the top of exported images and embeds, and it becomes the name of the diagram when you save it to your account. Use it once, normally on the first line.

Comments

volley
// The retry policy is described in the runbook
Worker -> Queue: Ack

A line that starts with // is ignored. Comments are a good place for notes to other authors that readers do not need. In the editor, Ctrl+/ turns comments on and off for the selected lines.

Inside a fenced code block, // is part of the code and not a comment.

Everything at once

This example uses nearly every statement. Open it in the editor and change things to see how the drawing reacts.

volley
title: Place an order
order: Client, Gateway, Orders, Database
autonumber

_: **Create**
Client -> Gateway: POST /orders
in: Body
```json
{ "sku": "BOOK-1", "quantity": 2 }
```
Gateway ->> Orders: Forward with `X-Request-Id`
Orders -> Orders: Validate
Orders -> Database: INSERT order
Database --> Orders: id 1042
Orders --> Gateway: 201 Created
Gateway --> Client: 201 Created
out: Order
```json
{ "id": 1042, "status": "pending" }
```

note: Notes take **Markdown** and icons {fas-check}

-: **Pay**
if: Payment succeeds
  Orders => Gateway: order.paid
else: Card declined
  Orders -x Gateway: order.failed
end

group: Fulfilment
  Orders -> Database: UPDATE status
end

...: {fas-hourglass-half} A few days later
Client <-> Gateway: WebSocket
Client <- Gateway: push: shipped
Sequence diagram: Place an order
Open this example in the editor

Rules worth knowing

  • The first colon ends the message head. In A -> B: text, everything before the first : is lanes and the arrow, and everything after is text. The text can contain more colons and even arrows.
  • A message needs no text. A -> B on its own draws an unlabeled arrow.
  • Lane names can contain spaces but not commas or colons, and cannot start with // or contain an arrow.
  • A payload or multi-line note runs until the next statement. Any line that reads as a statement, such as a message, a note or end, closes the block. Fence the body if a line inside it would otherwise look like a statement. See Requests and responses.
  • Sections nest. An if or group can sit inside another. Keep it to one level so the diagram stays readable.
  • Errors never blank the diagram. Volley reports each problem with its line and column and keeps drawing everything else. See Troubleshooting.

Suggested

↑↓ moveEnter openEsc close

Keyboard shortcuts

/ or Ctrl+KSearch the docs
↑ ↓Move through search results
EnterOpen the highlighted result
Ctrl+EnterOpen the result in a new tab
[ and ]Previous and next page
g then hDocs home
tBack to the top of the page
?Show these shortcuts
EscClose a dialog

The editor has its own shortcuts. See Keyboard shortcuts.