Sequence Diagrams
Visualize interactions between different actors over time
Quick Start
Basic Syntax
sequenceDiagram
participant A as Alice
participant B as Bob
A->>B: Hello!
B-->>A: Hi there!
Live Preview
Loading preview...
Message Types
A->>B: Message
Solid arrow (synchronous call)
A-->>B: Message
Dashed arrow (asynchronous response)
A-)B: Message
Open arrow (fire and forget)
A-x B: Message
Cross arrow (lost message)
A->>+B: Message
Activate participant
A-->>-B: Message
Deactivate participant
Complete Examples
Basic Sequence Diagram
Simple interaction between two participants
Code
sequenceDiagram
participant A as Alice
participant B as Bob
A->>B: Hello Bob, how are you?
B-->>A: Great!
A-)B: See you later!Preview
Loading preview...
Use Case
Perfect for documenting simple API calls or basic user interactions
Complex API Flow
Multiple participants with loops and conditions
Code
sequenceDiagram
participant C as Client
participant S as Server
participant DB as Database
participant Cache as Redis
C->>+S: Login Request
S->>+DB: Validate User
DB-->>-S: User Data
alt User Valid
S->>+Cache: Store Session
Cache-->>-S: Session ID
S-->>C: Login Success
else Invalid User
S-->>C: Login Failed
end
Note over C,S: User is now authenticated
loop Every 30 minutes
S->>Cache: Refresh Session
endPreview
Loading preview...
Use Case
Ideal for complex system interactions with multiple services