Gallery
Every kind of diagram spinagram makes, each one rendered from a file you can copy.
Every picture here is rendered by spinagram from a file in
examples/. Pick the one closest to what you
need, copy it, and open it in the live preview:
spinagram serve examples/looks/ # any file or folder; re-renders on every saveSwitch scenarios above each picture and open the Python and CSS tabs to see the code behind it:
"""The diagram every look in this folder restyles: the code only says what each element *is*."""
from spinagram import Diagram
def platform(id: str, title: str, sheet: str) -> Diagram:
d = Diagram(id, title, subtitle=f"The same diagram, styled by {sheet}",
layout={"engine": "layered", "direction": "right", "rank_gap": 64, "route": "ortho"})
d.stylesheet(sheet)
with d.group("Event-driven shop", id="canvas", class_="canvas", direction="right"):
with d.group("Clients", id="clients", class_="tier"):
web = d.box("Web app", text="React", icon="terrastruct:react", class_="client")
mobile = d.box("Mobile", text="iOS, Android", icon="selfhosted:android", class_="client")
gateway = d.box("API gateway", text="auth, rate limits", icon="aws:api-gateway", class_="edge")
with d.group("Services", id="services", class_="tier"):
users = d.box("Accounts", text="Go", icon="terrastruct:go", class_="service")
orders = d.box("Orders", text="Python", icon="terrastruct:python", class_="service hero")
search = d.box("Search", text="Elasticsearch", icon="selfhosted:elasticsearch", class_="service")
with d.group("Data", id="data", class_="tier"):
db = d.box("Orders DB", text="PostgreSQL", icon="terrastruct:postgres", class_="store")
bus = d.box("Event bus", text="Kafka on MSK", icon="aws:amazon-managed-streamingfor-apache-kafka", class_="stream")
web >> gateway
mobile >> gateway
gateway >> [orders, users, search]
orders.to(db, "SQL")
orders.to(bus, "order.placed", class_="async")
bus.to(search, "reindex", class_="async")
d.add_legend({".client": "Client", ".service": "Service", ".store": "Data store", ".stream": "Event stream",
".hero": "Revenue critical",
"edge.async": "Async event"}, position="bottom")
return dStylish diagrams with CSS
One diagram, four stylesheets. The Python never changes. See how →
Midnight
Blueprint
Pastel
Editorial
Several diagram types on one slide
Architecture, flowcharts, state machines and swimlanes side by side, connected by ordinary arrows. See how →
Payments, end to end
When an alert fires
Kubernetes on Amazon EKS
Cilium, Gateway API, Karpenter, Argo CD, cert-manager and ExternalDNS at three zoom levels. See how →
The platform
Gateway API routing
GitOps delivery
Icons
Thirteen icon packs and your own files, one argument each. See how →
Architecture, behavior, networks and slides
Cloud architecture
Kubernetes, dark
Flowcharts
Swimlanes
Data center fabric
Software delivery with AI
Decision slides