Mermaid.js Flowcharts, Architecture Maps, and Sequence Diagrams in Markdown

Rahul Tungariya · Nov 10, 2026 · 5 min read

Complete tutorial on rendering software architectures, sequence diagrams, and git graphs directly in Markdown using Mermaid 11.x.

# Mermaid.js Diagrams in Markdown: Complete Reference

Documenting distributed systems, state machines, and sequence workflows in pure code is dramatically faster than maintaining PNG diagrams in Figma. WriterMD includes native, client-side **Mermaid.js 11.x** rendering.

## 1. Flowcharts & Directional Graphs

```mermaid flowchart LR Client[Browser Client] -->|Encrypted HTTPS| Gateway[API Gateway] Gateway --> Auth[Auth Service] Gateway --> DB[(PostgreSQL)] ```

Use `flowchart TD` for top-to-bottom or `flowchart LR` for left-to-right arrangements.

## 2. Sequence Diagrams

```mermaid sequenceDiagram autonumber actor Alice actor Bob Alice->>Bob: Hello Bob, how are you? Bob-->>Alice: I am doing well, thank you! ```

## 3. State Diagrams

```mermaid stateDiagram-v2 [*] --> Draft Draft --> InReview: Submit InReview --> Approved: Pass QA InReview --> Draft: Request Changes Approved --> Published: Deploy Published --> [*] ```

All diagrams scale infinitely as SVG vectors and export cleanly into print-ready PDFs.