Mermaid Sequence Diagram with Examples
Copy a Mermaid sequenceDiagram and edit it in the browser. The examples below cover participants, solid and dashed messages, activation, loops, and alt fragments.
Define who or what is involved in the interaction. Use `participant` for objects/services and `actor` for human representations.
sequenceDiagram
actor User
participant Browser
participant Server
participant DatabaseLive Editor
Frequently asked questions
What is a Mermaid sequenceDiagram?
A sequenceDiagram is a Mermaid diagram of messages between participants in time order. The first line is the keyword sequenceDiagram. Each later line is a participant or a message such as User->>Server: Request.
How do I write a Mermaid sequence diagram?
Start with sequenceDiagram, declare participants, then write messages. ->> is a solid call and -->> is a dashed reply. Wrap repeated calls in loop and branches in alt/else/end. The examples on this page are editable.
What is the difference between ->> and -->> ?
->> draws a solid arrow, usually the request. -->> draws a dashed arrow, usually the response. The labels after the colon are the message text, such as Request or JWT token.
How do loops and alt fragments work?
loop repeats the messages inside it until end. alt / else splits a choice, such as Has updates versus No updates, and also closes with end. opt is the optional form and par runs branches together.
More Tutorials
All tutorialsFlowchart Syntax Guide — Nodes, Arrows & Subgraphs
Master Mermaid flowchart syntax with this interactive guide. Learn node shapes, connections, and advanced features.
Mermaid Gantt Chart Examples to Copy
Copy a Mermaid Gantt chart and change the dates. These examples cover task ids, after dependencies, done and critical states, milestones, and excludes weekends.
ER Diagram Tutorial — Entities, Keys & Relationships
Design database schemas visually with Mermaid ER diagrams. Learn entity declarations, attribute types, relationships, and cardinality notation.
Getting Started — Your First Mermaid Diagram in 2 Minutes
New to Mermaid? Start here. Learn the fundamentals and create your first diagram in minutes.