C4 Model
C4 Model Diagrams
The C4 model is a hierarchical approach to software architecture diagrams, created by Simon Brown.
Zoom Levels
| Level | Name | Focus | Key Question |
|---|---|---|---|
| 1 | Context | System + environment | What does it interact with? |
| 2 | Container | Deployable units | What are the major building blocks? |
| 3 | Component | Internal structure | How is a container organized? |
| 4 | Code | Classes/functions | How is it implemented? (rarely documented) |
Diagram Guidelines
Elements
- Person: Human users or roles
- System: The software system being documented (or external systems)
- Container: Deployable/runnable unit (app, service, database)
- Component: Logical grouping within a container
Best Practices
- Title every diagram with the level and scope
- Include a legend for colors/shapes when needed
- Show relationships with labeled arrows (verb phrases)
- Keep it simple — omit what doesn’t aid understanding
Format
Diagrams are stored as Mermaid/PlantUML code blocks for:
- ✅ Version control
- ✅ Easy collaboration
- ✅ Automated rendering