Flowchart

Decision trees, process flows, and directed graphs

Top to bottom

Default vertical layout with TD direction

Mermaid
Try it →
graph TD
    A[Start] --> B{Decision}
    B -->|Yes| C[Process]
    B -->|No| D[End]
    C --> D
┌────────────┐
│            │
│   Start    │
│            │
└──────┬─────┘
       │
       │
       ▼
┌──────◇─────┐
│            │
│  Decision  │
│            │
└──────◇─────┘
       │
       │
       ├─────────────────╮No
    Yes│                 │
       ▼                 ▼
┌────────────┐    ┌────────────┐
│            │    │            │
│  Process   ├───►│    End     │
│            │    │            │
└────────────┘    └────────────┘

Left to right

Horizontal layout using LR direction

Mermaid
Try it →
graph LR
    A[Start] --> B{Decision}
    B -->|Yes| C[Process]
    B -->|No| D[End]
    C --> D
┌─────────┐    ┌──────◇─────┐    ┌───────────┐
│         │    │            │Yes │           │
│  Start  ├───►│  Decision  ├──┬►│  Process  │
│         │    │            │  │ │           │
└─────────┘    └──────◇─────┘  │ └─────┬─────┘
                               │       │
                               │No     │
                               │       ▼
                               │ ┌───────────┐
                               │ │           │
                               ╰►│    End    │
                                 │           │
                                 └───────────┘

Node shapes

Rectangle, rounded, diamond, stadium, and circle shapes

Mermaid
Try it →
graph LR
    A[Rectangle] --> B(Rounded)
    B --> C{Diamond}
    C --> D([Stadium])
    D --> E((Circle))
┌─────────────┐    ╭───────────╮    ┌─────◇─────┐    ╭───────────╮    ╭─────◯────╮
│             │    │           │    │           │    (           )    │          │
│  Rectangle  ├───►│  Rounded  ├───►│  Diamond  ├───►(  Stadium  )───►│  Circle  │
│             │    │           │    │           │    (           )    │          │
└─────────────┘    ╰───────────╯    └─────◇─────┘    ╰───────────╯    ╰─────◯────╯

Edge styles

Solid, dotted, and thick edges with labels

Mermaid
Try it →
graph TD
    A --> B
    A -.-> C
    A ==> D
    B -->|label| C
             ┌─────┐
             │     │
             │  A  │
             │     │
             └──┬──┘
                │
                │
                │
                │
   ╭────────────┴┬━━━━━━━━━╮
   ▼             ▼         ▼
┌─────┐      ┌─────┐    ┌─────┐
│     │label │     │    │     │
│  B  ├─────►│  C  │    │  D  │
│     │      │     │    │     │
└─────┘      └─────┘    └─────┘

Inline edge labels

Drawn with inline_edge_labels=True (--inline-edge-labels), which puts each label on its edge

Mermaid
Try it →
graph LR
    A[Request] -->|validate| B{Valid?}
    B -->|yes| C[Process]
    B -->|no| D[Reject]
    C -->|persist| E[(Store)]
┌───────────┐         ┌─────◇────┐    ┌───────────┐        ╭─────────╮
│           │         │          │    │           │        │╰───────╯│
│  Request  ├validate►│  Valid?  ├yes►│  Process  ├persist►│  Store  │
│           │         │          │  │ │           │        │         │
└───────────┘         └─────◇────┘  │ └───────────┘        ╰─────────╯
                                    │
                                    ├─no
                                    │
                                    │ ┌───────────┐
                                    │ │           │
                                    ╰►│  Reject   │
                                      │           │
                                      └───────────┘

Subgraphs

Nodes grouped into named subgraphs

Mermaid
Try it →
graph TD
    subgraph Frontend
        A[React App] --> B[Router]
    end
    subgraph Backend
        C[API] --> D[Database]
    end
    B --> C

 ┌─────────────────┐
 │ Frontend        │
 │                 │
 │                 │
 │ ┌─────────────┐ │
 │ │             │ │
 │ │  React App  │ │
 │ │             │ │
 │ └──────┬──────┘ │
 │        │        │
 │        │        │
 │        ▼        │
 │ ┌─────────────┐ │
 │ │             │ │
 │ │   Router    │ │
 │ │             │ │
 │ └──────┬──────┘ │
 │        │        │
 └────────┼────────┘
          │
          │
          │
          │
 ┌────────┼────────┐
 │ Backend│        │
 │        │        │
 │        ▼        │
 │ ┌─────────────┐ │
 │ │             │ │
 │ │     API     │ │
 │ │             │ │
 │ └──────┬──────┘ │
 │        │        │
 │        │        │
 │        ▼        │
 │ ┌─────────────┐ │
 │ │             │ │
 │ │  Database   │ │
 │ │             │ │
 │ └─────────────┘ │
 │                 │
 └─────────────────┘

Subgraph links

Edges between subgraphs attach to the group border

Mermaid
Try it →
graph LR
    subgraph Frontend
        A[Web App]
        B[Mobile App]
    end
    subgraph Backend
        C[API]
        D[(Database)]
    end
    Frontend --> Backend
    C --> D

 ┌──────────────────┐      ┌────────────────┐
 │ Frontend         │      │ Backend        │
 │                  │      │                │
 │                  │      │                │
 │ ┌──────────────┐ │      │ ┌────────────┐ │
 │ │              │ │      │ │            │ │
 │ │   Web App    │ ├─────►│ │    API     │ │
 │ │              │ │      │ │            │ │
 │ └──────────────┘ │      │ └──────┬─────┘ │
 │                  │      │        │       │
 │                  │      │        │       │
 │                  │      │        ▼       │
 │ ┌──────────────┐ │      │ ╭────────────╮ │
 │ │              │ │      │ │╰──────────╯│ │
 │ │  Mobile App  │ │      │ │  Database  │ │
 │ │              │ │      │ │            │ │
 │ └──────────────┘ │      │ ╰────────────╯ │
 │                  │      │                │
 └──────────────────┘      └────────────────┘

Subgraph pipeline

Chained subgraph-to-subgraph edges keep stages stacked in order

Mermaid
Try it →
graph TD
    subgraph Ingest
        A[Collector]
    end
    subgraph Process
        B[Parser] --> C[Enricher]
    end
    subgraph Store
        D[(Warehouse)]
    end
    Ingest --> Process
    Process --> Store

 ┌─────────────────┐
 │ Ingest          │
 │                 │
 │                 │
 │ ┌─────────────┐ │
 │ │             │ │
 │ │  Collector  │ │
 │ │             │ │
 │ └─────────────┘ │
 │                 │
 └────────┬────────┘
          │
          │
          │
          ▼
 ┌────────────────────────────────────────┐
 │ Process                                │
 │                                        │
 │                                        │
 │ ┌─────────────┐        ┌─────────────┐ │
 │ │             │        │             │ │
 │ │   Parser    ├───────►│  Enricher   │ │
 │ │             │        │             │ │
 │ └─────────────┘        └─────────────┘ │
 │                                        │
 └────────┬───────────────────────────────┘
          │
          │
          │
          ▼
 ┌─────────────────┐
 │ Store           │
 │                 │
 │                 │
 │ ╭─────────────╮ │
 │ │╰───────────╯│ │
 │ │  Warehouse  │ │
 │ │             │ │
 │ ╰─────────────╯ │
 │                 │
 └─────────────────┘

