Orrery open source

For people who explain systems

Architecture diagrams with moving parts, in a single SVG.

An orrery is a working model of the heavens: turn the crank and the planets move. Orrery does the same for your architecture diagrams. Write the model as a file. It renders to a single SVG file that you can embed in HTML, Markdown or anywhere else an image goes. Any box can open into the parts inside it, as deep as the model goes, and the diagram plays the failures you wrote.

A checkout system: a storefront calls the checkout API, which writes to an orders database and reads a session cache drawn as one closed box.
One SVG file, written by orrery embed.
heat sunlight solar wind tides Sun Venus Earth Mars Moon
A plain SVG file. In a README it animates with no plugin, and a view can play a whole scenario on a timer. Opened in a browser, the same file is an instrument: click a closed group to drill in, step a scenario from the keyboard.

Why a model

The file is a model of your system, and every picture is drawn from it.

Orrery is a way to model your system: the components, how they connect, and what happens when something fails. Views are drawings of that model. Change the model and every view changes with it.

Written, not drawn

A JSON file names components, connections, groups and states. Layout is automatic and deterministic, so the same file always renders the same bytes and a diff in review is a diff in meaning.

Alive

Traffic flows along connections at the load you declared. A scenario is the story you tell, step by step: which component fails, what that does to the others, where the traffic goes. The diagram plays it.

In your words

Healthy, impaired, brownout, outage: your states, your kinds, your meanings. Nothing in the tool reads a name or works out a state for you, and the legend teaches every reader your vocabulary.

Turn the crank

Fail the primary and watch what happens.

Nothing here was drawn by hand. One scenario step says the primary database failed, the checkout API is degraded because it reads from the replica, the storefront is degraded because checkout is slower, and the failover line now carries the reads. A callout on the picture says so in the author's words, pointing at the replica. The figure plays that step on a timer, with no script.

Data Session cache writes Storefront Checkout API Orders DB Read replica Primary fails Data Session cache writes checkout is slower Storefront reads from the replica; writes are queued Checkout API Orders DB Read replica Reads move to the replica;writes queue until theprimary is back degraded: Working with reduced redundancy or capacity failed: Broken Step 1 of 1: Orders DB goes down
Healthy, then the primary fails, every three seconds. Red pulses, amber marks what is degraded, the failover path lights up with the load the author moved there, the flows into the failed box stop, and a note arrives with the step to say what is happening. Every state carries the reason the author gave it.
"scenarios": [ { "id": "db-fails", "steps": [ {
  "note": "Orders DB goes down",
  "set": {
    "failed":   "db",
    "degraded": { "api": "reads from the replica; writes are queued",
                  "web": "checkout is slower" }
  },
  "load": [ { "id": "failover", "load": 0.6 } ],
  "callouts": [ { "at": "replica", "text": "Reads move to the replica; writes queue until the primary is back" } ]
} ] } ],
"views": [ { "id": "loop", "play": { "scenario": "db-fails", "seconds": 3 } } ]

That is the whole of it. A step puts entities in states, each with a reason if you want one, sets the loads that move, and points at what matters with a callout: a note placed where there is room, or on the side you say, shown at that step and gone at the next. Steps are cumulative and restore undoes them; a view that plays a scenario carries every step as a layer and cycles them with CSS, so it moves wherever an image can be shown.

Try a what-if without writing a scenario: orrery render app.orrery.json --set failed=db.

Your vocabulary

Degraded means something different at every company.

So the tool does not define it. You bind your own state names to looks, and your own kinds to glyphs, frames and lines. Below, the same checkout in one company's words: healthy, impaired, brownout, outage and drained. For this team the session cache is a nice-to-have, so draining it is a brownout, not an outage.

