Bookmarks

C4 model

An approach to describing the architecture of a software system: the system is shown at four levels of detail — context, containers, components and code.

Also: C4 model

checked 8 Nov

All terms

The idea of the C4 model is to show architecture as maps at different zoom levels, as in geography: from a “bird’s-eye view” down to a single class. Readers choose their own depth: the context diagram is enough for management, while developers need containers and components. The model is named after four levels whose English names start with C: context, containers, components, code.

Four levels

LevelWhat it shows
Contextthe system as a single box in the centre, surrounded by users and external systems; no technologies or protocols, so the diagram can be shown to non-technical readers
Containersapplications and data stores inside the system: a web application, a mobile application, a database; who is responsible for what, which technologies are chosen, how the containers communicate
Componentsparts inside a single container with their responsibilities and technologies; drawn only when the diagram is genuinely needed
Codehow a component is structured in code: a UML class diagram or an entity diagram; an optional level, usually generated by the development environment

A container here is not a Docker container but any application or data store: a server-side application, a single-page interface, a mobile application, a database, a bucket in object storage. Supplementary diagrams sit alongside the four levels: a dynamic diagram shows how elements interact in a single scenario, a deployment diagram shows on which servers and in which environments the instances run, and a landscape diagram shows how several systems of an organisation are connected.

How it is applied

  • a new team, a customer or a talk audience is introduced to the system with the context diagram, then the containers diagram — these are usually drawn first
  • the model shows the static structure of the system; it does not cover business processes, workflows, data models or states — these are supplemented with other diagrams
  • a large diagram is split into several simple ones, each telling its own part of the story at a single level of detail
  • the notation is free: the model is tied to neither a notation nor a tool; strict notations such as UML are added alongside when they are needed

The model was proposed by Simon Brown: the roots of the approach go back to 2006–2009, the level names settled by 2010, and the name “C4” was first used in 2011. The author maintains a description of the model, diagram rules and examples on a separate site, freely available.

Sources

the term is written from these pages

Verified 8 Nov

Not to be confused with

what it is mixed up with and how it differs

  • UMLUML modelling language

    UML is a formal language with a precise diagram notation; the C4 model sets the levels of detail and leaves the notation to the team’s choice.

  • arc42 template

    arc42 is a template for an architecture document with ready-made sections; C4 model diagrams are usually embedded into these sections.

In depth in the references

where the topic is covered in detail