CI/CD pipeline

Build, test, and a manual approval before deploying to production

Mermaid
Try it →
graph LR
    A[Push] --> B[Build]
    B --> C[Test]
    C --> D{Pass?}
    D -->|Yes| E[Deploy Staging]
    D -->|No| F[Notify]
    E --> G{Approve?}
    G -->|Yes| H[Deploy Prod]
    G -->|No| F
┌────────┐    ┌─────────┐    ┌────────┐    ┌────◇────┐    ┌──────────────────┐    ┌──────◇─────┐    ┌───────────────┐
│        │    │         │    │        │    │         │Yes │                  │    │            │    │               │
│  Push  ├───►│  Build  ├───►│  Test  ├───►│  Pass?  ├──┬►│  Deploy Staging  ├───►│  Approve?  ├───►│  Deploy Prod  │
│        │    │         │    │        │    │         │  │ │                  │    │            │Yes │               │
└────────┘    └─────────┘    └────────┘    └────◇────┘  │ └──────────────────┘    └──────◇─────┘    └───────────────┘
                                                        │                                │
                                                        │No         ╭────────────────────╯
                                                        │         No▼
                                                        │ ┌──────────────────┐
                                                        │ │                  │
                                                        ╰►│      Notify      │
                                                          │                  │
                                                          └──────────────────┘

System architecture

Multi-tier web application with subgraphs

Mermaid
Try it →
graph TD
    subgraph Client
        A[Browser]
    end
    subgraph Server
        B[Load Balancer]
        C[App Server 1]
        D[App Server 2]
    end
    subgraph Data
        E[(PostgreSQL)]
        F[(Redis)]
    end
    A --> B
    B --> C
    B --> D
    C --> E
    D --> E
    C --> F
    D --> F

 ┌─────────────────────┐
 │ Client              │
 │                     │
 │                     │
 │ ┌─────────────────┐ │
 │ │                 │ │
 │ │     Browser     │ │
 │ │                 │ │
 │ └────────┬────────┘ │
 │          │          │
 └──────────┼──────────┘
            │
            │
            │
            │
 ┌──────────┼─────────────────────────────────────┐
 │ Server   │                                     │
 │          │                                     │
 │          ▼                                     │
 │ ┌─────────────────┐                            │
 │ │                 │                            │
 │ │  Load Balancer  │                            │
 │ │                 │                            │
 │ └────────┬────────┘                            │
 │          │                                     │
 │          ├──────────────────────────╮          │
 │          ▼                          ▼          │
 │ ┌─────────────────┐        ┌─────────────────┐ │
 │ │                 │        │                 │ │
 │ │  App Server 1   │        │  App Server 2   │ │
 │ │                 │        │                 │ │
 │ └───────┬┬────────┘        └────────┬┬───────┘ │
 │         ││                          ││         │
 └─────────┼┼──────────────────────────┼┼─────────┘
           ││                          ││
           │╰─────────────────╮        ││
           │                  │        ││
           │                  │        ││
           │                  │        ││
           │         ╭────────┼────────╯│
           │         │        │         │
           │         │        │         │
           │         │        │         │
           │         │        │         │
           │         │        │         │
           │         │        │         │
           │ ╭───────╯        ╰───────╮ │
 ┌─────────┼─┼────────────────────────┼─┼─────────┐
 │ Data    │ │                        │ │         │
 │         │ │                        │ │         │
 │         ▼ ▼                        ▼ ▼         │
 │ ╭─────────────────╮        ╭─────────────────╮ │
 │ │╰───────────────╯│        │╰───────────────╯│ │
 │ │   PostgreSQL    │        │      Redis      │ │
 │ │                 │        │                 │ │
 │ ╰─────────────────╯        ╰─────────────────╯ │
 │                                                │
 └────────────────────────────────────────────────┘

Sequence

Message exchanges between participants over time

Basic messages

Solid and dashed arrows between participants

Mermaid
Try it →
sequenceDiagram
    participant C as Client
    participant S as Server
    participant D as Database
    C->>S: GET /users
    S->>D: SELECT * FROM users
    D-->>S: Results
    S-->>C: 200 JSON
 ┌──────────┐    ┌──────────┐            ┌────────────┐
 │  Client  │    │  Server  │            │  Database  │
 └──────────┘    └──────────┘            └────────────┘
       ┆ GET /users    ┆                        ┆
       ────────────────►                        ┆
       ┆               ┆ SELECT * FROM users    ┆
       ┆               ─────────────────────────►
       ┆               ┆ Results                ┆
       ┆               ◄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
       ┆ 200 JSON      ┆                        ┆
       ◄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄                        ┆
       ┆               ┆                        ┆

Arrow types

Solid, dashed, and cross arrows

Mermaid
Try it →
sequenceDiagram
    A->>B: Solid arrow
    B-->>A: Dashed arrow
    A-xB: Solid cross
    B--xA: Dashed cross
 ┌─────┐           ┌─────┐
 │  A  │           │  B  │
 └─────┘           └─────┘
    ┆ Solid arrow     ┆
    ──────────────────►
    ┆ Dashed arrow    ┆
    ◄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
    ┆ Solid cross     ┆
    ──────────────────x
    ┆ Dashed cross    ┆
    x┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
    ┆                 ┆

Notes

Notes placed to the right of or over participants

Mermaid
Try it →
sequenceDiagram
    participant A as Alice
    participant B as Bob
    A->>B: Hello
    Note right of B: Thinking...
    B-->>A: Hi there!
    Note over A,B: Conversation started
 ┌─────────┐              ┌───────┐
 │  Alice  │              │  Bob  │
 └─────────┘              └───────┘
      ┆ Hello                 ┆
      ────────────────────────►
      ┆                       ┆
      ┆                       ┆ ┌─────────────┐
      ┆                       ┆ │ Thinking... │
      ┆                       ┆ └─────────────┘
      ┆ Hi there!             ┆
      ◄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
      ┆                       ┆
    ┌──────────────────────────┐
    │   Conversation started   │
    └──────────────────────────┘
      ┆                       ┆

Alt and loop frames

Conditional branches and repeated blocks drawn as scope frames

