Sequence Diagrams
Document interactions between different actors or systems over time. Ideal for API documentation and system design.
What is Sequence Diagrams?
Sequence diagrams are UML interaction diagrams that show how objects or systems communicate with each other over time. They display the chronological order of message exchanges between different actors, making them invaluable for documenting API flows, system interactions, and multi-step processes. Each participant is represented by a vertical lifeline, with horizontal arrows showing message exchanges.
Edit and preview
Build a Sequence Diagrams with Mermaid syntax and see changes instantly.
Common Use Cases
API Documentation
Document API endpoints and their interaction flows. Visualize request-response cycles, authentication flows, error handling, and data exchanges between client and server.
Microservices Architecture
Map communication patterns between microservices, message queues, and databases. Essential for understanding distributed system behavior and debugging integration issues.
Authentication & Authorization
Model multi-step authentication processes like OAuth, SAML, or JWT token flows. Show the sequence of redirects, token exchanges, and validation steps.
System Integration
Visualize how different systems interact in complex integration scenarios. Document webhook callbacks, event-driven architectures, and third-party service integrations.
Key Features
Participant Management
Define multiple actors, systems, or services with aliases and activation boxes to show when components are actively processing.
Message Types
Support for synchronous calls, asynchronous messages, return values, and self-calls with different arrow styles for clarity.
Control Structures
Model loops, conditional branches (alt/else), optional blocks, and parallel processing with intuitive syntax.
Notes & Annotations
Add explanatory notes to any point in the sequence to provide context, clarify business logic, or document edge cases.
Best Practices
Focus on One Scenario
Each sequence diagram should represent a single use case or interaction flow. Create separate diagrams for different scenarios rather than combining everything.
Use Meaningful Names
Give participants clear, descriptive names. Use actual service names or role titles rather than generic labels like 'System A' or 'Component 1'.
Show Error Paths
Don't just document the happy path. Include alternative flows for error conditions, timeouts, and exception handling.
Keep Time Top-to-Bottom
Follow the convention that time flows from top to bottom. Earlier interactions should appear higher in the diagram than later ones.
Explore other diagram types
Flowcharts
Visualize processes, workflows, and algorithms with nodes and directional arrows. Perfect for business processes and decision trees.
Class Diagrams
Model object-oriented systems with classes, attributes, and relationships. Essential for software architecture planning.
State Diagrams
Represent state transitions in systems or applications. Great for modeling lifecycle states and workflows.
Gantt Charts
Plan and track project timelines with tasks and dependencies. Perfect for project management and scheduling.
ER Diagrams
Design database schemas with entities and relationships. Ideal for database modeling and documentation.
User Journey
Map user experiences and interactions across touchpoints. Excellent for UX design and customer journey mapping.
Git Graphs
Visualize Git branching strategies and commit histories. Helpful for explaining version control workflows.