Skip to content

YAML Specs

This document describes the YAML DSL (Domain Specific Language) for defining architecture diagrams.

Document Structure

version: 1
docId: "unique-identifier"
title: "Diagram Title"
nodes:
- id: node1
provider: aws
kind: network.vpc
label: "My VPC"
layout: { x: 0, y: 0, w: 800, h: 500 }
edges:
- id: edge1
from: node1
to: node2
label: "Connection"

Top-Level Properties

PropertyTypeRequiredDescription
versionnumberYesSchema version (currently 1)
docIdstringYesUnique document identifier (used for WebSocket matching)
titlestringNoDocument title (defaults to docId)
nodesarrayYesList of node definitions
edgesarrayNoList of edge definitions
iconsobjectNoCustom icon mappings (see Custom Icons)

Nodes

Nodes represent resources in your architecture diagram.

Node Properties

PropertyTypeRequiredDescription
idstringYesUnique node identifier
providerstringYesCloud provider (e.g., aws, gcp, azure)
kindstringYesResource type (e.g., network.vpc, compute.lb.alb)
labelstringNoDisplay label (defaults to id)
parentstringNoParent node id for nesting
layoutobjectYesPosition and size

Layout Properties

PropertyTypeRequiredDescription
layoutobjectConditional*Position and size
layout.xnumberConditional*X position (pixels)
layout.ynumberConditional*Y position (pixels)
layout.wnumberNo**Width (pixels)
layout.hnumberNo**Height (pixels)

*layout, layout.x, and layout.y are required for top-level nodes but optional for child nodes (nodes with parent). See Auto-Layout.

**w and h are optional for container nodes (VPC, Subnet, etc.). Defaults are applied when omitted.

Auto-Layout

Child nodes (nodes with a parent) can omit layout, layout.x, and layout.y. When omitted, nodes are automatically positioned in a 3-column grid pattern within their parent.

Rules:

  1. Top-level nodes: layout with x and y is required
  2. Child nodes (leaf): layout is optional; omit for auto-positioning
  3. Container nodes: w/h are optional; defaults are used when omitted. x/y can be omitted for auto-positioning
  4. Partial coordinates: Not allowed; specify both x and y, or neither

Grid Layout:

Auto-positioned nodes are arranged in a grid:

  • 3 columns per row
  • 60px padding from parent edge
  • 160px horizontal spacing
  • 140px vertical spacing
┌────────────────────────────────────────┐
│ [1] [2] [3] │
│ (60,60) (280,60) (500,60) │
│ │
│ [4] [5] [6] │
│ (60,260) (280,260) (500,260) │
└────────────────────────────────────────┘

Example:

nodes:
# Container: requires explicit layout with w/h
- id: vpc
provider: aws
kind: network.vpc
label: "VPC"
layout: { x: 0, y: 0, w: 800, h: 600 }
# Container child: needs w/h, can auto-position x/y
- id: subnet
provider: aws
kind: network.subnet
label: "Private Subnet"
parent: vpc
layout: { w: 700, h: 500 } # x/y auto: (40, 40)
# Leaf nodes: can omit layout entirely
- id: ec2_1
provider: aws
kind: compute.ec2
label: "Web Server 1"
parent: subnet
# No layout - auto: (40, 40)
- id: ec2_2
provider: aws
kind: compute.ec2
label: "Web Server 2"
parent: subnet
# No layout - auto: (200, 40)
- id: rds
provider: aws
kind: database.rds
label: "Database"
parent: subnet
# No layout - auto: (360, 40)
# Explicit positioning overrides auto-layout
- id: lambda
provider: aws
kind: compute.lambda
label: "Lambda"
parent: subnet
layout: { x: 500, y: 300 } # Custom position

Node Examples

Simple Resource:

- id: alb
provider: aws
kind: compute.lb.alb
label: "Application Load Balancer"
layout: { x: 100, y: 100 }

Container (VPC):

- id: vpc
provider: aws
kind: network.vpc
label: "VPC 10.0.0.0/16"
layout: { x: 0, y: 0, w: 800, h: 600 }

Nested Node:

- id: ecs
provider: aws
kind: compute.container.ecs_service
label: "ECS Service"
parent: subnet_private
layout: { x: 80, y: 120 }

Edges

Edges represent connections between nodes.

Edge Properties

