Skip to content

C4 — Tutorial

This is the tutorial part of the C4 — Architecture Model guide. See also Short info and samples.

Choose the audience and one question about the architecture. Begin at system context level even if you know the internal technologies.

A traveler using a Booking System and an external payment service gives a system context view. It explains the scope of the software under discussion and its relationship with people and other systems. This view should remain understandable without a catalogue of controllers, database tables or deployment pods.

A container view opens the Booking System and shows major applications and data stores, such as a web application, API and database. A component view opens one container to explain meaningful internal responsibilities. These are successive questions about the same system. They are easier to read when each view stays at its chosen level.

An API can appear in an overview and in a focused view. It remains one architectural element even when the presentation changes. Named views select what the audience needs to see; they should not become unrelated copies that quietly acquire conflicting names or responsibilities. Describe relationships so the reader knows why one element uses another.

Connect another model only when the connection adds meaning. A C4 person may correspond to a USM persona, while a database container can be explained through DSM. The container and the table are different abstractions. Similarly, an architecture diagram can show that Booking uses Inventory without documenting the detailed reservation contract. Use SIM for that agreement. A clear scope, legend and relationship labels often improve an architecture explanation more than adding another level of boxes.

Zoom into one system without losing the boundary. A context diagram introduces the traveler and system; one boundary expands into containers; the same API is highlighted in a second view.

Pause and predict: Which view would you show someone who only needs to know external dependencies?

This is the text storyboard for a proposed short illustrated film. The written walkthrough and exercises are available now; a published movie will be added after its scenes, captions and model references have been reviewed.

C4 imports Structurizr workspaces — both .json and the DSL subset — via ctxbrew import structurizr <file>, plus Mermaid C4 diagrams. Outbound, the authored model renders as C4-PlantUML, a Structurizr workspace .dsl, or a Mermaid C4 diagram (the MCP export_c4_diagram tool does this inline in your agent’s workflow). The per-format toolkit applies too: ctxbrew c4 validate|export|import|stats|diff. Details: Import & Export.