Data Session cache writes Storefront Checkout API Orders DB Read replica Session cache maintenance Data Session cache writes signed-in customers check out as guests Storefront guest checkout only: no saved carts Checkout API Orders DB Read replica impaired: Serving; redundancy or latency SLO breached brownout: Serving with a feature switched off drained: Deliberately out of rotation Step 1 of 1: The cache cluster is drained: checkout continues for guests
Playing on a timer, no script. Every four seconds the cache cluster and its nodes are drained for maintenance, checkout runs on for guests in a brownout, and the storefront behind it is impaired. Each of those is a word the author wrote in the step. The legend is in their words.
"states": {
  "default": "healthy",
  "replace": true,
  "define": {
    "healthy":  {},
    "impaired": { "look": "warn" },
    "brownout": { "look": { "stroke": "#7c3aed", "pulse": true } },
    "outage":   { "look": "alert", "flows": "stop" },
    "drained":  { "look": "muted", "flows": "stop" }
  }
},
"kinds": { "connections": {
  "gossip": { "line": { "dash": "2 3", "stroke": "#0891b2" } }
} }
  • Look

    How a state is drawn: a preset, or your own stroke, fill, text, dash and pulse.

  • Flows

    Whether traffic is still drawn moving through an entity in this state.

  • Line

    How a connection kind is drawn: a preset, or your own stroke, width, dash pattern and flow colour.

  • Description

    What the word means to your team. It goes in the legend, for the reader.

Kinds, shapes, packs

Nine kinds, eleven shapes, five packs.

A kind is a word for what a component is, bound to a glyph and a shape. The defaults draw a database as a cylinder, a client as a pill, a gateway as a hexagon. Define your own shape as path data, or pull in a pack. There are five. sre (reliability states) and user (people and their devices) come with the tool. aws, gcp and azure install separately, and each has every service in the provider's official icon set, named the way people say them.

box sharp pill ellipse cylinder hexagon
Six of the eleven presets. Box, sharp, pill, ellipse, cylinder, hexagon; then diamond, parallelogram, document, card and cloud. A group kind takes a shape too, so a boundary can be a cloud, open or closed.
AWS Checkout Orders Events Assets Sessions
The checkout on AWS. "kinds": { "use": ["aws"] } and the boxes carry Lambda, RDS, SQS, S3 and DynamoDB, inside a VPC frame in the provider's colour. orrery packs aws lists every name.
"kinds": {
  "use": ["aws"],
  "components": {
    "stage":  { "shape": "chevron" },
    "ledger": { "shape": "cylinder", "glyph": "database" }
  },
  "groups": { "pipeline": { "shape": "cloud" } }
},
"shapes": { "define": {
  "chevron": { "path": "M0 0H85L100 50 85 100H0L15 50Z", "pad": { "x": 16, "y": 0 } }
} },
"components": [ { "id": "api", "kind": "aws:fargate" }, { "id": "db", "kind": "aws:rds" } ]
  • Glyph

    A preset, your own path data, or a provider's icon in its own colours.

  • Shape

    The outline: a preset by name, or path data in a unit box with the room the label needs.

  • Pack

    A vocabulary by name: sre as states and user as kinds for people and their devices, both with the tool; aws, gcp, azure as kinds, each its own package under the provider's terms. Override any entry as you would a default.

  • Frame

    How a group is drawn: a preset, your own style, and a shape when a box is not the word.

The five packs

Each picture below is a three-box model drawn with that pack. The cloud icons belong to their providers and come under the providers' terms; the packs page has the details.

Drill down

The whole system, and the parts inside, in one diagram.

Start high. The session cache is one small box. Open it and it grows into a frame, the picture reflows around it, and you are looking at the two nodes it is made of. Open a node and you are inside that: a Redis process and its append-only file. Close them and everything slides back. The detail is in the model, folded away until the reader wants it, as many levels deep as the model goes. The diagram at the top of this page is that model: open it there.

"views": [ { "id": "overview", "collapse": ["sessions", "cache-a", "cache-b"] } ],
"tour": { "seconds": 4, "scenes": [
  { "view": "overview" },
  { "view": "overview", "open": ["sessions"] },
  { "view": "overview", "open": ["sessions", "cache-a", "cache-b"] },
  { "view": "overview", "open": ["sessions", "cache-a", "cache-b"], "zoom": "cache-a" },
  { "view": "overview", "open": ["sessions", "cache-a", "cache-b"], "zoom": "cache-a", "scenario": "redis-fails" },
  { "view": "overview", "open": ["sessions", "cache-a", "cache-b"], "scenario": "redis-fails" },
  { "view": "overview", "scenario": "redis-fails" }
] }

