spinagram
Examples

Cloud architecture

AWS, Google Cloud and Kubernetes diagrams whose zones nest themselves.

Use it for: design reviews, onboarding docs, the "how it works" slide.

  1. Start with the systems and the arrows between them. Leave out the groups.
  2. Add icons: icon="aws:s3", icon="gcp:cloud-run", icon="k8s:pod" (finding icons).
  3. Wrap boxes in with d.group(...) blocks, from the outside in: account, region, VPC, zone, subnet.
  4. Number the request path with step= and add d.add_legend().

Start small

examples/quickstart.py
"""Automatic layout: no coordinates. Run `python examples/quickstart.py`, or
`spinagram render examples/quickstart.py -f svg,png,pptx -o out/`."""
from spinagram import Diagram

d = Diagram("Q01", "Web app on AWS", subtitle="No coordinates, laid out automatically")

users = d.box("Users", icon="aws:users")
with d.group("us-east-1", style="aws-region", direction="right"):
    with d.group("VPC", style="aws-vpc", direction="right"):
        lb = d.box("Load balancer", icon="aws:alb")
        api = d.box("API", text="FastAPI on ECS", icon="terrastruct:python")
        with d.group():  # no style: a light "soft" zone
            db = d.box("Orders DB", text="PostgreSQL", icon="terrastruct:postgres")
            cache = d.box("Cache", text="Redis", icon="terrastruct:redis")
    s3 = d.box("Uploads", text="S3 bucket", icon="aws:s3")

users.to(lb, "HTTPS") >> api
api.to(db, "SQL")
api >> [cache, s3]

if __name__ == "__main__":
    d.save("out/", formats=["svg", "png", "pptx"])

Web app on AWS, laid out automatically

Three tiers across two zones

Subnets per tier in two Availability Zones, built with plain Python loops, with numbered steps and a legend. aws_three_tier.py

Three-tier web application on AWS

Hub-and-spoke networking

A Transit Gateway hub with centralized inspection and egress, and hybrid connectivity. aws_network_hub.py

Hub-and-spoke networking on AWS

Google Cloud

Anycast load balancing, GKE in two regions, Spanner and streaming analytics. gcp_global_app.py

Global web application on Google Cloud

Kubernetes

A dark cluster canvas built only with CSS: k8s_platform.py + k8s.css.

Anatomy of a workload

Anatomy of a workload

Ingress to pods, autoscaling, config and stateful storage.
Service networking

Service networking

Ingress to Service to pods, guarded by NetworkPolicy.

More: Python guide · Automatic layout · Annotations

On this page