Skip to content

Getting started

diago renders diagrams from typed JSON specs: you say what is connected to what, and diago lays it out and draws it as SVG, PNG or Unicode text art, with draw.io and Excalidraw export in beta. This page takes about ten minutes.

To try diago without installing anything, open the playground.

diago is one binary. On macOS or Linux:

Terminal window
curl -fsSL https://diago.dev/install.sh | sh

On Windows, in PowerShell:

Terminal window
irm https://diago.dev/install.ps1 | iex

The script downloads the latest release for your system, amd64 or arm64, checks it against the release’s checksums.txt and puts diago in ~/.local/bin. On Windows it also adds that folder to your user Path; elsewhere, when the folder is not on PATH, it prints the line to add to your shell’s profile. To install somewhere else, set DIAGO_INSTALL_DIR; the script asks for sudo only when it cannot write the folder:

Terminal window
curl -fsSL https://diago.dev/install.sh | DIAGO_INSTALL_DIR=/usr/local/bin sh

Read the scripts first at diago.dev/install.sh and diago.dev/install.ps1. In Git Bash, MSYS2 or Cygwin on Windows, install.sh installs diago.exe; in WSL it installs the Linux build.

Or download the archive for your system from the latest release and put diago on PATH yourself. macOS quarantines a file a browser downloads; clear it with xattr -d com.apple.quarantine diago. Or, with Go 1.26 or later:

Terminal window
go install github.com/oxforge/diago/cmd/diago@latest # the latest release
go install github.com/oxforge/diago/cmd/diago@main # unreleased changes

SVG, text art, draw.io and Excalidraw need nothing else. PNG output runs resvg on the SVG; without it, -format png fails with an install hint and every other format still works:

Terminal window
brew install resvg # macOS, or Linux with Homebrew
cargo install resvg # any platform with Rust

Or download a binary for Linux x86_64 or macOS from resvg’s releases and put it on PATH, or point DIAGO_RESVG_PATH at it.

diago is at 0.x: until 1.0, a release may reject a spec the previous one accepted, change an exit code or change what a render draws, and its release notes list those breaking changes first. To stay on one version, give the script that version, or go install it:

Terminal window
curl -fsSL https://diago.dev/install.sh | DIAGO_VERSION=vX.Y.Z sh
go install github.com/oxforge/diago/cmd/[email protected]

In PowerShell, run $env:DIAGO_VERSION = 'vX.Y.Z' before irm. diago --version prints the version you have.

Save this as hello.v1.json:

hello.v1.json
{
"type": "flow",
"direction": "RIGHT",
"nodes": [
{"id": "client", "label": "Client", "shape": "rounded"},
{"id": "api", "label": "API"},
{"id": "db", "label": "Database", "shape": "cylinder"}
],
"edges": [
{"id": "client-api", "from": "client", "to": "api", "label": "HTTPS"},
{"id": "api-db", "from": "api", "to": "db", "label": "SQL"}
]
}
A client calls an API over HTTPS; the API queries a database over SQL.A client calls an API over HTTPS; the API queries a database over SQL.

Render it three ways:

Terminal window
diago render hello.v1.json > hello.svg
diago render -format png hello.v1.json > hello.png
diago render -format text hello.v1.json

The last command prints the diagram as text art:

A client calls an API over HTTPS; the API queries a database over SQL.A client calls an API over HTTPS; the API queries a database over SQL.
  ╭────────╮    ┌──────┐    ╒══════════╕
  │ Client │───►│ API  │───►│ Database │
  ╰────────╯    └──────┘    └──────────┘
           HTTPS        SQL

Each node has an id, which edges use to name their ends, and a label, the text drawn in the box. shape picks the box: rounded and cylinder here, a plain rectangle when it is left out. direction is the way the diagram flows, RIGHT here.

diago placed the three nodes in order, routed each edge as right-angle segments around the boxes and drew the arrowheads. Rendering the same spec again gives the same bytes.

A Mermaid file renders the same way, as it is: diago render diagram.mmd. See Mermaid.

check reads a spec and reports content findings without drawing anything:

Terminal window
diago check -strict hello.v1.json

It prints nothing and exits 0. Now change the api-db label to data and run it again:

vague-edge-label edges[1]: edge api->db label "data" says little; prefer a specific verb phrase like "validates order" or "publishes event"

render prints the same findings on stderr, each after warning: . With -strict, check exits 1 while any finding remains. A finding that is deliberate can be silenced with a top-level "ignore": ["vague-edge-label"] in the spec.

Copy the spec to hello.v2.json, add a cache between the API and the database, and rename the database to Postgres. Keep every id:

Terminal window
diago diff hello.v1.json hello.v2.json > diff.svg
diago diff -format text hello.v1.json hello.v2.json

The text form prints the diagram, then the change list:

reads ╒════════════╕
┌─►│ + Cache │
┌──────┐ │ └────────────┘
╭────────╮ │ API │───┘
│ Client │───►│ │───┐
╰────────╯ └──────┘ │ ╒════════════╕
HTTPS └─►│ ~ Postgres │
SQL └────────────┘
hello.v1.json → hello.v2.json
added: node Cache
added: edge API -> Cache
changed: node Postgres: label "Database" → "Postgres"

In SVG and PNG the same diff is drawn in color:

The cache and its edge added, the database renamed, the rest unchanged.The cache and its edge added, the database renamed, the rest unchanged.

Added items are green and changed ones blue. A removed item is red, dashed, faded and struck through. Unchanged items are faded, so the change stands out. The change list sits under the picture in SVG and PNG, and after the diagram in the text form.

Ids are what make a renamed box “changed” rather than “removed and added”: the database kept db, so diago knows it is the same node with a new label.

  • Flow diagrams: the guides start here, then sequence, class, themes, formats, diffs and Mermaid.
  • Claude Code: install the plugin so the agent draws with diago.
  • Other agents: the same setup for any agent with a shell.
  • CLI reference: every verb and flag.
  • Gallery: every kind of diagram, with its spec beside it.