What a sequence diagram is
A sequence diagram puts each participant (a person, a browser, a server, a database) in a column. A dashed line runs down from each one: its lifeline. Messages are arrows between lifelines, and time flows from top to bottom. Read it like a comic strip: first this, then that.
The notation
| Element | Drawn as | Means |
|---|---|---|
| Participant | A box at the top | Someone or something taking part |
| Lifeline | A dashed line down from the box | The participant over time |
| Message | A solid arrow | A request or a call |
| Reply | A dashed arrow | An answer coming back |
| Note | A small sticky note | Extra information |
| Alternative | A frame labelled alt and else | Two possible paths |
Example: logging in
The text behind it:
sequenceDiagram
participant B as Browser
participant A as API
participant D as Database
B->>A: POST /login
A->>D: Find user by email
D-->>A: User row
alt Password correct
A-->>B: 200 OK and a token
else Wrong password
A-->>B: 401 Unauthorized
end
Note over A,D: Passwords are stored hashed
How to draw one in five steps
- List the participants from left to right in the order they first act. The one who starts goes on the left.
- Write the happy path first: every message when everything works.
- Add replies as dashed arrows, only where the answer matters.
- Add alternatives with
altandelsefor errors and branches. - Add notes sparingly for facts that are not messages, such as "cached for 5 minutes".
Arrow types in text
A->>B: message solid arrow
A-->>B: reply dashed arrow
A->B: message solid line, open end
A-->B: reply dashed line, open end
Note over A,B: text a note across two lifelines
Note right of A: text a note beside one lifeline
Tips
- Keep to five or six participants. More than that usually means two diagrams.
- Name messages after what they do ("Charge card"), not after code ("processPaymentV2").
- Show only the replies people need to understand the flow.
- For long flows, split by stage: login, browse, checkout.
Drawing sequence diagrams for free
In Chalkline, open Diagram as text → Sequence, type the messages and press Apply. Switch between hand drawn and clean, export to SVG, PDF or PowerPoint, or share a link. If you have the code but not the diagram, see Python code to flowchart. For the other common UML diagram, see UML class diagram examples.