System Design Space
Knowledge graphSettings

Updated: April 16, 2026 at 5:55 PM

C4 Model: context, containers, components, code

medium

Practical guide to the C4 Model: abstraction levels, core and supporting diagrams, notation rules, and use in architecture communication.

C4 Model becomes useful when a team needs more than a single architecture picture. It helps explain the same system to different audiences without drowning everyone in detail, while keeping one coherent story from context down to internal structure.

In daily documentation work, its main strength is matching the diagram to the audience: context for the big picture, container for the team view, component for selective depth, and deployment for infrastructure mapping. The notation guidance and common mistakes matter just as much because that is exactly where clarity tends to fall apart.

In reviews and architecture discussions, C4 gives you a calm, repeatable way to move through abstraction levels. It helps show boundaries, major containers, and the right places for deeper dives without losing the audience in either too much detail or too much vagueness.

Practical value of this chapter

Abstraction levels

Provides a clear way to decompose architecture from context to components.

Audience fit

Helps select the right diagram level for business, architects, engineers, or ops.

Model consistency

Keeps cross-level descriptions aligned so architecture narratives stay coherent.

Interview structure

Supports a clean interview flow from context-level framing to focused deep dives.

Source

Official C4 Model site

Key principles, diagram levels, notation guidance, and examples from Simon Brown.

Open c4model.com
ContextContainerComponentCode

C4 Model is a lightweight way to explain architecture through levels of abstraction. The core idea is simple: show the system at the level of detail a specific audience actually needs instead of forcing everything into one overloaded diagram.

What the C4 Model is

The C4 Model is most useful when the same system needs to be explained to different audiences without drowning everyone in detail. It gives you a structured path from system context to containers, then to components, and only when necessary down to code.

That separation keeps boundaries, internal structure, and deployment concerns from collapsing into one conversation. In practice, it works especially well alongside UML, BPMN, and ArchiMate, because each notation answers a different kind of architectural question.

The four C4 levels

L1

System Context

One system surrounded by people and external systems.

Audience: Technical and non-technical audiences.

Recommendation for use: Yes, almost always.

L2

Container

Applications and data stores inside the system: web app, API, database, queue, and more.

Audience: Architects, developers, ops/support.

Recommendation for use: Yes, a basic level for teams.

L3

Component

Components inside the selected container.

Audience: Architects and developers.

Recommendation for use: Optional if it really adds value.

L4

Code

Code elements of a specific component (classes/interfaces/tables).

Audience: Developers.

Recommendation for use: Usually no; generate it from source when you actually need it.

Example C4 diagrams

Below are four common examples, from the outer system context down to deployment. Switch between the cards to see how the level of detail changes while the same system stays recognizable.

System context

A user, external systems, and one target platform at the L1 level.

UserWeb / MobileAppSubscription PlatformPlans + BillingNotifications + MetricsPaymentprovidercharge / refundCRMsupport eventssubscriptionstatuspaymentAPIevents

Details

Diagram guidance

Recommendations for core and supporting diagrams.

Open section

Additional diagrams

System Landscape

Map of systems at the organization/domain level.

Dynamic

A time-based interaction scenario for one specific use case.

Deployment

Placement of containers and systems across environments and infrastructure.

Notation

Notation guidelines

Practical rules for describing elements and connections.

Open section

Notation rules

Naming

Each element has a name and a short description.

Technologies

For containers and components, the technology is explicitly specified.

Connections

Connections should be directed, labeled, and clear in meaning.

Protocol

For inter-container communications, explicitly specify the protocol/technology.

Legend

Add a legend so the notation stays self-explanatory.

Tool-agnostic

C4 is not tied to a specific tool or visualization style.

A practical process for working with the C4 Model

C4 workflow steps

5 steps from system boundaries to the runtime view
Foundation
Decomposition
Runtime
01

Context

Start with the System Context to capture system boundaries and external dependencies.

02

Containers

Add the Container diagram as the main working view of the architecture.

03

Components

Draw component diagrams only for containers that are genuinely important or complex.

04

Code

Reserve the code level for truly difficult areas and generate it from source when possible.

05

Runtime and deployment

Use Dynamic and Deployment diagrams for runtime scenarios and infrastructure mapping.

Press “Start” to walk through the C4 workflow step by step.

Common mistakes

Start too deep

Jump straight into components or code before the context and container views are clear.

Blurred connections

Label connections with vague words like `uses` instead of explaining the interaction.

One poster for everything

Trying to show everything on one diagram and losing readability.

Manual L4 synchronization

Maintain L4 diagrams manually instead of generating them from source where possible.

Related chapters

  • Software architecture overview - Provides the core architecture principles that help you decide which C4 level fits each audience.
  • UML - Shows an alternative notation and helps compare when C4 is simpler and more direct for communication.
  • Decomposition strategies - Service and module boundaries from decomposition map naturally onto the C4 container and component levels.
  • BPMN - BPMN describes process flow while the C4 Model describes system structure; together they create a fuller architectural picture.
  • ArchiMate - Adds an enterprise-architecture view on top of C4 and connects business, application, and technology layers.

Enable tracking in Settings