C4 Model

C4 Model Diagrams

The C4 model is a hierarchical approach to software architecture diagrams, created by Simon Brown.

Zoom Levels

LevelNameFocusKey Question
1ContextSystem + environmentWhat does it interact with?
2ContainerDeployable unitsWhat are the major building blocks?
3ComponentInternal structureHow is a container organized?
4CodeClasses/functionsHow 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

  1. Title every diagram with the level and scope
  2. Include a legend for colors/shapes when needed
  3. Show relationships with labeled arrows (verb phrases)
  4. 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