SA-201c · Module 2

The C4 Model

4 min read

The C4 model is a hierarchical approach to architecture diagramming that solves the "one diagram tries to show everything" problem. Instead of a single diagram that is simultaneously too detailed for executives and too abstract for engineers, C4 provides four levels of zoom — context, containers, components, and code — each serving a different audience at a different abstraction level.

  1. Level 1: System Context The highest zoom level. Shows the system as a single box surrounded by the users and external systems it interacts with. No internal detail. The audience is non-technical stakeholders who need to understand what the system connects to. One box, the actors, and the relationships. This diagram takes five minutes to draw and answers the question: "what does this system interact with?"
  2. Level 2: Container Zoom into the system box. Show the major deployable units: web applications, APIs, databases, message queues, file storage. Each container is a separately deployable artifact. The audience is technical decision-makers and architects. The container diagram answers: "what are the major technical building blocks?"
  3. Level 3: Component Zoom into a single container. Show the major structural elements within it: controllers, services, repositories, modules. The audience is the development team working on that container. The component diagram answers: "how is this container organized internally?"
  4. Level 4: Code Zoom into a single component. Show the classes, interfaces, and relationships at the code level. This level is typically generated from code rather than hand-drawn, and it is used sparingly — only for complex components where the code-level structure is non-obvious. Most teams stop at Level 3.