A comprehensive collection of Mermaid.js diagram examples for use in GitHub markdown files. Learn how to create beautiful, functional diagrams directly in your documentation.
Mermaid is a JavaScript-based diagramming tool that renders markdown-inspired text definitions to create diagrams dynamically. It's supported natively in GitHub, making it perfect for documentation.
flowchart TD
A[Start] -->|Process| B{Decision}
B -->|Yes| C[Success]
B -->|No| D[Try Again]
D --> B
C --> E[End]
Complete guide to creating flowcharts:
- Node Shapes - All available node shapes and syntax
- Links Between Nodes - Connecting nodes with various arrow styles
- Themes - Color themes and visual styling
- Styling - Custom colors, CSS classes, and advanced styling
- Best Practices - Tips for creating effective diagrams
Visualize interactions between components:
- Sequence Diagram Basics - Complete guide with practical examples
Explore additional diagram types:
- Other Diagrams - Class, state, ERD, Gantt, git graphs, and more
Create a code block with mermaid as the language:
```mermaid
flowchart LR
A[Start] --> B[End]
```Common diagram types:
flowchart- Process flows and decision treessequenceDiagram- Interactions and message passingclassDiagram- Object-oriented structuresstateDiagram-v2- State machineserDiagram- Database schemasgantt- Project timelinespie- Data visualizationgitGraph- Version control flows
Push your markdown file to GitHub and view it in the browser. GitHub automatically renders Mermaid diagrams.
flowchart TD
Client[Client App] --> API[API Gateway]
API --> Auth[Auth Service]
API --> Users[User Service]
API --> Data[Data Service]
Users --> DB[(Database)]
Data --> DB
sequenceDiagram
actor User
participant App
participant Server
User->>App: Enter credentials
App->>Server: Login request
Server-->>App: Auth token
App-->>User: Access granted
stateDiagram-v2
[*] --> Draft
Draft --> Review: Submit
Review --> Approved: Accept
Review --> Draft: Reject
Approved --> [*]
All examples in this repository are tested for GitHub compatibility. Note:
- Most standard features are fully supported
- Some experimental features may not render
- Always test on GitHub before finalizing
- GitHub Ready - All diagrams tested on GitHub
- Comprehensive - Covers all major diagram types
- Practical - Real-world examples and use cases
- Best Practices - Tips for maintainable diagrams
- Well Organized - Easy to navigate and find examples
- Mermaid.js Official Documentation
- Mermaid Live Editor - Test your diagrams
- Markdown Guide
Found an issue or want to add more examples? Contributions are welcome!
This project is for educational purposes. Feel free to use these examples in your own projects.