Mermaid
Try it →
sequenceDiagram
    participant U as User
    participant A as App
    participant S as Server
    U->>A: Login
    A->>S: POST /auth
    alt valid credentials
        S-->>A: 200 token
        A-->>U: Welcome
    else invalid
        S-->>A: 401
        A-->>U: Try again
    end
    loop every 5 min
        A->>S: refresh token
        S-->>A: new token
    end
 ┌────────┐       ┌───────┐        ┌──────────┐
 │  User  │       │  App  │        │  Server  │
 └────────┘       └───────┘        └──────────┘
      ┆ Login         ┆                  ┆
      ────────────────►                  ┆
      ┆               ┆ POST /auth       ┆
      ┆               ───────────────────►
      ┆               ┆                  ┆
    ┌──────────────────────────────────────┐
    │[alt] valid credentials               │
    │ ┆               ┆ 200 token        ┆ │
    │ ┆               ◄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄ │
    │ ┆ Welcome       ┆                  ┆ │
    │ ◄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄                  ┆ │
    │ ┆               ┆                  ┆ │
    │┄[invalid]┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄│
    │ ┆               ┆ 401              ┆ │
    │ ┆               ◄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄ │
    │ ┆ Try again     ┆                  ┆ │
    │ ◄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄                  ┆ │
    │ ┆               ┆                  ┆ │
    └──────────────────────────────────────┘
      ┆               ┆                  ┆
      ┆             ┌──────────────────────┐
      ┆             │[loop] every 5 min    │
      ┆             │ ┆ refresh token    ┆ │
      ┆             │ ───────────────────► │
      ┆             │ ┆ new token        ┆ │
      ┆             │ ◄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄ │
      ┆             │ ┆                  ┆ │
      ┆             └──────────────────────┘
      ┆               ┆                  ┆

OAuth 2.0 flow

Authorization code grant with token exchange

Mermaid
Try it →
sequenceDiagram
    participant U as User
    participant C as Client
    participant A as Auth Server
    participant R as Resource
    U->>C: Login
    C->>A: Authorization Request
    A->>U: Login Prompt
    U->>A: Credentials
    A-->>C: Auth Code
    C->>A: Exchange Code
    A-->>C: Access Token
    C->>R: Request + Token
    R-->>C: Protected Data
    C-->>U: Dashboard
 ┌────────┐     ┌──────────┐             ┌───────────────┐ ┌────────────┐
 │  User  │     │  Client  │             │  Auth Server  │ │  Resource  │
 └────────┘     └──────────┘             └───────────────┘ └────────────┘
      ┆ Login         ┆                          ┆                ┆
      ────────────────►                          ┆                ┆
      ┆               ┆ Authorization Request    ┆                ┆
      ┆               ───────────────────────────►                ┆
      ┆ Login Prompt  ┆                          ┆                ┆
      ◄───────────────────────────────────────────                ┆
      ┆ Credentials   ┆                          ┆                ┆
      ───────────────────────────────────────────►                ┆
      ┆               ┆ Auth Code                ┆                ┆
      ┆               ◄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄                ┆
      ┆               ┆ Exchange Code            ┆                ┆
      ┆               ───────────────────────────►                ┆
      ┆               ┆ Access Token             ┆                ┆
      ┆               ◄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄                ┆
      ┆               ┆ Request + Token          ┆                ┆
      ┆               ────────────────────────────────────────────►
      ┆               ┆ Protected Data           ┆                ┆
      ┆               ◄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
      ┆ Dashboard     ┆                          ┆                ┆
      ◄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄                          ┆                ┆
      ┆               ┆                          ┆                ┆

Class

Object-oriented class hierarchies and relationships

Basic class

Class with attributes and methods

Mermaid
Try it →
classDiagram
    class Animal {
        +String name
        +int age
        +makeSound()
    }
    class Dog {
        +fetch()
    }
    class Cat {
        +purr()
    }
    Animal <|-- Dog
    Animal <|-- Cat


            ┌──────────────┐
            │    Animal    │
            ├──────────────┤
            │ +String name │
            │ +int age     │
            ├──────────────┤
            │ +makeSound() │
            └──────────────┘
                  △   △
          ┌───────┘   └───────┐
          │                   │
          │                   │
  ┌──────────────┐    ┌──────────────┐
  │     Dog      │    │     Cat      │
  ├──────────────┤    ├──────────────┤
  │ +fetch()     │    │ +purr()      │
  └──────────────┘    └──────────────┘

Relationship types

Inheritance, composition, aggregation, and association

Mermaid
Try it →
classDiagram
    A <|-- B : Inheritance
    C *-- D : Composition
    E o-- F : Aggregation
    G --> H : Association


  ┌──────────────┐    ┌──────────────┐    ┌──────────────┐    ┌──────────────┐
  │      A       │    │      C       │    │      E       │    │      G       │
  └──────────────┘    └──────────────┘    └──────────────┘    └──────────────┘
          △                   ◆                   ◇                   │
          │ Inheritance       │ Composition       │ Aggregation       │ Association
          │                   │                   │                   │
          │                   │                   │                   ▼
  ┌──────────────┐    ┌──────────────┐    ┌──────────────┐    ┌──────────────┐
  │      B       │    │      D       │    │      F       │    │      H       │
  └──────────────┘    └──────────────┘    └──────────────┘    └──────────────┘

MVC pattern

Model-View-Controller with dependencies

Mermaid
Try it →
classDiagram
    class Model {
        -data: Map
        +getData()
        +setData()
    }
    class View {
        +render()
        +update()
    }
    class Controller {
        +handleInput()
        +validate()
    }
    Controller --> Model
    Controller --> View
    View --> Model


           ┌────────────────┐
           │   Controller   │
           ├────────────────┤
           │ +handleInput() │
           │ +validate()    │
           └────────────────┘
                  │   │
          ┌───────┘   └───────┐
          │                   │
          ▼                   │
  ┌──────────────┐            ▼
  │    Model     │    ┌──────────────┐
  ├──────────────┤    │     View     │
  │ -data: Map   │    ├──────────────┤
  ├──────────────┤◄───│ +render()    │
  │ +getData()   │    │ +update()    │
  │ +setData()   │    └──────────────┘
  └──────────────┘

ER Diagram

Entity-relationship models for databases

Basic relationships

Entities with cardinality markers

