Example
architecture-beta
group cloud(cloud)[Cloudflare]
service cdn(internet)[CDN] in cloud
service pages(server)[Pages] in cloud
service worker(server)[Worker API] in cloud
service db(database)[D1 Database] in cloud
service kv(disk)[KV Store] in cloud
service r2(disk)[R2 Storage] in cloud
cdn:R --> L:pages
pages:R --> L:worker
worker:R --> L:db
worker:T --> B:kv
worker:B --> T:r2 Syntax
Groups and services
architecture-beta
group vpc(cloud)[Production VPC]
service lb(internet)[Load balancer] in vpc
service app(server)[App] in vpc
service db(database)[Postgres] in vpc
service bucket(disk)[Object storage]
lb:R --> L:app
app:R --> L:db
app:B --> T:bucket Built-in icons: cloud, database, disk, internet, server. in groupId nests a service. Edge: id:SIDE --> SIDE:id with sides T, B, L, R.
Nested groups and junctions
architecture-beta
group cloud(cloud)[Cloud]
group region(cloud)[Region A] in cloud
service a(server)[Service A] in region
service b(server)[Service B] in region
junction j in cloud
a:R -- L:j
j:R --> L:b Junctions are invisible nodes for routing edges around groups. -- draws a line without an arrowhead.
Common mistakes
These are the parse errors that come up most, including in code written by ChatGPT and Claude. Paste any failing diagram into the editor and it marks the offending line.
-
Edges without side anchors (
a --> b).Fix: Architecture edges need sides:
a:R --> L:b. -
Icon names outside the built-in set (
service x(kafka)[Kafka]).Fix: Only cloud, database, disk, internet, and server ship by default. Extra icon packs can be registered in a custom renderer but not in GitHub or the share page.
-
Spaces in service IDs.
Fix: IDs are identifiers; the readable name goes in the square brackets.
Real-world examples
Complete, copy-ready architectures for common situations. Each one opens in the editor with a click.
Browse all examples →FAQ
Can I draw a multi-region or multi-cloud setup?
Yes. Make one top-level group per cloud or region and nest services inside. Use junctions to route cross-group edges cleanly.
How does it compare with the C4 diagram?
Mermaid's C4 syntax is older and more verbose. The architecture diagram is lighter and has icons, so it is the better default for infrastructure overviews.