Skip to content

Sequence Diagrams

Sequence diagrams show interactions between participants over time. They’re perfect for documenting APIs, user flows, and system interactions.

Basic Sequence Diagram

PlantUML Diagram

Authentication Flow

PlantUML Diagram

Async Communication

Error generating PlantUML diagram: Request failed with status code 520

@startuml
participant "Service A" as A
participant "Message Queue" as MQ
participant "Service B" as B

A -> MQ: Publish event
note right: Async message
MQ -> MQ: Store message
MQ --> A: Acknowledged

... 5 minutes later ...

B -> MQ: Poll for messages
MQ --> B: Deliver event
B -> B: Process event
B -> MQ: Acknowledge
@enduml

Error Handling

Error generating PlantUML diagram: Request failed with status code 520

@startuml
participant Client
participant Server
participant Database

Client -> Server: Request data
Server -> Database: Query
Database --> Server: Error: Connection timeout

alt Database error
    Server --> Client: 503 Service Unavailable
    note right: Retry later
else Success
    Server --> Client: 200 OK with data
end
@enduml

Tips for Sequence Diagrams

  1. Use meaningful names: Instead of A, B, use Client, Server
  2. Add notes: Use note left/right to add context
  3. Show timing: Use ... to indicate time passing
  4. Group related interactions: Use group blocks
  5. Handle conditions: Use alt/else for different flows