Basic Syntax
Use a code fence with thediagram kind:
```diagram:name
name: Unique identifier for the diagram
Node Syntax
Nodes are defined with an ID and type in brackets:Node IDs
Node IDs can contain:- Letters (a-z, A-Z)
- Digits (0-9)
- Hyphens (
-) - Underscores (
_)
api, cache-01, db_primary, load-balancer
Node Types
Handhold supports the following node types:| Type | Description | Default Icon |
|---|---|---|
service | Generic service/compute | AWS EC2 |
database | Database | AWS RDS |
client | Client application | Resource Client |
user | End user | Resource User |
server | Server instance | AWS EC2 |
cache | Cache layer | AWS ElastiCache |
queue | Message queue | AWS SQS |
message-queue | Message queue | AWS SQS |
load-balancer | Load balancer | AWS ELB |
api-gateway | API gateway | AWS API Gateway |
Bracket Syntax
The content inside[...] can be:
Bare word (sets type):
service.
AWS Icon Keys
Nodes render as AWS architecture icons by default. You can override withicon=aws:<key>:
| Key | Aliases | Service |
|---|---|---|
apigateway | api-gateway | Amazon API Gateway |
elb | load-balancer | Elastic Load Balancing |
rds | database | Amazon RDS |
elasticache | cache | Amazon ElastiCache |
sqs | queue, message-queue | Amazon SQS |
s3 | object-store | S3 Standard |
cloudfront | cdn | Amazon CloudFront |
cognito | auth | Amazon Cognito |
ec2 | server, service, compute | Amazon EC2 |
client | — | Resource Client |
user | users | Resource User |
Edge Syntax
Basic Edges
Connect nodes with arrows:Labeled Edges
Add labels between dashes:Groups
Group related nodes with a visual boundary:- Draw a rounded rectangle around members
- Add a label at the top-left
- Support nesting (group IDs can be members)
Example
Regions
Regions target node IDs for animations:Triggers
Diagrams support flow and emphasis triggers:{{focus: region}}- Highlight specific nodes{{pulse: region}}- Brief emphasis{{flow: path}}- Animated flow through edges (looping dashes){{trace: path}}- Highlight path (static){{draw: edges}}- One-shot edge drawing animation{{pan: region}}- Center viewport on nodes{{annotate: region "text"}}- Floating labels
Flow Paths
Forflow, trace, and draw triggers, define a path as a region:
client→gateway, gateway→api, api→db.
Layout
Diagrams use automatic layout via ELK (Eclipse Layout Kernel):- Nodes are positioned to minimize edge crossings
- Hierarchical layout when possible
- Groups create visual containers
- Manual positioning not supported (by design)
type=graph layout=tree).
Real Example
Best Practices
Node Naming
Do: Use semantic, role-based namesEdge Labels
- Keep labels short (1-3 words)
- Use verbs for actions:
writes,reads,queries - Use protocols when relevant:
HTTPS,gRPC,WebSocket
Groups
- Group by architectural tier: Frontend, Backend, Data
- Group by security boundary: Public, Private, DMZ
- Group by deployment unit: Service A, Service B
Diagram Size
- Keep diagrams under 15 nodes for clarity
- Split large systems into multiple diagrams
- Use groups to manage visual complexity