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
Start a model
c4 new shop.dsl --template full-c4
Four starter templates, from one box to a full container-and-component model.
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.
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.
A Studio for the DSL
CodeMirror editor with highlighting, autocomplete from your own identifiers, diagnostics as you type, and conflict-safe saves.
Diagrams you can arrange
Drag, align, re-route lines like a whiteboard connector, and keep named layouts per view. Arrangement is saved beside the model, never in it.
Perspectives and impact
Show security, ownership or cost over any diagram, or ask what else is involved when one element changes.
Model standards in CI
c4 lint catches orphans, missing descriptions, duplicate relationships and styles that match nothing, and its exit code gates the build.
Architecture diffs on PRs
c4 diff reports what changed between two git revisions, and which views a reviewer has to look at again.
Publish a site
One self-contained page per view, with your !docs and ADRs beside them. Works from file:// or any static host.
Headless SVG
c4 render draws standalone SVGs with titles, legends and embedded theme icons, for docs-as-code pipelines.
VS Code preview
Highlighting, problems as you type, and one view drawn beside your editor, with no server to run.
Structurizr compatible
Reads the Structurizr DSL and workspace JSON, and round-trips JSON with structurizr.com and Lite. Unsupported constructs are skipped and reported, never executed.
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
!includefragment - Saving with ⌘S redraws the diagram; a file that changed on disk is never silently overwritten
--viewerserves the Studio read-only, enforced on the server- An optional assistant that proposes a diff and never writes on its own
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.autolayoutsets a layout direction for each boundary and groupc4studio.legendandc4studio.badgecontrol the legend and badges- Theme files on disk, inlined and usable offline
c4studio.lint.jsonholds your house rules
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 →
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.dslLocal-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.