c4studio
New v0.5.0: lint, diff, impact and a published site →

Architecture as code,
with a studio beside it.

c4studio reads Structurizr DSL and draws your C4 diagrams. Edit the model beside a live diagram in a local Studio, then lint, diff, render and publish it from the command line and in CI. Open source, written in Python, and nothing leaves your machine.

pipx install c4studio

Python 3.13+ · or run it with no install: uvx --from c4studio c4 webapp

The c4studio Studio showing a system landscape: people grouped into front, middle and back office inside an enterprise boundary, the trading systems they use, and the external systems below, with the file tree, view list and element tree on the left.
1

Start a model

c4 new shop.dsl --template full-c4

Four starter templates, from one box to a full container-and-component model.

2

Edit it, and see it

c4 webapp shop.dsl

The Studio opens in your browser. Type DSL on the right and the diagram redraws when you save.

3

Ship it

c4 lint shop.dsl && c4 publish shop.dsl

Check it against your standards, then publish a static site of every view and its docs.

What you get

One model. Every surface.

The same parser and the same layout code run in the Studio, the CLI, CI and the VS Code preview, so every surface draws the same diagram.

The Studio

Write the text. Watch the diagram follow.

The diagram is a preview of the DSL, never the other way round. c4studio never rewrites your source, so your comments, formatting and !include structure stay exactly as you wrote them.

  • A file tree that covers every !include fragment
  • Saving with ⌘S redraws the diagram; a file that changed on disk is never silently overwritten
  • --viewer serves the Studio read-only, enforced on the server
  • An optional assistant that proposes a diff and never writes on its own
Tour the Studio →
The Studio with the source editor open beside a container diagram of an internet banking system. The editor shows the DSL with syntax highlighting and reports no problems.

Beyond Structurizr

Standard DSL, with a few extras.

Everything c4studio adds is an ordinary Structurizr properties entry or a file beside the workspace, so your model still opens in any other Structurizr tool.

  • c4studio.autolayout sets a layout direction for each boundary and group
  • c4studio.legend and c4studio.badge control the legend and badges
  • Theme files on disk, inlined and usable offline
  • c4studio.lint.json holds your house rules
See every extension →
platform = softwareSystem "Platform" {
    properties {
        "c4studio.autolayout" "lr"
    }
    group "Backend" {
        api    = container "API"
        worker = container "Worker"
    }
}

// in views → styles
element "Database" {
    properties {
        "c4studio.badge"  "#ffcc00"
        "c4studio.legend" "Anything that stores data"
    }
}

Perspectives

Ask the diagram a question.

Hang security, ownership or cost on elements and relationships, then show one perspective over any view. Whatever carries it gets a badge with its value, everything else fades, and the legend lists the values.

How perspectives work →
The security perspective shown over a container diagram: two containers badged High, a person badged Medium, the rest faded, and a legend of the values.

In CI

Review architecture like code.

Render the diagrams on every push, post the model diff on every pull request, and publish the model to GitHub Pages on every merge. The live example on this site is published that way.

Set up CI →
- uses: actions/checkout@v7
- uses: geoffkoh/c4studio@v0.5.0
  with:
    workspace: docs/architecture.dsl
    mode: comment   # or render, commit
- run: pip install c4studio
- run: c4 lint docs/architecture.dsl

Local-first, by design.

No accounts, no server and no workspace locking. You share models through git and the files c4studio generates. The one feature that uses the network, the assistant, is off unless you turn it on.