Guide
The C4 model, explained by people who draw them
C4 describes software architecture at four levels of zoom — system context, containers, components and code. It is a small notation with a big payoff: everyone in the room finally agrees on what a box means.
What the C4 model actually is
C4 is a way of describing the static structure of a software system using four nested levels of detail, created by Simon Brown. It is not a tool, a file format or a standard body — it is an agreement about abstraction. Each level answers one question for one audience, and every box on a diagram is one of four things: a person, a software system, a container, or a component.
That constraint is the whole point. Most architecture diagrams fail not because they are ugly but because a single picture mixes a business capability, a Kubernetes pod, a Java class and a third-party SaaS, all drawn as identical rectangles. C4 forbids that mixing by giving each abstraction its own level.
The four levels
Think of it as zooming a map: country, city, district, street. You do not draw all four for every system — you draw down to the level where the reader stops asking questions.
- Level 1 — System Context — Your system as a single box, the people who use it, and the other systems it talks to. The diagram a non-technical stakeholder can read.
- Level 2 — Container — The separately runnable or deployable things inside your system: a web app, an API, a database, a worker, a mobile app. The most useful diagram most teams never draw.
- Level 3 — Component — The major building blocks inside one container, and their responsibilities. Drawn per container, only where the container is complicated enough to warrant it.
- Level 4 — Code — Classes, interfaces and their relationships inside one component. Almost always better generated from the source than hand-drawn.
A "container" is not a Docker container
This is the single most common misreading of C4, and it predates Docker. In C4 a container is a separately runnable or deployable unit that executes code or stores data — an application, an API process, a database, a file system, a shell script that runs on a schedule.
A container may happen to ship as a Docker image, or ten containers may share one image, or one container may run as three replicas. Deployment is a different concern; C4 has a separate deployment diagram for it. If your Level 2 diagram is drawing pods and nodes, you have drawn infrastructure and called it architecture.
Rule of thumb
If it can be started, stopped, or deployed on its own — and losing it takes a capability with it — it is a container.
Notation: deliberately boring
C4 is notation-independent. There is no required shape language, no UML compliance, no stereotype vocabulary to learn. The convention that makes diagrams readable is simply that every element carries its name, its type, the technology it is built with, and a one-line description, and that every arrow is labelled with what actually flows and how.
An unlabelled arrow is the most expensive thing on an architecture diagram. "SPA → API" tells a reader nothing; "SPA → API: submits payment requests, JSON/HTTPS" tells them what breaks when the arrow breaks.
- Every box — Name · type · technology · one line of description.
- Every arrow — What it does, in which direction, over what protocol.
- Every diagram — A title, a scope, and a legend if you used colour to mean something.
How to start on a system you already have
- Name the system and its boundary in one sentence. If you cannot, the boundary is the problem, not the diagram.
- Draw the System Context: users, the system, everything external it depends on. Twenty minutes, on a whiteboard, out loud with two colleagues.
- Draw the Container diagram from deployment reality — what is actually running in production, not what the wiki says.
- Stop. Ship those two. They already cover most of what a new joiner or an incident responder needs.
- Add a Component diagram only for the one or two containers people repeatedly get lost in.
- Attach the prose. A diagram that cannot say why a decision was made is a picture, not documentation.
The hard part is not drawing them
Every team can produce a good C4 set in an afternoon. The failure mode arrives six months later, when the diagram is in a slide deck, the reasoning is in a wiki nobody edits, the sequence diagrams are in a third tool, and the API contract is in a fourth. Nothing is wrong individually; collectively, no one trusts any of it.
The fix is structural, not motivational: keep the explanation attached to the element it explains, so that opening the box opens the documentation. That is the idea Viaduct is built around — the model is the index for everything else the team knows about the system.
Frequently asked
Do I need all four C4 levels?
No. Most teams get almost all of the value from Level 1 and Level 2. Draw a Component diagram only for containers that are genuinely hard to reason about, and generate Code-level diagrams on demand rather than maintaining them.
Is C4 a replacement for UML?
No. C4 is an abstraction hierarchy, not a notation. It tells you what the boxes mean; you can render them in UML, in PlantUML, in Mermaid, in a drawing tool, or in a dedicated modelling tool. Many teams use C4 for structure and keep UML sequence diagrams for behaviour.
How often should C4 diagrams be updated?
System Context changes rarely — a few times a year. Container diagrams should change whenever something new is deployed or retired, which in practice means they belong next to the code and the review, not in a slide deck.
What is the difference between a container and a component?
A container runs on its own and can be deployed independently. A component lives inside a container, in the same process, and cannot be deployed by itself. A payments API is a container; the fraud-check module inside it is a component.
The guide
Every page in the guide
Eight short pages covering the four levels, the notation, the comparisons people ask about, and the tooling decisions that only hurt six months in.
Level 1
The System Context diagram
One box for your system, the people who use it, and the systems it depends on. It is the only architecture diagram that a product manager, a security reviewer and a new engineer can all read on their first day.
Level 2
The Container diagram
The separately deployable pieces inside your system and the technology each one is built with. If a team draws only one architecture diagram, this is the one that earns its keep.
Level 3
The Component diagram
The major building blocks inside one container, what each is responsible for, and how they collaborate. Drawn per container, and only for the containers that are genuinely hard.
Level 4
The Code diagram
Classes, interfaces and their relationships inside a single component. The level almost everybody draws first and almost nobody should maintain by hand.
Comparison
C4 vs UML, ArchiMate and "boxes and lines"
C4 is not competing with UML — it is solving a different problem. Knowing which problem each one solves is what stops an architecture review turning into a notation argument.
Comparison
C4 and arc42
These two get compared as if you had to pick one. You do not: arc42 is the shape of the document, C4 is what goes in the picture. Teams that understand that use both and stop arguing.
Comparison
Structurizr, and when to use something else
Structurizr is the reference implementation of C4, written by the person who invented C4. That is a real argument in its favour and worth saying before any comparison starts.
Practice
C4 with PlantUML: diagrams as text
Text-based diagrams review like code, diff like code and survive like code. Here is how PlantUML fits a C4 model — and where writing everything by hand stops paying.
Comparison
C4 tools compared
Drawing tools, diagrams-as-code and modelling tools solve different halves of the problem. The right choice depends on whether you are producing pictures or maintaining a model — and on whether the model has to stay on your own machine.
See it as a model rather than a picture
Viaduct puts all four levels in one navigable model with the documentation attached. It runs locally in the browser — no account needed.
