System Design Space
Knowledge graphSettings

Updated: March 24, 2026 at 12:33 PM

C4 Model: context, containers, components, code

medium

Practical guide to the C4 Model based on the official website: 4 levels of diagrams, notation and workflow modeling.

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 website of C4 Model

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

Open c4model.com
ContextContainerComponentCode

C4 Model — a developer-friendly approach, where the architecture is broken down into levels of abstraction. The main idea: to show the system at the right level of approximation for a specific audience, and not to explain everything with one overloaded diagram.

4 levels C4

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 storage within the system (web app, API, DB, queue, etc).

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: Probably not; It's better to generate from tooling on request.

Examples of C4 diagrams

Examples in the format from the UML chapter: select a diagram type and see the corresponding visualization.

Context Example

User, external systems and one target platform on L1.

UserWeb / MobileSubscription PlatformPlans + BillingNotifications + MetricsPayment PSPcharge / refundCRMsupport eventsgetSubscriptionStatepayment APIevents

Details

Diagrams

Recommendations for core and supporting diagrams.

Open section

Supporting charts

System Landscape

Map of systems at the organization/domain level.

Dynamic

Scenario of interactions over time for a specific use case.

Deployment

Placement of containers and systems by environment (prod/stage/dev).

Notation

Notation Guidelines

Practical rules for describing elements and connections.

Open section

Notation checklist

Naming

Each element has a name and a short description.

Technologies

For containers and components, the technology is explicitly specified.

Connections

Directed connections, with a signature and clear intent.

Protocol

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

Legend

Add legend/key to make the notation self-documenting.

Tool-agnostic

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

Practical workflow

Шаги C4 workflow

5 этапов от границ системы до runtime-представления
Foundation
Decomposition
Runtime
01

Контекст

Начинайте с System Context, чтобы зафиксировать границы и внешние зависимости.

02

Контейнеры

Добавляйте Container диаграмму как основной рабочий слой архитектуры.

03

Компоненты

Компоненты рисуйте только для важных/сложных контейнеров.

04

Код

Code-уровень оставляйте для сложных мест и генерируйте из кода.

05

Runtime + Infra

Для сценариев и среды развертывания используйте Dynamic и Deployment.

Нажмите «Запуск», чтобы пройти workflow C4 пошагово.

Common mistakes

Start too deep

Immediately start with component/code without context/container.

Blurred connections

Sign connections with general words like `uses` without specifics.

One poster for everything

Trying to show everything on one diagram and losing readability.

Manual L4 synchronization

Store code diagrams manually without auto-updating from sources.

Related chapters

  • Software architecture overview - Sets the core architecture principles that define which C4 level to use for each audience.
  • UML - Provides an alternative notation so you can compare when C4 gives a clearer communication model.
  • Decomposition strategies - Service and module boundaries from decomposition map directly into C4 Container and Component levels.
  • BPMN - BPMN models process flow while C4 models system structure; together they form a complete design view.
  • ArchiMate - Extends C4 with an enterprise-level view linking business, application, and technology layers.

Enable tracking in Settings