What is the C4 model?
The C4 model is a simple way to bring consistency to how you and your team describe and diagram software architecture.
It was created by Simon Brown and is a set of abstractions and diagram types that help you and your team to align on technical decisions quicker.
It is essentially only 2 things:
- 1️⃣A hierarchical set of abstractions
- 2️⃣Four diagram types
The C4 model abstractions
The first part of the C4 model is a simple set of hierarchical abstractions to describe your software system and the ecosystem around it.
🧍 Person
End user who uses the systems.
Examples: Customer, admin user or employee.
🏢 System
The highest level of abstraction that delivers value to end users, whether they are human or not. Systems are often owned by a development team.
Examples: SendGrid is an external system.
📦 Container
Applications and data stores that make up a system. These are independently deployable and runnable. (Not to be confused with Docker containers)
Example: API service, front-end application or mobile app.
🧩 Component
Building blocks and modules that make up each container.
Example: Authentication module or payment card validator.
Summarised from c4model.com/#Abstractions
C4 model diagrams
The second part of the C4 model is the 4 hierarchical diagram types, each tailored for a specific audience. Each diagram type visualizes the abstractions for each of the C4 levels.
Level 1 - System context diagram
A high-level overview of how your users interact with the internal and external systems to get value.
Audience
Architects, developers, product and business. For technical and non-technical audiences.
Scope
Persons and systems.
Example
From c4model.com
Level 2 - Container diagram
A zoomed-in view of one system that shows the running containers inside it.
Audience
Architects, developers and product. For high-level technical audiences.
Scope
Persons, systems and containers.
Example
From c4model.com
Level 3 - Component diagram
A zoomed-in view of one container that shows the components making it up.
Audience
Architects and developers. For low-level technical audiences.
Scope
Persons, systems, containers and components.
Example
From c4model.com
Level 4 - Code diagram
Usually in the form of UML class diagrams that are ideally autogenerated from the actual code. This level is rarely used as it goes into too much technical detail for most teams.
Audience
Architects and developers. For low-level technical audiences.
Scope
Persons, systems, containers and components.
The C4 model website also defines three supplementary diagram types c4model.com/#SupplementaryDiagrams