Mermaid
Try it →
erDiagram
    CUSTOMER ||--o{ ORDER : places
    ORDER ||--|{ LINE_ITEM : contains
    PRODUCT ||--o{ LINE_ITEM : includes


      ┌──────────────┐    ┌──────────────┐
      │   CUSTOMER   │    │   PRODUCT    │
      └──────────────┘    └──────────────┘
              │1                  │1
          ┌───┘                   └───┐
          │ places                    │ includes
          │0..*                       │0..*
  ┌──────────────┐ 1     1..* ┌──────────────┐
  │    ORDER     │────────────│  LINE_ITEM   │
  └──────────────┘ contains   └──────────────┘

All cardinality types

Exactly one, zero or more, one or more, zero or one

Mermaid
Try it →
erDiagram
    A ||--|| B : "one to one"
    C ||--o{ D : "one to many"
    E }|--|{ F : "many to many"
    G |o--o| H : "zero-or-one"


  ┌──────────────┐    ┌──────────────┐    ┌──────────────┐    ┌──────────────┐
  │      A       │    │      C       │    │      E       │    │      G       │
  └──────────────┘    └──────────────┘    └──────────────┘    └──────────────┘
          │1                  │1                  │1..*               │0..1
          │ one to one        │ one to many       │ many to many      │ zero-or-one
          │                   │                   │                   │
          │1                  │0..*               │1..*               │0..1
  ┌──────────────┐    ┌──────────────┐    ┌──────────────┐    ┌──────────────┐
  │      B       │    │      D       │    │      F       │    │      H       │
  └──────────────┘    └──────────────┘    └──────────────┘    └──────────────┘

E-commerce schema

Users, orders, products, and reviews

Mermaid
Try it →
erDiagram
    USER ||--o{ ORDER : places
    USER ||--o{ REVIEW : writes
    ORDER ||--|{ ORDER_ITEM : contains
    PRODUCT ||--o{ ORDER_ITEM : includes
    PRODUCT ||--o{ REVIEW : receives


            ┌──────────────┐    ┌──────────────┐
            │     USER     │    │   PRODUCT    │
            └──────────────┘    └──────────────┘
                  │1  │1              │1  │1
          ┌─places┘   └────┐          └─includes──┐
          │                │ writes       │       │
          │                │     ┌────────┘       │
          │                │     │ receives       │
          │0..*            │0..* │0..*            │0..*
  ┌──────────────┐ 1  ┌──────────────┐..* ┌──────────────┐
  │    ORDER     │────┼────REVIEW────┼────│  ORDER_ITEM  │
  └──────────────┘    └──────────────┘    └──────────────┘

State Diagram

State machines with transitions and conditions

Basic

State machine with transitions and labels

Mermaid
Try it →
stateDiagram-v2
    [*] --> Idle
    Idle --> Processing : submit
    Processing --> Done : success
    Processing --> Error : failure
    Error --> Idle : retry
    Done --> [*]
╭───────◯──────╮
│              │
│      ●       │
│              │
╰───────◯──────╯
        │
        │
        ▼
╭──────────────╮
│              │          retry
│     Idle     │◄─────────────────────────╮
│              │                          │
╰───────┬──────╯                          │
        │                                 │
  submit│                                 │
        ▼                                 │
╭──────────────╮                          │
│              │                          │
│  Processing  │                          │
│              │                          │
╰───────┬──────╯                          │
        │                                 │
        │                                 │
        ├───────────────────────╮         │
        │                       │         │
        │                       │failure  │
 success│                       │         │
        │                       │         │
        ▼                       ▼         │
╭──────────────╮        ╭──────────────╮  │
│              │        │              │  │
│     Done     │        │    Error     ├──╯
│              │        │              │
╰───────┬──────╯        ╰──────────────╯
        │
        │
        ▼
╭───────◯──────╮
│              │
│      ◉       │
│              │
╰───────◯──────╯

HTTP connection lifecycle

Connection states from open to close

Mermaid
Try it →
stateDiagram-v2
    [*] --> Closed
    Closed --> Connecting : connect()
    Connecting --> Open : connected
    Connecting --> Closed : timeout
    Open --> Closing : close()
    Open --> Open : send/receive
    Closing --> Closed : done
    Closed --> [*]
╭───────◯──────╮
│              │
│      ●       │
│              │
╰───────◯──────╯
        │
        │
        ▼
╭──────────────╮           done
│              │◄───────────────────────────╮
│    Closed    │                            │
│              │◄────╮                      │
╰───────┬──────╯     │                      │
        │connect()   │                      │
        ├────────────┼────────────╮         │
        ▼            │timeout     ▼         │
╭──────────────╮     │    ╭───────◯──────╮  │
│              │     │    │              │  │
│  Connecting  ├─────╯    │      ◉       │  │
│              │          │              │  │
╰─────┬────────╯          ╰───────◯──────╯  │
      │                                     │
      │connected                            │
      │ ╭────────────╮                      │
      │ │            │                      │
      ▼ │            │send/receive          │
╭───────┴──────╮     │                      │
│              │     │                      │
│     Open     │◄────╯                      │
│              │                            │
╰───────┬──────╯                            │
        │                                   │
        │                                   │
        │                                   │
 close()│                                   │
        ▼                                   │
╭──────────────╮                            │
│              │                            │
│   Closing    ├────────────────────────────╯
│              │
╰──────────────╯

Composite state

Nested states inside a parent state with outer transitions

Mermaid
Try it →
stateDiagram-v2
    [*] --> Off
    Off --> On : power
    state On {
        [*] --> Idle
        Idle --> Playing : play
        Playing --> Paused : pause
        Paused --> Playing : play
    }
    On --> Off : power
   ╭─────◯─────╮
   │           │
   │     ●     │
   │           │
   ╰─────◯─────╯
         │
         │
         ▼
   ╭───────────╮
   │           │
   │    Off    │◄─╮
   │           │  │
   ╰─────┬─────╯  │power
    power▼        │
 ┌────────────────┴────────────────────────────────────────────────────┐
 │ On                                                                  │
 │                                                                     │
 │                                                                     │
 │ ╭─────◯─────╮    ╭───────────╮     ╭───────────╮      ╭───────────╮ │
 │ │           │    │           │play │           │play  │           │ │
 │ │     ●     ├───►│   Idle    ├────►│  Playing  ├◄────►┤  Paused   │ │
 │ │           │    │           │     │           │pause │           │ │
 │ ╰─────◯─────╯    ╰───────────╯     ╰───────────╯      ╰───────────╯ │
 │                                                                     │
 └─────────────────────────────────────────────────────────────────────┘

Choice, fork and join

Pseudo-states for branching and parallel paths

Mermaid
Try it →
stateDiagram-v2
    state check <<choice>>
    state fork_state <<fork>>
    state join_state <<join>>
    [*] --> Validate
    Validate --> check
    check --> Rejected : invalid
    check --> fork_state : valid
    fork_state --> Index
    fork_state --> Notify
    Index --> join_state
    Notify --> join_state
    join_state --> [*]
    Rejected --> [*]
                      ╭───────◯──────╮
                      │              │
                      │      ●       │
                      │              │
                      ╰───────◯──────╯
                              │
                              │
                              ▼
                      ╭──────────────╮
                      │              │
                      │   Validate   │
                      │              │
                      ╰───────┬──────╯
                              │
                              │
                              ▼
                      ┌───────◇──────┐
                      │              │
                      │    check     │
                      │              │
                      └───────◇──────┘
                              │
                              │
   valid╭─────────────────────┴───────────────────────╮
        │                                             │invalid
        ▼                                             ▼
━━━━━━━━━━━━━━━━                              ╭──────────────╮
━━━━━━━━━━━━━━━━                              │              │
━━━━━━━━━━━━━━━━                              │   Rejected   │
━━━━━━━━━━━━━━━━                              │              │
━━━━━━━━┬━━━━━━━                              ╰───────┬──────╯
        │                                             │
        │                                             │
        │                                             │
        │                                             │
        ├─────────────────────╮                       │
        ▼                     ▼                       ▼
╭──────────────╮      ╭──────────────╮        ╭───────◯──────╮
│              │      │              │        │              │
│    Index     │      │    Notify    │        │      ◉       │
│              │      │              │        │              │
╰──────┬───────╯      ╰───────┬──────╯        ╰───────◯──────╯
       │                      │
       │ ╭────────────────────╯
       ▼ ▼
━━━━━━━━━━━━━━━━
━━━━━━━━━━━━━━━━
━━━━━━━━━━━━━━━━
━━━━━━━━━━━━━━━━
━━━━━━━━┬━━━━━━━
        │
        │
        ▼
╭───────◯──────╮
│              │
│      ◉       │
│              │
╰───────◯──────╯

Gantt

Project schedules with tasks, sections, and dependencies

Basic

Project timeline with sections

Mermaid
Try it →
gantt
    title Sprint 1
    dateFormat YYYY-MM-DD
    section Backend
        API design     :a1, 2024-01-01, 7d
        Implementation :a2, after a1, 14d
    section Frontend
        Mockups        :b1, 2024-01-01, 5d
        Build UI       :b2, after b1, 10d
                                            Sprint 1

 Backend          │
   API design     │████████████████████
   Implementation │                    ████████████████████████████████████████
 Frontend         │
   Mockups        │██████████████
   Build UI       │              ████████████████████████████
                  └┬────────┬─────────┬─────────┬─────────┬─────────┬─────────┬
                Jan 01   Jan 04    Jan 08    Jan 11    Jan 15    Jan 18    Jan 22

Task status tags

Tasks marked as done, active, or critical using tag keywords

Mermaid
Try it →
gantt
    title Release Plan
    dateFormat YYYY-MM-DD
    section Design
        Wireframes     :done, des1, 2024-01-01, 2024-01-14
        Prototypes     :active, des2, 2024-01-08, 2024-01-21
    section Development
        Frontend       :dev1, after des2, 30d
        Backend        :crit, dev2, 2024-01-15, 2024-03-01
    section Testing
        QA             :test1, after dev1, 14d
                                          Release Plan

 Design          │
   Wireframes    │░░░░░░░░░░░░
   Prototypes    │      ▓▓▓▓▓▓▓▓▓▓▓▓▓
 Development     │
   Frontend      │                   ████████████████████████████
   Backend       │             ████████████████████████████████████████████
 Testing         │
   QA            │                                               ██████████████
                 └┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬
               Jan 01    Jan 11    Jan 22    Feb 02    Feb 12    Feb 23    Mar 05

Milestones

Diamond markers for key dates using the milestone keyword

Mermaid
Try it →
gantt
    title Launch Timeline
    dateFormat YYYY-MM-DD
    section Planning
        Requirements   :a1, 2024-01-01, 10d
        Kickoff        :milestone, m1, 2024-01-11, 0d
    section Build
        Development    :a2, after m1, 30d
        Code freeze    :milestone, m2, after a2, 0d
    section Release
        QA             :a3, after m2, 14d
        Launch         :milestone, m3, after a3, 0d
                                        Launch Timeline

 Planning       │
   Requirements │███████████
   Kickoff      │           ◆
 Build          │
   Development  │           ██████████████████████████████████
   Code freeze  │                                             ◆
 Release        │
   QA           │                                             █████████████████
   Launch       │                                                              ◆
                └┬─────────┬─────────┬─────────┬─────────┬─────────┬──────────┬
              Jan 01    Jan 10    Jan 19    Jan 28    Feb 06    Feb 15     Feb 24

Custom date format

The dateFormat directive reads dates that are not in ISO format

Mermaid
Try it →
gantt
    title Sprint 42
    dateFormat DD-MM-YYYY
    section Backend
        Schema        :done, s1, 01-09-2026, 3d
        Endpoints     :active, s2, after s1, 5d
    section Frontend
        Components    :s3, 03-09-2026, 4d
        Integration   :crit, s4, after s2, 3d
    section Release
        Ship          :milestone, m1, after s4, 0d
                                          Sprint 42

 Backend       │
   Schema      │░░░░░░░░░░░░░░░░░
   Endpoints   │                 ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
 Frontend      │
   Components  │           ███████████████████████
   Integration │                                             ██████████████████
 Release       │
   Ship        │                                                               ◆
               └┬─────────┬─────────┬──────────┬─────────┬─────────┬──────────┬
             Sep 01    Sep 02    Sep 04     Sep 06    Sep 08    Sep 10     Sep 12

Pie Chart

Proportional data as labeled slices

Basic

Proportional slices with labels and percentages

Mermaid
Try it →
pie title Languages
    "Python" : 40
    "JavaScript" : 30
    "Go" : 20
    "Rust" : 10


                          Languages

             ████████████████░░░░░░░░░░░░▒▒▒▒▒▒▒▒▚▚▚▚
                   40%           30%       20%   10%


      Python┃████████████████  40.0%
  JavaScript┃░░░░░░░░░░░░  30.0%
          Go┃▒▒▒▒▒▒▒▒  20.0%
        Rust┃▚▚▚▚  10.0%

Budget breakdown

A team's budget split by area

Mermaid
Try it →
pie title Q4 Budget
    "Engineering" : 45
    "Marketing" : 25
    "Operations" : 15
    "Support" : 10
    "Other" : 5


                          Q4 Budget

              ██████████████████░░░░░░░░░░▒▒▒▒▒▒▚▚▚▚▞▞
                     45%           25%     15%  10%


  Engineering┃██████████████████  45.0%
    Marketing┃░░░░░░░░░░  25.0%
   Operations┃▒▒▒▒▒▒  15.0%
      Support┃▚▚▚▚  10.0%
        Other┃▞▞   5.0%

XY Chart

Bar charts, line charts, and combinations

Bar chart

Vertical bars with axis labels

Mermaid
Try it →
xychart-beta
    title "Quarterly Sales"
    x-axis [Q1, Q2, Q3, Q4]
    y-axis "Revenue (k)" 0 --> 120
    bar [45, 78, 62, 105]
           Quarterly Sales
 Revenue (k)
    120 │
        │
        │                  ████
     96 │                  ████
        │                  ████
        │      ▄▄▄▄        ████
     72 │      ████        ████
        │      ████  ▄▄▄▄  ████
        │      ████  ████  ████
     48 │▄▄▄▄  ████  ████  ████
        │████  ████  ████  ████
        │████  ████  ████  ████
     24 │████  ████  ████  ████
        │████  ████  ████  ████
        │████  ████  ████  ████
      0 └──┬─────┬─────┬─────┬─
          Q1    Q2    Q3    Q4

Line chart

Trend line connecting data points

Mermaid
Try it →
xychart-beta
    title "Temperature"
    x-axis [Mon, Tue, Wed, Thu, Fri]
    y-axis "Celsius" 0 --> 40
    line [18, 22, 25, 21, 19]
                Temperature
 Celsius
     40 │
        │
        │
     32 │
        │
        │
     24 │           ╭─────╮
        │     ╭─────╯     │
        │     │           ╰─────────
     16 │  ───╯
        │
        │
      8 │
        │
        │
      0 └──┬─────┬─────┬─────┬─────┬─
          Mon   Tue   Wed   Thu   Fri

Bar + line combo

Bars and line overlaid on the same axes

Mermaid
Try it →
xychart-beta
    title "Monthly Revenue"
    x-axis [Jan, Feb, Mar, Apr, May, Jun]
    y-axis "Revenue (k)" 0 --> 100
    bar [30, 45, 62, 55, 78, 91]
    line [30, 45, 62, 55, 78, 91]
                 Monthly Revenue
 Revenue (k)
    100 │
        │                              ▄▄▄▄
        │                             ╭───█
     80 │                        ▄▄▄▄ │████
        │                       ╭─────╯████
        │            ▄▄▄▄       │████  ████
     60 │           ╭─────╮     │████  ████
        │           │████ ╰─────╯████  ████
        │      ▄▄▄▄ │████  ████  ████  ████
     40 │     ╭─────╯████  ████  ████  ████
        │▄▄▄▄ │████  ████  ████  ████  ████
        │██───╯████  ████  ████  ████  ████
     20 │████  ████  ████  ████  ████  ████
        │████  ████  ████  ████  ████  ████
        │████  ████  ████  ████  ████  ████
      0 └──┬─────┬─────┬─────┬─────┬─────┬─
          Jan   Feb   Mar   Apr   May   Jun

Horizontal

Horizontal orientation using the horizontal keyword

Mermaid
Try it →
xychart-beta horizontal
    title "Team Size"
    x-axis [Backend, Frontend, DevOps, QA]
    y-axis 0 --> 15
    bar [12, 8, 5, 6]
                              Team Size

  Backend │████████████████████████████████████████
          │
 Frontend │██████████████████████████
          │
   DevOps │████████████████
          │
       QA │████████████████████
          └┬────────┬─────────┬─────────┬─────────┬─────────┬
           0        3         6         9        12        15

Quadrant Chart

2x2 grids with plotted data points

Basic

2x2 grid with labeled quadrants and data points

Mermaid
Try it →
quadrantChart
    title Tech Evaluation
    x-axis Low Effort --> High Effort
    y-axis Low Impact --> High Impact
    quadrant-1 Do First
    quadrant-2 Plan
    quadrant-3 Delegate
    quadrant-4 Eliminate
    Cache: [0.3, 0.85]
    Auth: [0.8, 0.75]
    Typos: [0.15, 0.15]
    Migrate DB: [0.75, 0.25]
                       Tech Evaluation

                                │
                                │
                   ● Cache      │
                                │
                                │                ● Auth
               Plan             │          Do First
                                │
                                │
                                │
                                │
  ──────────────────────────────┼─────────────────────────────
                                │
                                │
                                │
                                │             ● Migrate DB
             Delegate           │          Eliminate
          ● Typos               │
                                │
                                │
                                │

                   Low Effort -> High Effort

Product portfolio

Growth-share matrix with five plotted products

Mermaid
Try it →
quadrantChart
    title Product Portfolio
    x-axis Low Market Share --> High Market Share
    y-axis Low Growth --> High Growth
    quadrant-1 Stars
    quadrant-2 Question Marks
    quadrant-3 Dogs
    quadrant-4 Cash Cows
    Analytics: [0.78, 0.82]
    Mobile App: [0.35, 0.9]
    Legacy CRM: [0.2, 0.15]
    Billing: [0.85, 0.25]
    Chat: [0.5, 0.6]
                      Product Portfolio

                                │
                      ● Mobile App
                                │
                                │               ● Analytics
                                │
          Question Marks        │            Stars
                                │
                               ● Chat
                                │
                                │
  ──────────────────────────────┼─────────────────────────────
                                │
                                │
                                │
                                │                   ● Billing
               Dogs             │          Cash Cows
             ● Legacy CRM       │
                                │
                                │
                                │

             Low Market Share -> High Market Share

Architecture

Service groups with directional connections

Service group

Services inside a named group with directional edges

Mermaid
Try it →
architecture-beta
    group cloud(cloud)[Cloud]
    service web(server)[Web Server] in cloud
    service api(server)[API Server] in cloud
    service db(database)[Database] in cloud
    web:R --> L:api
    api:R --> L:db

 ┌─────────────────────────────────────────────────────────────────┐
 │ Cloud                                                           │
 │                                                                 │
 │                                                                 │
 │ ┌─────────────────┐    ┌─────────────────┐    ┌───────────────┐ │
 │ │                 │    │                 │    │               │ │
 │ │  🖥 Web Server   ├───►│  🖥 API Server   ├───►│  🗄 Database   │ │
 │ │                 │    │                 │    │               │ │
 │ └─────────────────┘    └─────────────────┘    └───────────────┘ │
 │                                                                 │
 └─────────────────────────────────────────────────────────────────┘

Nested groups

Groups inside groups with external services connecting in

Mermaid
Try it →
architecture-beta
    group infra(cloud)[Infrastructure]
    group backend(server)[Backend] in infra
    service api(server)[API] in backend
    service db(database)[Database] in backend
    service cdn(internet)[CDN]
    service client(internet)[Client]
    client:R --> L:cdn
    cdn:R --> L:api
    api:B --> T:db

                                     ┌───────────────────────┐
                                     │ Infrastructure        │
                                     │                       │
                                     │                       │
                                     │ ┌───────────────────┐ │
                                     │ │ Backend           │ │
                                     │ │                   │ │
                                     │ │                   │ │
┌─────────────┐    ┌──────────┐      │ │ ┌───────────────┐ │ │
│             │    │          │      │ │ │               │ │ │
│  🌐 Client  ├───►│  🌐 CDN  ├──────┼─┼►│    🖥 API      │ │ │
│             │    │          │      │ │ │               │ │ │
└─────────────┘    └──────────┘      │ │ └───────┬───────┘ │ │
                                     │ │         │         │ │
                                     │ │         │         │ │
                                     │ │         ▼         │ │
                                     │ │ ┌───────────────┐ │ │
                                     │ │ │               │ │ │
                                     │ │ │  🗄 Database   │ │ │
                                     │ │ │               │ │ │
                                     │ │ └───────────────┘ │ │
                                     │ │                   │ │
                                     │ └───────────────────┘ │
                                     │                       │
                                     └───────────────────────┘

Block

Grid-based block layouts

Basic grid

Columns keyword controls the number of items per row

Mermaid
Try it →
block-beta
    columns 3
    A["Frontend"] B["API Gateway"] C["Backend"]
    D["React"] E["Auth"] F["Database"]


  ┌──────────┐    ┌─────────────┐    ┌──────────┐
  │          │    │             │    │          │
  │ Frontend │    │ API Gateway │    │ Backend  │
  │          │    │             │    │          │
  └──────────┘    └─────────────┘    └──────────┘


  ┌──────────┐    ┌─────────────┐    ┌──────────┐
  │          │    │             │    │          │
  │  React   │    │    Auth     │    │ Database │
  │          │    │             │    │          │
  └──────────┘    └─────────────┘    └──────────┘

Nested groups

Blocks inside named groups with edges between the groups

Mermaid
Try it →
block-beta
    columns 3
    block:frontend:1
        columns 1
        web["Web"]
        mobile["Mobile"]
    end
    gateway["API Gateway"]
    block:backend:1
        columns 1
        auth["Auth"]
        orders["Orders"]
    end
    frontend --> gateway
    gateway --> backend


  ┌────────────────┐    ┌─────────────┐    ┌────────────────┐
  │    frontend    │    │             │    │    backend     │
  │                │    │             │    │                │
  │                │    │             │    │                │
  │  ┌──────────┐  │    │             │    │  ┌──────────┐  │
  │  │          │  │    │             │    │  │          │  │
  │  │   Web    │  │    │             │    │  │   Auth   │  │
  │  │          │  │    │             │    │  │          │  │
  │  └──────────┘  │    │             │    │  └──────────┘  │
  │                │───►│ API Gateway │───►│                │
  │                │    │             │    │                │
  │  ┌──────────┐  │    │             │    │  ┌──────────┐  │
  │  │          │  │    │             │    │  │          │  │
  │  │  Mobile  │  │    │             │    │  │  Orders  │  │
  │  │          │  │    │             │    │  │          │  │
  │  └──────────┘  │    │             │    │  └──────────┘  │
  │                │    │             │    │                │
  │                │    │             │    │                │
  └────────────────┘    └─────────────┘    └────────────────┘

Git Graph

Branch and merge histories

Basic

Branch, commit, and merge operations

Mermaid
Try it →
gitGraph
    commit
    branch develop
    commit
    commit
    checkout main
    merge develop
    commit


  main    ──●─────┼───────────●─────●─
            0     │           │     4
                  │           │
  develop         ●─────●─────┼
                  1     2

Feature branches

Multiple branches with parallel work and merges

Mermaid
Try it →
gitGraph
    commit
    branch feature-a
    commit
    commit
    checkout main
    branch feature-b
    commit
    checkout main
    merge feature-a
    merge feature-b
    commit


  main      ──●─────┼───────────┼─────●─────●─────●─
              0     │           │     │     │     6
                    │           │     │     │
  feature-a         ●─────●─────┼─────┼     │
                    1     2     │           │
                                │           │
  feature-b                     ●───────────┼
                                3

Treemap

Hierarchical data as nested rectangles

Basic

Nested rectangles showing hierarchy and proportion

Mermaid
Try it →
treemap-beta
    "Engineering"
        "Backend": 45
        "Frontend": 40
        "Infra": 35
    "Product"
        "PM": 20
        "Analytics": 10
    "Design"
        "UX": 15
        "Visual": 10
┌┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┐ ┌┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┐ ┌┄┄┄┄┄┄┄┄┄┄┄┄┄┐
┆                            Engineering                            ┆ ┆    Product     ┆ ┆   Design    ┆
┆┌──────────────────────┐ ┌────────────────────┐ ┌─────────────────┐┆ ┆┌──┐ ┌─────────┐┆ ┆┌──┐ ┌──────┐┆
┆│       Backend        │ │      Frontend      │ │      Infra      │┆ ┆│PM│ │Analytics│┆ ┆│UX│ │Visual│┆
┆│          45          │ │         40         │ │       35        │┆ ┆│20│ │   10    │┆ ┆│15│ │  10  │┆
┆│                      │ │                    │ │                 │┆ ┆│  │ │         │┆ ┆│  │ │      │┆
┆└──────────────────────┘ └────────────────────┘ └─────────────────┘┆ ┆└──┘ └─────────┘┆ ┆└──┘ └──────┘┆
└┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┘ └┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┘ └┄┄┄┄┄┄┄┄┄┄┄┄┄┘

Nested sections

Three levels of hierarchy with sizes summed per section

Mermaid
Try it →
treemap-beta
    "Company"
        "Engineering"
            "Platform": 30
            "Mobile": 20
            "Web": 25
        "Sales"
            "EMEA": 15
            "US": 20
        "Ops": 10
┌┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┐
┆                                  Company                                   ┆
┆┌┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┐ ┌┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┐ ┌────┐┆
┆┆                Engineering                 ┆ ┆       Sales        ┆ │Ops │┆
┆┆┌───────────────┐ ┌────────────┐ ┌─────────┐┆ ┆┌─────────┐ ┌──────┐┆ │ 10 │┆
┆┆│   Platform    │ │    Web     │ │ Mobile  │┆ ┆│   US    │ │ EMEA │┆ │    │┆
┆┆│      30       │ │     25     │ │   20    │┆ ┆│   20    │ │  15  │┆ │    │┆
┆┆│               │ │            │ │         │┆ ┆│         │ │      │┆ │    │┆
┆┆│               │ │            │ │         │┆ ┆│         │ │      │┆ │    │┆
┆┆└───────────────┘ └────────────┘ └─────────┘┆ ┆└─────────┘ └──────┘┆ │    │┆
┆└┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┘ └┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┘ └────┘┆
└┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┘

Mindmap

Radial idea maps branching from a root

Mermaid
Try it →
mindmap
    root((Project))
        Planning
            Requirements
            Timeline
            Budget
        Development
            Frontend
            Backend
            Testing
        Launch
            Marketing
            Support
                                ╭─ Requirements
                  ╭─ Planning ──├─ Timeline
                  │             ╰─ Budget
root((Project)) ──┤                ╭─ Frontend
                  ├─ Development ──├─ Backend
                  │                ╰─ Testing
                  ╰─ Launch ──╭─ Marketing
                              ╰─ Support

User Journey

Task timelines with satisfaction scores

Basic

Tasks scored 1-5 with actor assignments per section

Mermaid
Try it →
journey
    title My Working Day
    section Morning
        Wake up: 3: Me
        Breakfast: 4: Me, Cat
        Go to work: 1: Me
    section Work
        Code review: 4: Me
        Lunch: 5: Me, Coworker
        Deploy: 2: Me
  My Working Day

  ● Cat
  ◆ Coworker
  ■ Me

  ╭────────────── Morning ────────────────╮   ╭────────────── Work ───────────────╮

  ╭■────────╮ ╭●■─────────╮ ╭■───────────╮    ╭■────────────╮ ╭◆■─────╮ ╭■───────╮
 ─│ Wake up │─│ Breakfast │─│ Go to work │────│ Code review │─│ Lunch │─│ Deploy │────►
  ╰─────────╯ ╰───────────╯ ╰────────────╯    ╰─────────────╯ ╰───────╯ ╰────────╯
      😐           😊             😞                😊           😄         😟

Onboarding flow

New employee experience across their first week

Mermaid
Try it →
journey
    title New Hire Onboarding
    section Day 1
        Setup laptop: 3: Employee
        Meet team: 5: Employee, Manager
        Read docs: 2: Employee
    section Week 1
        First PR: 4: Employee
        Code review: 4: Employee, Mentor
        Demo: 5: Employee, Team
  New Hire Onboarding

  ● Employee
  ◆ Manager
  ■ Mentor
  ▲ Team

  ╭───────────────── Day 1 ───────────────────╮   ╭───────────── Week 1 ───────────────╮

  ╭●─────────────╮ ╭●◆─────────╮ ╭●──────────╮    ╭●─────────╮ ╭●■───────────╮ ╭●▲────╮
 ─│ Setup laptop │─│ Meet team │─│ Read docs │────│ First PR │─│ Code review │─│ Demo │────►
  ╰──────────────╯ ╰───────────╯ ╰───────────╯    ╰──────────╯ ╰─────────────╯ ╰──────╯
         😐             😄            😟               😊            😊           😄

Packet

Bit-aligned network protocol layouts

UDP header

Header fields aligned to 32-bit rows

Mermaid
Try it →
packet-beta
    0-15: "Source Port"
    16-31: "Destination Port"
    32-47: "Length"
    48-63: "Checksum"
    64-95: "Data"
 0                                             15 16                                           31
 ╭───────────────────────────────────────────────┬───────────────────────────────────────────────╮
 │                 Source Port                   │               Destination Port                │
 ╰───────────────────────────────────────────────┴───────────────────────────────────────────────╯
 32                                            47 48                                           63
 ╭───────────────────────────────────────────────┬───────────────────────────────────────────────╮
 │                    Length                     │                   Checksum                    │
 ╰───────────────────────────────────────────────┴───────────────────────────────────────────────╯
 64                                                                                            95
 ╭───────────────────────────────────────────────────────────────────────────────────────────────╮
 │                                             Data                                              │
 ╰───────────────────────────────────────────────────────────────────────────────────────────────╯

Auto-increment fields

ICMP header using +N widths instead of explicit bit ranges

Mermaid
Try it →
packet
    +8: "Type"
    +8: "Code"
    +16: "Checksum"
    +32: "Rest of Header"
 0                      7 8                    15 16                                           31
 ╭───────────────────────┬───────────────────────┬───────────────────────────────────────────────╮
 │         Type          │         Code          │                   Checksum                    │
 ╰───────────────────────┴───────────────────────┴───────────────────────────────────────────────╯
 32                                                                                            63
 ╭───────────────────────────────────────────────────────────────────────────────────────────────╮
 │                                        Rest of Header                                         │
 ╰───────────────────────────────────────────────────────────────────────────────────────────────╯

Timeline

Chronological event lists with details

Basic

Chronological events grouped by section

Mermaid
Try it →
timeline
    title Project History
    section 2023
        January : Kickoff meeting
        March : Alpha release
        June : Beta testing
    section 2024
        January : v1.0 launch
        June : 10k users
Project History

 ══ 2023 ══
 │
 ●── January
 │   Kickoff meeting
 │
 ●── March
 │   Alpha release
 │
 ●── June
 │   Beta testing
 │
 ══ 2024 ══
 │
 ●── January
 │   v1.0 launch
 │
 ●── June
 │   10k users

Multiple details per event

Comma-separated details listed under each event

Mermaid
Try it →
timeline
    title Web Platform Releases
    section 2025
        Q1 : v1.0 public launch, Docs site
        Q3 : v1.5 plugin API
    section 2026
        Q1 : v2.0 rewrite, Dark mode, CLI
        Q3 : v2.2 offline support
Web Platform Releases

 ══ 2025 ══
 │
 ●── Q1
 │   v1.0 public launch
 │   Docs site
 │
 ●── Q3
 │   v1.5 plugin API
 │
 ══ 2026 ══
 │
 ●── Q1
 │   v2.0 rewrite
 │   Dark mode
 │   CLI
 │
 ●── Q3
 │   v2.2 offline support

Kanban

Column-based task boards with cards

Basic

Columns of task cards

Mermaid
Try it →
kanban
    Todo
        Design landing page
        Write API docs
    In Progress
        Build auth flow
        Setup CI/CD
    Done
        Project setup
        Database schema
╭───────────────────────╮  ╭───────────────────╮  ╭───────────────────╮
│         Todo          │  │    In Progress    │  │       Done        │
│───────────────────────│  │───────────────────│  │───────────────────│
│ ┌───────────────────┐ │  │ ┌───────────────┐ │  │ ┌───────────────┐ │
│ │Design landing page│ │  │ │Build auth flow│ │  │ │Project setup  │ │
│ └───────────────────┘ │  │ └───────────────┘ │  │ └───────────────┘ │
│                       │  │                   │  │                   │
│ ┌───────────────────┐ │  │ ┌───────────────┐ │  │ ┌───────────────┐ │
│ │Write API docs     │ │  │ │Setup CI/CD    │ │  │ │Database schema│ │
│ └───────────────────┘ │  │ └───────────────┘ │  │ └───────────────┘ │
╰───────────────────────╯  ╰───────────────────╯  ╰───────────────────╯

Column and card ids

id[Title] syntax for columns and cards

Mermaid
Try it →
kanban
    backlog[Backlog]
        b1[Refactor auth module]
        b2[Add rate limiting]
    review[In Review]
        r1[Fix pagination bug]
    shipped[Shipped]
        s1[Dark mode]
        s2[CSV export]
╭────────────────────────╮  ╭──────────────────────╮  ╭──────────────╮
│        Backlog         │  │      In Review       │  │   Shipped    │
│────────────────────────│  │──────────────────────│  │──────────────│
│ ┌────────────────────┐ │  │ ┌──────────────────┐ │  │ ┌──────────┐ │
│ │Refactor auth module│ │  │ │Fix pagination bug│ │  │ │Dark mode │ │
│ └────────────────────┘ │  │ └──────────────────┘ │  │ └──────────┘ │
│                        │  │                      │  │              │
│ ┌────────────────────┐ │  │                      │  │ ┌──────────┐ │
│ │Add rate limiting   │ │  │                      │  │ │CSV export│ │
│ └────────────────────┘ │  │                      │  │ └──────────┘ │
╰────────────────────────╯  ╰──────────────────────╯  ╰──────────────╯