PropertyTypeRequiredDescription
idstringYesUnique edge identifier
fromstringYesSource node id
tostringYesTarget node id
labelstringNoConnection label (defaults to empty)
colorstringNoLine color in HEX format (#RGB or #RRGGBB). Defaults to #666666 (gray)

Edge Examples

edges:
- id: alb_to_ecs
from: alb
to: ecs
label: "HTTP:80"
color: "#FF5733" # Orange
- id: ecs_to_rds
from: ecs
to: rds
label: "PostgreSQL:5432"
color: "#3498DB" # Blue

Edge Color

The color property allows you to customize the connector line color:

  • Format: HEX color code with # prefix
  • Shorthand: #RGB is expanded to #RRGGBB (e.g., #F00 becomes #FF0000)
  • Default: #666666 (gray)
  • Case: Both uppercase and lowercase are accepted

Examples:

edges:
# Full HEX format
- id: e1
from: a
to: b
color: "#FF5733"
# Shorthand format
- id: e2
from: b
to: c
color: "#F53"
# Lowercase
- id: e3
from: c
to: d
color: "#3498db"
# No color (uses default gray)
- id: e4
from: d
to: e

Supported Providers

Figram supports multiple cloud providers:

ProviderDescription
awsAmazon Web Services
gcpGoogle Cloud Platform
azureMicrosoft Azure

Supported Kinds

Each provider has its own set of supported kinds with corresponding icons.

AWS (provider: aws)

Containers (require w and h)

KindDescription
network.vpcVirtual Private Cloud
network.subnetSubnet

Compute Resources

KindDescription
compute.ec2EC2 Instance
compute.lambdaLambda Function
compute.lbElastic Load Balancing
compute.lb.albApplication Load Balancer
compute.lb.nlbNetwork Load Balancer
compute.container.ecsECS Cluster
compute.container.ecs_serviceECS Service
compute.container.ecs_taskECS Task
compute.container.eksEKS Cluster
compute.container.fargateFargate
compute.apprunnerApp Runner

Database Resources

KindDescription
database.rdsRDS Database
database.auroraAurora
database.dynamodbDynamoDB Table
database.elasticacheElastiCache
database.neptuneNeptune
database.redshiftRedshift
database.documentdbDocumentDB

Storage Resources

KindDescription
storage.s3S3 Bucket
storage.efsEFS File System
storage.ebsEBS Volume
storage.glacierS3 Glacier

Networking

KindDescription
network.cloudfrontCloudFront
network.route53Route 53
network.apigatewayAPI Gateway
network.igwInternet Gateway
network.natgatewayNAT Gateway
network.transitgatewayTransit Gateway

Integration

KindDescription
integration.sqsSQS Queue
integration.snsSNS Topic
integration.eventbridgeEventBridge
integration.stepfunctionsStep Functions

Security

KindDescription
security.iamIAM
security.cognitoCognito
security.secretsmanagerSecrets Manager
security.kmsKMS

GCP (provider: gcp)

Containers (require w and h)

KindDescription
network.vpcVirtual Private Cloud

Compute Resources

KindDescription
compute.gceCompute Engine
compute.functionsCloud Functions
compute.cloudrunCloud Run
compute.container.gkeGoogle Kubernetes Engine
compute.appengineApp Engine
compute.lbCloud Load Balancing

Database Resources

KindDescription
database.cloudsqlCloud SQL
database.spannerCloud Spanner
database.bigtableCloud Bigtable
database.firestoreFirestore
database.memorystoreMemorystore

Storage Resources

KindDescription
storage.gcsCloud Storage
storage.filestoreFilestore

Networking

KindDescription
network.cdnCloud CDN
network.dnsCloud DNS
network.armorCloud Armor
network.natCloud NAT
network.apigatewayAPI Gateway

Integration

KindDescription
integration.pubsubCloud Pub/Sub
integration.tasksCloud Tasks
integration.workflowsWorkflows

Security

KindDescription
security.iamCloud IAM
security.kmsCloud KMS
security.secretmanagerSecret Manager

Azure (provider: azure)

Containers (require w and h)

KindDescription
network.vnetVirtual Network

Compute Resources

KindDescription
compute.vmVirtual Machine
compute.functionsAzure Functions
compute.container.aciContainer Instances
compute.container.aksAzure Kubernetes Service
compute.appserviceApp Service
compute.lbLoad Balancer
compute.lb.appgwApplication Gateway

Database Resources

KindDescription
database.sqlSQL Database
database.cosmosdbCosmos DB
database.mysqlAzure Database for MySQL
database.postgresqlAzure Database for PostgreSQL
database.redisAzure Cache for Redis

Storage Resources

KindDescription
storage.storageStorage Account
storage.blobBlob Storage
storage.filesFile Storage
storage.datalakeData Lake Storage

Networking

KindDescription
network.frontdoorAzure Front Door
network.cdnAzure CDN
network.dnsAzure DNS
network.firewallAzure Firewall
network.apimAPI Management

Integration

KindDescription
integration.servicebusService Bus
integration.eventhubsEvent Hubs
integration.eventgridEvent Grid
integration.logicappsLogic Apps

Security

KindDescription
security.aadAzure Active Directory
security.keyvaultKey Vault
security.defenderMicrosoft Defender

Custom Kinds

Any string is accepted as a kind. Use dot notation for categorization:

- id: custom
provider: custom
kind: my.custom.resource
label: "Custom Resource"
layout: { x: 0, y: 0 }

Icons fall back through the kind hierarchy. For example, compute.lb.alb will try:

  1. compute.lb.alb (exact match)
  2. compute.lb (parent)
  3. compute (grandparent)

If no icon is found, a generic shape is rendered.

Complete Example

version: 1
docId: "prod-architecture"
title: "Production Architecture"
nodes:
# VPC Container
- id: vpc
provider: aws
kind: network.vpc
label: "VPC 10.0.0.0/16"
layout: { x: 0, y: 0, w: 960, h: 560 }
# Public Subnet
- id: subnet_public
provider: aws
kind: network.subnet
label: "Public Subnet (ap-northeast-1a)"
parent: vpc
layout: { x: 40, y: 80, w: 420, h: 360 }
# Private Subnet
- id: subnet_private
provider: aws
kind: network.subnet
label: "Private Subnet (ap-northeast-1a)"
parent: vpc
layout: { x: 500, y: 80, w: 420, h: 360 }
# ALB in Public Subnet
- id: alb
provider: aws
kind: compute.lb.alb
label: "ALB"
parent: subnet_public
layout: { x: 80, y: 140 }
# ECS in Private Subnet
- id: ecs
provider: aws
kind: compute.container.ecs_service
label: "ECS Service"
parent: subnet_private
layout: { x: 80, y: 140 }
# RDS in Private Subnet
- id: rds
provider: aws
kind: database.rds
label: "RDS PostgreSQL"
parent: subnet_private
layout: { x: 80, y: 280 }
edges:
- id: alb_to_ecs
from: alb
to: ecs
label: "HTTP:80"
- id: ecs_to_rds
from: ecs
to: rds
label: "PostgreSQL:5432"

Validation Rules

ID Uniqueness

All node and edge IDs must be unique within the document:

# Invalid: duplicate id
nodes:
- id: server
# ...
- id: server # Error: duplicate node id
# ...

Parent Reference

The parent field must reference an existing node:

# Invalid: parent doesn't exist
nodes:
- id: ecs
parent: nonexistent # Error: parent 'nonexistent' does not exist
# ...

Cycle Detection

Parent relationships cannot form cycles:

# Invalid: cycle detected
nodes:
- id: a
parent: b
# ...
- id: b
parent: a # Error: cycle detected
# ...

Edge References

Edge from and to must reference existing nodes:

# Invalid: node doesn't exist
edges:
- id: e1
from: alb
to: nonexistent # Error: to 'nonexistent' does not exist

Custom Icons

You can define custom icons for nodes directly in your diagram file or in a separate figram-icons.yaml file.

Inline Icons

Add icons to your diagram file:

version: 1
docId: "prod"
icons:
aws:
"compute.ec2": "./icons/ec2.png"
"database.rds": "./icons/rds.png"
gcp:
"compute.gce": "./icons/gce.png"
nodes:
- id: web
provider: aws
kind: compute.ec2
# ...

Icons Structure

PropertyTypeDescription
iconsobjectProvider-keyed icon mappings
icons.<provider>objectKind-to-path mappings for a provider
icons.<provider>.<kind>stringPath to icon file (relative or absolute)

Separate Icons File (figram-icons.yaml)

Create a separate icons configuration file:

version: 1
icons:
aws:
"compute.ec2": "./icons/ec2.png"
"compute.lambda": "./icons/lambda.png"
"database.rds": "./icons/rds.png"

The CLI automatically discovers figram-icons.yaml in the same directory as your diagram file.

Path Resolution

  • Relative paths: Resolved from the YAML file location
  • Absolute paths: Used as-is
  • Supported formats: PNG, JPG, JPEG, GIF, WebP

Hierarchical Fallback

Icons use hierarchical matching. Define a parent kind icon to cover all children:

icons:
aws:
"compute": "./icons/compute-generic.png" # Fallback for all compute.*
"compute.ec2": "./icons/ec2.png" # Specific for EC2

With this configuration:

  • compute.ec2 uses ec2.png
  • compute.lambda uses compute-generic.png (falls back to parent)
  • compute.container.ecs uses compute-generic.png (falls back to grandparent)

Best Practices

1. Use Descriptive IDs

# Good
- id: vpc_production
- id: subnet_public_a
- id: alb_web
# Avoid
- id: n1
- id: n2

2. Organize with Consistent Layout

Position nested nodes relative to their parent:

- id: vpc
layout: { x: 0, y: 0, w: 800, h: 500 }
- id: subnet
parent: vpc
layout: { x: 40, y: 60, w: 360, h: 380 } # Offset from parent
- id: alb
parent: subnet
layout: { x: 80, y: 120 } # Offset from subnet

3. Use Meaningful Labels

# Good
- id: alb
label: "ALB (internet-facing)"
# Also good: omit label if id is descriptive enough
- id: "Application Load Balancer"
# label defaults to id
edges:
# Web tier connections
- id: client_to_alb
from: client
to: alb
- id: alb_to_ecs
from: alb
to: ecs
# Data tier connections
- id: ecs_to_rds
from: ecs
to: rds
- id: ecs_to_cache
from: ecs
to: elasticache