The spec reference
A spec says what exists and what talks to what. It has no coordinates, colours or sizes in it, because excalix picks every one of those from what each node is: its kind, and its icon when it has one.
The shape of a spec
One JSON object. Only nodes is required, and it needs at least one entry.
| field | what it holds |
|---|---|
title | Heading drawn above the diagram. |
direction | Which way the diagram flows: lr, left to right (the default), or tb, top to bottom. |
groups | Boundaries drawn around nodes, such as a VPC, a cluster or an account. They nest through parent. |
nodes | Every box in the diagram, in reading order. |
edges | Every arrow in the diagram. |
Ids are letters, digits, _ and -. Nodes and groups share one namespace, so no node may reuse a group's id. Any key the schema does not list is rejected rather than ignored.
Groups
A group has an id, a label drawn inside its top-left corner, and an optional parent: the id of the group it nests inside. The order pipeline on the home page puts an EKS cluster inside an AWS region this way:
"groups": [
{ "id": "aws", "label": "AWS eu-north-1" },
{ "id": "k8s", "label": "EKS", "parent": "aws" }
]
A node sits in at most one group, and node.group takes a single id. A component that really does sit on two networks goes in the group it runs in, and an edge crossing the boundary carries the other relationship. Pass an array and validation says so:
nodes[0].group: got an array, expected one group id: a node sits in exactly one group, so name the one it runs in and let an edge across the boundary carry the other relationship
Nodes and kinds
A node has an id, a label drawn inside the box, a kind, and optionally an icon and a group. The kind fixes the shape and colour, and there are six of them. Here is every kind in one diagram, with a group and both edge styles:
| kind | use it for |
|---|---|
client | Whoever initiates requests: people, browsers, mobile apps. |
service | Anything you run or configure yourself, an app or a load balancer alike. |
datastore | A database or durable storage. |
queue | A queue, topic or stream. |
cache | A cache or in-memory store. |
external | A system another company operates and you only call. |
The line between service and external is who operates the thing, not who wrote it. Load balancers, CDNs, API gateways and DNS inside your own boundary are services, because you configure them. A payment API, a hosted identity provider or an email sender is external: another company runs it and you only call it.
Icons
A node can also carry an icon: one name from a fixed catalog, saying what the node is the way its kind does. excalix draws it as a small line icon left of the label, in the label's colour, light in a dark render as the labels are, and widens the node to make room. There is no way to pass an image of your own; the catalog is the whole choice.
{ "id": "db", "label": "Postgres", "kind": "datastore", "icon": "database" }
| icon | use it for |
|---|---|
user | A person. |
users | A group of people, such as customers. |
browser | A web app. |
phone | A mobile app. |
desktop | A desktop app or a back office. |
terminal | A command line tool. |
bot | An AI agent or model. |
globe | The internet, DNS or a CDN. |
cloud | A cloud provider or hosted platform. |
gateway | An API gateway, a load balancer or an ingress. |
server | A service or an application server. |
container | A container or a pod. |
function | A serverless function. |
database | A database. |
cache | A cache. |
queue | A queue, topic or stream. |
storage | Object or block storage. |
search | A search index. |
file | A file or a document. |
mail | Email. |
chat | Chat or messaging. |
bell | Notifications. |
webhook | A webhook. |
payment | Payments. |
lock | Authentication and sign-in. |
key | Secrets and API keys. |
shield | Security, a firewall or a WAF. |
chart | Metrics, analytics and dashboards. |
logs | Logs. |
clock | A scheduler or cron. |
settings | Configuration and feature flags. |
git | Source control and CI. |
Give the icon that names the thing, and leave it out when none does: an icon widens its node, and a near miss misleads more than no icon does. A name outside the catalog is rejected, with the closest name suggested when it is a letter or two off:
nodes[0].icon: got "databse", expected one of "user", "users", "browser", "phone", "desktop", "terminal", "bot", "globe", "cloud", "gateway", "server", "container", "function", "database", "cache", "queue", "storage", "search", "file", "mail", "chat", "bell", "webhook", "payment", "lock", "key", "shield", "chart", "logs", "clock", "settings", "git", did you mean "database"?
The glyphs are Lucide icons under the ISC licence, shipped in the package's icons/ directory with the licence and the list of changes.
Edges
An edge needs from and to, both node ids. Three fields are optional:
| field | values |
|---|---|
style | sync (default) for request and response, drawn solid. async for a message or event, drawn dashed. |
arrows | forward (default) puts one head at the target, both one at each end, none draws a plain association. |
label | Text drawn on the arrow, a few words at most. Past about twenty characters it wraps onto more lines. |
{ "from": "web", "to": "api", "label": "POST /orders" },
{ "from": "api", "to": "redis", "arrows": "both" },
{ "from": "api", "to": "q", "style": "async" }
A \n in any label, node, group or edge, starts a new line. An edge from a node back to itself is allowed, and so are two edges between the same pair; each draws as its own arrow. A label on a self edge costs more than it looks, though: the node grows until the loop is long enough to carry the text, so give that one a single word or leave it bare.
Validation
excalix checks the whole spec before it draws anything and reports every problem in one pass. Each line names the path, what arrived, and what would have been valid. This spec has two mistakes:
{
"nodes": [
{ "id": "cdn", "label": "CloudFront", "kind": "gateway" },
{ "id": "api", "label": "Order API", "kind": "service" }
],
"edges": [{ "from": "cdn", "to": "apy" }]
}
nodes[0].kind: got "gateway", expected one of "client", "service", "datastore", "queue", "cache", "external"
edges[0].to: unknown node "apy", did you mean "api"?
There is no gateway kind. CloudFront is infrastructure you configure inside your own boundary, so it is a service. The edge points at an id nothing defines, and the suggestion says which one was meant. With both fixed the command prints ok: 2 nodes, 1 edge, 0 groups and exits 0.
The other checks read the same way:
nodes[1].id: duplicate id "api", expected an id no other node or group uses
nodes[1].label: got "", expected text
edges[0]: unknown key "colour", expected one of "from", "to", "label", "style", "arrows"
edges[0].to: "vpc" is a group, expected a node
groups[0].parent: "b" closes the cycle a -> b -> a
The MCP tool returns the same lines, so an agent gets the full list in one round trip. Run excalix validate to check a spec without rendering it.
Writing a spec that lays out well
Nothing in a spec says how the diagram looks. A kind and an icon say what a node is, and excalix decides how to draw both, so when a diagram reads wrong the fix is in the spec. These are the levers that move it.
List nodes in reading order
Sources first. Where edges form a loop, order decides which arrow runs backwards: the one from a node listed later to one listed earlier. Among siblings it is a preference and no more, so the layout reorders some of them when that keeps arrows from crossing, and it will not move an arrow onto a different route. When a route is what you want changed, the levers are the direction of the edge itself, which nodes share a group, and direction.
Keep edge labels short
A label sits on its arrow and the layout makes room for it. Past about twenty characters it wraps onto more lines, so a sentence on one edge becomes a block that pushes the nodes apart. A few words is plenty. When a node name is genuinely long, a \n breaks it.
The breaks are written into the file where Excalidraw's own wrapping allows one, so a wrapped label keeps its lines when you drag a node in the editor.
Stay near twenty nodes
Twenty nodes is roughly the ceiling for one picture, and a dozen boxes in a single run reaches it sooner, since a chain stretches one way and stays thin the other. A long chain reads better as lr and a deep hierarchy as tb, so try direction first.
When direction is not the problem, make two diagrams: an overview that collapses each region to one node, then a detail diagram of the part under discussion. Once the copy a model reads would shrink edge labels below about 11 pixels, rendering says so. For a long strip that happens past about 5800 pixels on its long side, and for a dense square sooner, since the model's copy is capped by area as well as by edge:
note: a model reads this diagram at 2000x383 px, where its edge labels are about 7px tall, too small to read. Split it into an overview and a detail diagram, or shorten the longest labels; the PNG on disk keeps the full 9124x1748.
Then look at it
Open the PNG and check for labels that collide with a box or another label, arrows that cross more than the topology forces them to, and a flow that reads backwards, with sources on the right and sinks on the left. Flip direction, group nodes that belong together, shorten a label or drop an edge that carries no information, then render again.
The JSON Schema
npx -y excalix schema prints the full JSON Schema of the spec, with a description on every field. Point an editor at it for completion, or hand it to a model along with this page. The MCP tool's input schema is the same shape plus three output options, out, theme and animate, described on the MCP server page. None is part of the spec, which says what exists and never how it is drawn.