For a document, the same drill-down plays on a timer with no script. A tour lists scenes: a view, which closed groups are open, what the camera is zoomed on, a moment of a scenario, a caption. Opening and zooming are separate, so a scene can open two groups and stay zoomed out. Each set of open groups is laid out on its own and the picture moves between them. Nothing is duplicated and nothing can drift: the same components, connections and states draw every scene, so a change to the model is a change to all of them.

One file

It is just an SVG file, so it goes wherever an image goes.

A model lists the pictures it produces, and one command writes them all as enclosed files that animate inside any image tag. For a web page, one command writes the whole diagram with its engine, and your page builds the controls.

Scenes

orrery export writes every entry of the model's exports: the overview, a failure playing on a loop, the inside of a group, the tour, each with a title and description block above it when asked. CSS animation only, no script; they animate in a README, a wiki, a design doc.

An embed

orrery embed writes the diagram with every view and drill-down, the engine as a script, and a sample page. The engine has no interface of its own: your page mounts it, reads what the model offers, and builds the controls it wants.

Standalone

Opened on its own, the SVG is purely the diagram: click a component to select it, click a closed group to drill in, Escape to step back out, keys to switch views, start a scenario and step it.

Data Session cache writes Orders DB Read replica Checkout API
A scoped view. The data tier of the checkout, drawn left to right for the page it lives on. The API outside the scope is a ghost, so nothing is dropped silently.

Diagrams are code

The diagram lives next to the code it describes.

An Orrery model is a JSON file in your repository. It is versioned with the code, reviewed in the same pull request, and rendered by the same build. When the system changes, the diagram changes in the same commit, and the reviewer sees exactly what changed: a component added, a connection removed, a scenario step reworded. No exported image goes stale in a wiki.

$ git diff -- checkout.orrery.json
 "components": [
   { "id": "api", "label": "Checkout API" },
+  { "id": "replica", "label": "Read replica", "kind": "database", "group": "data" },
 "connections": [
+  { "id": "failover", "from": "api", "to": "replica", "load": 0 },
 "scenarios": [ { "id": "db-fails", "steps": [ {
-  "set": { "failed": { "db": "primary is down", "api": "no database" } }
+  "set": { "failed": "db", "degraded": { "api": "reads from the replica" } },
+  "load": [ { "id": "failover", "load": 0.6 } ]

A review reads like any other: the replica arrives, the failover line with it, and the story of a database outage changes from "the API fails" to "the API reads from the replica". Layout is automatic and deterministic, so there is no drawing to re-export and the same file always renders the same bytes.

Render it in CI and commit the SVG next to it, or point a README at the rendered file. Either way the picture in the docs is the model in the repo.

Written by agents, read by humans

Designed so a coding agent gets it right first time.

Every property in the schema explains itself. Unknown properties are errors. Every error is a JSON pointer and a sentence. A fresh agent given only the specification, the schema and the command line has grown a model through every step, from components to a replaced vocabulary, validating first time at each. Two reference pages draw the whole vocabulary and every way a model moves: the kitchen sink and the moving parts.

$ orrery validate platform.orrery.json
platform.orrery.json:/connections/7/kind: unknown connection kind "grpc"; known: sync, async, replication, dataflow, gossip
platform.orrery.json:/scenarios/1/steps/0/set/failed: unknown state "failed"; known: healthy, impaired, brownout, outage, drained

Try it on your own system.

Open source, MIT licensed, TypeScript. One command turns a JSON file into an SVG that moves.

npm install -g orrery-diagrams      # or: pnpm add -g · bun add -g
orrery render app.orrery.json -o app.svg
Orrery. An orrery is a mechanical model of the solar system; you turn the crank and watch the parts move. Specification · README · Examples · Kitchen sink · Moving parts · MIT