Mermaid Online
Architecture diagrams · from code

Mermaid Architecture Diagram

An architecture diagram in Mermaid is text, so it lives in the repository next to the system it describes and updates in the same pull request. Copy one of the patterns below, edit the names, and export a PNG or SVG for your docs.

No signup · No watermark · Renders in your browser · PNG, SVG, JPG, WebP, PDF

Three patterns that cover most systems

Architecture diagrams tend to answer one of three questions: what talks to what, what happens during one request, or what runs where. Each needs a different Mermaid grammar.

Service topology

What talks to what. Group services into boundaries with subgraph, and give data stores the cylinder shape so storage is readable at a glance.

flowchart LR
  subgraph edge["Edge"]
    cdn["CDN"]
  end
  subgraph app["Application"]
    api["API"]
    worker["Worker"]
  end
  cdn --> api
  api --> db[("Postgres")]
  api --> queue[("Queue")]
  queue --> worker
  worker --> db

Request flow

What happens during one request, in order. A sequence diagram shows timing and return values, which a topology diagram cannot.

sequenceDiagram
  participant Client
  participant API
  participant Cache
  participant DB
  Client->>API: GET /orders
  API->>Cache: read
  Cache-->>API: miss
  API->>DB: SELECT
  DB-->>API: rows
  API-->>Client: 200 JSON

Deployment topology

What runs where. Use subgraph for each environment or cluster, and dotted arrows for anything that crosses a trust boundary.

flowchart TB
  subgraph cluster["Kubernetes"]
    ingress["Ingress"]
    pods["App pods"]
  end
  subgraph managed["Managed"]
    rds[("RDS")]
  end
  users(["Users"]) --> ingress
  ingress --> pods
  pods --> rds
  pods -.-> logs["Log sink"]

The syntax an architecture diagram actually needs

Shapes that carry meaning

A[Service]
A rectangle: something that runs code.
A[(Store)]
A cylinder: a database, bucket, or queue.
A([Client])
A stadium: an actor or entry point.
A{Check?}
A diamond: a branch in the flow.
A[[Batch]]
A subroutine: a job or scheduled process.

Structure and direction

subgraph x[..]
A boundary: a VPC, cluster, team, or tier.
flowchart LR
Left to right — best for request paths.
flowchart TB
Top to bottom — best for layered deployments.
A --> B
A plain dependency or call.
A -.-> B
Something optional, async, or out of band.
A -->|gRPC| B
Label the protocol only where it changes a decision.

Edit and export

The starter below is a small service topology. Change the names, pick an export style, and download a PNG or SVG — everything renders locally in your browser.

Paste or edit Mermaid code
Replace the sample below, or load another example.
Load example
Paste Mermaid code here. Preview and export load locally in your browser.
Live previewSample preview · Clean Docs

Write

Preview

Export

Docs Asset

Render & export

Export controls activate after your diagram renders locally.

Flowchart
Mode
Default renderNative MermaidOptimized exportStyled download
Export style
Clean DocsGitHub READMETransparent DocsWarm Editorial✦ ProWhiteboard Sketch✦ ProAurora Noir✦ ProBlueprint✦ ProChampagne✦ ProEmerald Suite✦ ProEditorial✦ Pro
Scale
1x2x4x
Or exact width, e.g. 1200px wide
Output: White · comfortable padding
Size: calculated after render
Filename: mermaid-flowchart-white-2x.png

Questions

Should an architecture diagram be a flowchart or a sequence diagram?

Use a flowchart when the question is what connects to what — services, stores, and boundaries. Use a sequence diagram when the question is what happens in what order during a single request, including responses and timeouts. Many systems need both, and they are cheap to keep side by side because each is only a few lines of text.

How do I show boundaries like a VPC, cluster, or team?

Wrap the nodes in a subgraph and give it a quoted label: subgraph vpc["Production VPC"]. Subgraphs nest, so you can put a cluster inside an account inside a region, though more than two levels usually means the diagram is trying to say too much at once.

How many services should one diagram show?

Around a dozen nodes is the practical ceiling for a diagram someone reads in a document. Past that, split it: one overview where each boundary is a single node, plus a detail diagram per boundary. That is easier to keep accurate than one large canvas, because each diagram changes with the code it describes.

Does Mermaid have a dedicated architecture diagram type?

Recent Mermaid versions include an architecture-beta grammar with cloud icons, but it is still changing between releases and renders inconsistently across platforms. A plain flowchart with subgraphs and shape conventions is portable, renders the same in GitHub and in this tool, and will not break when the grammar moves.

What format should I export for documentation?

SVG when the destination renders it — text stays selectable and the diagram scales cleanly. PNG at 2x when the destination is a slide deck, an issue tracker, or any platform that strips SVG. Both export without a watermark here.