C4 Model - eforte/architecture GitHub Wiki

C4 Model

The C4 model is an alternative to documenting software architectures that overcomes the drawbacks of traditional software engineering documentation in terms of lack of clarity, target audiences, incremental information, UML complexity and abandoning and lack of standardization. It is also an appropriate approach to document software when it is produced following Agile methodologies. The C4 model describes software architecture, both during up-front design sessions and when retrospectively documenting an existing codebase. It's a way to create maps of your code, at various levels of detail, in the same way you would use something like Google Maps to zoom in and out of an area you are interested in. The C4 model progressive zoom in diagrams include the following:

  • Context
  • Container
  • Component
  • Code
Context
Shows software systems as a box.
Shows how software systems fits with the other softwares systems and people that it interacts with .
Use different colors to distinguish existing vs new software systems.
Container
Not Docker containers.
Zooms into the software systems and shows its modules along with a concise description of their responsibility.
Shows applications, data stores, microservices.
Shows technology decisions.
Component
Zooms into the containers to show what is inside.
Component is a grouping of related functionality encapsulated behind a well-defined interface. They map to the abstractions that for the solution.
In C4 components are not individually deployable.
Code
Zooms into the individual component to show how it implemented.
Shows UML class diagram of the component.

Additional diagrams:

Landscape
Shows the software systems in their context representation including its interactions as well as the entire enterprise scope of software systems and personas.
Dynamic
Shows how elements (containers and components) collaborate at run time to implement use cases or features.
Based on UML communication (aka collaboration) diagram.
Deployment
shows how containers are mapped to the deployment nodes. The deployment nodes are the underlying infrastructure: physical (server, device), virtual (IaaS, PaaS, VMs), containerized (docker, kubernetes).
based on UML deployment diagrams but simplified.

Learn more at:

https://www.infoq.com/articles/C4-architecture-model

https://c4model.com/