spinagram
Examples

Slides that explain themselves

Numbered steps, callouts, legends and designed notes, plus diagrams generated from data.

An annotated architecture

Numbered steps on the arrows, a Steps panel, a callout and a legend, all from four lines of code. This is step 4 of the tutorial.

The checkout with numbered steps, a callout and a legend
"""Tutorial step 4: numbered steps, a callout and a legend explain the diagram on the slide."""
from spinagram import Diagram

d = Diagram("T04", "Checkout", subtitle="Step 4: explain it with steps, callouts and a legend")

shoppers = d.box("Shoppers", icon="aws:users")
with d.group("AWS eu-west-1", style="aws-region", direction="right"):
    store = d.box("Storefront", text="CloudFront", icon="aws:cloudfront")
    with d.group("VPC", style="aws-vpc", direction="right"):
        orders = d.box("Orders API", text="FastAPI on ECS", icon="terrastruct:python")
        with d.group("Data"):
            db = d.box("Orders DB", text="PostgreSQL", icon="terrastruct:postgres")
            cache = d.box("Cache", text="Redis", icon="terrastruct:redis")
            queue = d.box("Events", text="SQS queue", icon="aws:sqs")

shoppers.to(store, "HTTPS", step="Shopper opens the cart")
store.to(orders, step="Storefront posts the order")
orders.to(db, "SQL", step="Order is stored")
orders >> cache
orders.to(queue, step="Fulfilment is notified")

d.callout(shoppers, "40k checkouts an hour on sale days", title="Peak load", kind="warning", side="bottom")
d.add_legend({"aws:users": "People", "terrastruct:python": "Service", "aws:sqs": "Async messaging"})
Python23 linesexamples/tutorial/step4_explain.py

Decision slides

Use it for: architecture decision records, review summaries, open questions.

Notes come in three variants: card (with an icon and an accent bar), quote and sticky. Give them coordinates for a designed, pixel-exact slide:

d.note("Aurora PostgreSQL", text="Managed backups and point-in-time recovery.",
       variant="card", icon="aws:amazon-aurora", x=80, y=200, w=540, h=210)
d.note("Werner Vogels", text="Everything fails, all the time.", variant="quote", x=80, y=520, w=1150, h=300)
d.note("Open question", text="Do we need a second region before the EU launch?", x=1300, y=520, w=540, h=140)
Architecture decisions slide with cards, a quote and open questions
"""Illustrative notes: decision cards with an accent bar, a quote, and sticky notes for open questions."""
from spinagram import Diagram

d = Diagram("NOTE01", "Architecture decisions", subtitle="Why the three-tier platform looks the way it does",
            category="Decisions", tags=["adr", "aws"])
d.stylesheet("showcase.css")
d.stylesheet("notes.css")

CARD = {"w": 540, "h": 210}
d.note("Aurora PostgreSQL", text="Managed backups and point-in-time recovery; a reader in a second zone takes "
       "reporting load off the writer.", variant="card", icon="aws:amazon-aurora", x=80, y=200, **CARD)
d.note("ECS on Fargate", text="No hosts to patch; tasks scale on CPU and queue depth, and deploys roll per "
       "zone.", variant="card", icon="aws:amazon-elastic-container-service", x=690, y=200, **CARD)
d.note("CloudFront and WAF", text="Static assets and TLS at the edge; managed rules stop the noisy part of "
       "the internet before it reaches the VPC.", variant="card", icon="aws:cloudfront", x=1300, y=200, **CARD)
d.note("Werner Vogels", text="Everything fails, all the time. Build for it.", variant="quote",
       x=80, y=520, w=1150, h=300, class_="hero-quote")
d.note("Open question", text="Do we need a second region before the EU launch?", x=1300, y=520, w=540, h=140,
       class_="question")
d.note("Next review", text="Revisit the cache strategy after Q3 load tests.", x=1300, y=680, w=540, h=140,
       class_="question")
Python21 linesexamples/showcase/notes.py

Annotations · Manual layout

Diagrams from data

Use it for: diagrams generated from an inventory, a CMDB or another tool.

Everything works as YAML too, which any program can write. Edges have a one-line shorthand:

id: Q01
title: Web app
nodes:
  - {id: lb, title: Load balancer, icon: "aws:alb"}
  - {id: api, title: API, text: FastAPI, icon: "terrastruct:python"}
edges:
  - "lb -> api: HTTPS"
spinagram render specs/ -f svg,pptx -o out/

YAML specs →

On this page