C4 model
The C4 model is a lightweight, structured approach to visualize and document software architecture using a hierarchical set of diagrams. It helps bridge communication gaps by providing different levels of abstraction, like a map you can zoom in and out of.
“C4” refers to four levels of diagrams:
Context (Level 1)
Section titled “Context (Level 1)”Shows a software system as a single box in its environment:
- People (actors/roles/personas) who use the system
- External software systems it interacts with
- The system boundary (what’s in scope vs out of scope)
This view works well for both technical and non-technical stakeholders because it focuses on purpose and scope, not implementation details.
Containers (Level 2)
Section titled “Containers (Level 2)”Decomposes the system into its major building blocks (“containers”), such as:
- Web apps and mobile apps
- API services
- Databases and data stores
This view communicates the high-level internal structure and the relationships between containers.
Components (Level 3)
Section titled “Components (Level 3)”Zooms into a container to show the major components inside it: cohesive groupings of responsibilities behind clear interfaces (e.g., authentication, reporting, workflow orchestration).
This view is most useful for engineers working on (or integrating with) a specific part of the system.
Code (Level 4, optional)
Section titled “Code (Level 4, optional)”Shows the code elements that implement components (classes, functions, modules, etc). This level is often generated automatically by tools and is not always maintained manually.
Why teams use C4
Section titled “Why teams use C4”- Clear communication: a common visual language for different audiences.
- Progressive detail: readers can stop at the “zoom level” they need.
- Maintainability: diagrams can be kept close to the evolving system (“diagrams as code”).
- Onboarding: new team members can learn the architecture in layers.
References
Section titled “References”- C4 model: https://c4model.com/
- System context: https://c4model.com/diagrams/system-context
- Container: https://c4model.com/diagrams/container
- Component: https://c4model.com/diagrams/component
- Code: https://c4model.com/diagrams/code