Mermaid Diagram

Sequence Diagrams

Show interactions between actors and participants over time

Sequence Diagrams

Sequence diagrams show interactions between participants over time.

Basic Sequence

sequenceDiagram
    participant Alice
    participant Bob
    Alice->>John: Hello John, how are you?
    John-->>Alice: Great!
    Alice->>Bob: Check with you, John said he's great
    Bob-->>Alice: I agree

With Loops and Alternatives

sequenceDiagram
    autonumber
    participant Client
    participant Server
    participant Database

    Client->>Server: GET /api/users
    activate Server
    Server->>Database: SELECT * FROM users
    activate Database
    Database-->>Server: user records
    deactivate Database

    alt Success
        Server-->>Client: 200 OK + JSON
    else Error
        Server-->>Client: 500 Internal Error
    end

    loop Retry
        Client->>Server: Retry request
        Server-->>Client: Response
    end

    deactivate Server

Back to overview.

โ† Back to overview