Free tech learning for everyone, from basics to pro

Enterprise ArchitectureSystems ArchitectureIntermediate

Documenting architecture: the C4 model and architecture decision records

In short: The C4 model describes a system at four zoom levels: context, containers, components and code. It keeps diagrams consistent and understandable. Architecture decision records (ADRs) are short documents that capture why each important choice was made, so future teams do not have to guess.

The problem with architecture diagrams

Many diagrams mix everything: users, servers, code modules and network links in one tangle of boxes and arrows with no key. Readers cannot tell what a box means or what an arrow does. The C4 model, created by Simon Brown, fixes this with a small set of abstractions and four levels of zoom. It is notation-independent: you can draw it on a whiteboard, in a diagram tool, or generate it from text with tools such as Structurizr or PlantUML.

The four levels

The four C4 levels1. System contextsystem, users, neighbours2. Containersapps, databases, services3. Componentsparts inside a container4. Codeclasses (optional)
Figure 1. C4 zooms in step by step, like a map moving from country to street level.
LevelShowsAudience
System contextYour system as one box, the people who use it and the other systems it talks toEveryone, including non-technical staff
ContainerSeparately deployable or running units: web app, API, database, message queueDevelopers, operations, security
ComponentMajor building blocks inside one container and their responsibilitiesDevelopers working on that container
CodeClasses or functions; usually generated by tools if needed at allDevelopers

In C4, a "container" means any running unit, not only a Docker container. A deployment diagram can be added to show where containers run: which servers, cloud services, network zones and regions. For network and security engineers this view is often the most useful, as it shows trust boundaries and which flows cross firewalls.

Drawing good C4 diagrams

  • Give every diagram a title and a key explaining shapes, colours and line styles.
  • Label each box with name, type and a short responsibility, for example "Orders API, .NET, handles order requests".
  • Label every arrow with what flows and how, for example "Reads customer data, HTTPS/JSON".
  • Keep each diagram to roughly 20 boxes or fewer; split it if it grows.
  • Store diagram source next to the code so it changes with it ("diagrams as code").

Architecture decision records

Diagrams show what exists; they rarely explain why. An architecture decision record (ADR) is a short text file that captures one significant decision. The format popularised by Michael Nygard is widely copied:

# ADR 0007: Use managed PostgreSQL for the orders database

Status: Accepted (2026-03-14)

Context:
  The orders service needs a relational database with point-in-time
  recovery. The team has strong PostgreSQL skills but no DBA.

Decision:
  Use the cloud provider's managed PostgreSQL service in two zones.

Consequences:
  + Backups, patching and failover are handled by the provider.
  - Some extensions are unavailable; costs rise with storage.
  - Ties the service more closely to one cloud provider.
Lifecycle of an ADRProposeddraft decisionDiscussedteam reviewAcceptednow the ruleSupersededreplaced later
Figure 2. ADRs are never edited after acceptance; a new ADR supersedes an old one.

Keep ADRs numbered in a folder in the repository. Once accepted, do not rewrite them; write a new ADR that supersedes the old one. Over time this becomes a readable history of the system's design, which is invaluable for new team members, auditors and incident reviews.

Tip: record decisions that are hard to reverse or that people will question later, such as choice of database, identity provider, network segmentation or hosting region. Skip trivial ones.

Practice

In the C4 model, what does a "container" mean?
Any separately running or deployable unit, such as a web application, API, database or queue; not only a Docker container.
Which C4 diagram would you show a business manager?
The system context diagram, which shows the system, its users and connected systems without technical detail.
Why should an accepted ADR not be edited?
It is a historical record of a decision and its reasons; changes are captured by a new ADR that supersedes it, preserving the history.

Key takeaways

  • C4 has four zoom levels: context, containers, components and code.
  • Every diagram needs a title, a key and labelled boxes and arrows.
  • Add deployment diagrams to show hosting, zones and trust boundaries.
  • ADRs record context, decision and consequences for significant choices.
  • Store diagrams and ADRs with the code and supersede rather than edit.
Tracks your learning on this device only. See your progress on the learning paths.

About the author

Mohamed Fayas

Founder of FM TecHub. CCNA certified, with a BTEC HND in Network Engineering, and BEng (Hons) in Computer Networking and Cloud Security. He writes practical, plain-English guides on networking, security and cloud.

More about the author

Original content written by Mohamed Fayas for FM TecHub. © 2026 FM TecHub. You're welcome to share a link to this page; please don't copy the text elsewhere without permission.

Stay up to date by email

New notes, tools and security news from FM TecHub, explained simply. Free.

We only use your email to send these updates. See our privacy policy.