template¶
Generate common diagram patterns as starting points.
Usage¶
Flags¶
| Flag | Default | Description |
|---|---|---|
-f, --format |
toon |
Output format: toon, json, yaml |
--d2 |
false |
Output D2 code instead of spec |
--clusters |
2 |
Number of clusters (network-boundary) |
--services |
2 |
Services per cluster (network-boundary) |
Available Templates¶
| Template | Description |
|---|---|
network-boundary |
Side-by-side network zones with services and datastores |
microservices |
Service mesh with API gateway |
data-flow |
ETL/data pipeline |
sequence |
Request/response sequence diagram |
entity-relationship |
Database schema with SQL tables (alias: er) |
deployment |
Cloud deployment architecture |
Examples¶
List Templates¶
Get as TOON Spec¶
Get as D2 Code¶
Render Directly¶
Customize Network Boundary¶
Template Details¶
network-boundary¶
Side-by-side network zones demonstrating grid-columns for horizontal layout.
Key techniques:
grid-columns: 2at root for side-by-side clustersdirection: downinside each cluster- Invisible container (
"") for horizontal service grouping shape: cylinderfor datastores
microservices¶
Service mesh architecture with API gateway, services, and data layer.
Key techniques:
direction: rightfor left-to-right flow- Nested containers for gateway components
grid-columns: 2for service grid- Multiple shapes:
person,cylinder,queue
data-flow¶
ETL/data pipeline from sources to consumption.
Key techniques:
- Five-stage pipeline: Sources → Ingestion → Processing → Storage → Consumption
- Internal edges within each stage
- Cross-stage edges for data flow
sequence¶
Authentication flow sequence diagram.
Key techniques:
shape: sequence_diagram- Actor ordering
- Message sequence
- Groups for error cases
entity-relationship¶
Database schema with SQL tables.
Key techniques:
shape: sql_table- Column types and constraints
- Foreign key relationships
deployment¶
Cloud deployment architecture with multiple layers.
Key techniques:
grid-columns: 3for layer arrangement- Mixed directions per container
- Cloud-specific shapes