C4 Model

Updated

The C4 Model is a framework for diagramming software architecture at four levels of abstraction: Context, Container, Component, and Code. Created by software architect Simon Brown, it addresses a common problem with architecture diagrams: a single diagram either tries to show everything (and becomes unreadable) or shows one narrow slice (and loses the bigger picture). The C4 Model solves this by producing a set of related diagrams, each zoomed to a different level of detail, similar to how a map app lets you zoom from a country view down to a street view.

The Four Levels

  1. Context: The highest-level view of your system as a single box, showing how it interacts with users and other external systems. Aimed at both technical and non-technical audiences.

  2. Container: Zooms into the system to show its major deployable pieces: applications, services, databases, and how they communicate. A container here is any separately runnable unit, not just a Docker container.

  3. Component: Zooms into a single container to show its major structural building blocks and their responsibilities and interactions.

  4. Code: The most detailed level, showing classes, interfaces, or database schemas typically generated automatically from code rather than drawn by hand, and often skipped in day-to-day documentation.

Why Teams Use the C4 Model

Most architecture diagrams age poorly because they're drawn once, at one arbitrary level of detail, and never map cleanly to the questions different audiences actually ask. A new engineer wants Context and Container; a team lead debugging a specific service wants Component; a compliance reviewer wants Context. By deliberately separating levels, C4 diagrams stay legible and are easier to keep in sync with an evolving system than a single sprawling architecture diagram trying to serve every audience at once.

How to Create C4 Diagrams

  1. Start with Context: get the big picture agreed on before drilling into any one system.

  2. Draw Container next for systems that need more detail, showing the major runtime pieces and how they talk to each other.

  3. Only go to Component level for complex containers that actually need the extra detail; not every container warrants one.

  4. Keep notation consistent across diagrams (shapes, colors, relationship arrows) so viewers can move between levels without relearning the visual language.

  5. Version and update diagrams as the architecture changes, since a stale C4 diagram is worse than no diagram at all.

C4 diagrams for cloud-based systems are commonly built directly from provider-specific templates. MockFlow's AWS and Azure architecture diagram generators, along with the general cloud architecture generator, give teams a fast starting point for Container-level diagrams, which pairs well with the broader guidance on what architectural diagramming actually involves and a roundup of architecture diagram tools.

MockFlow

Turn ideas into plans on one board.

No account needed
mockflow.com/new

Open a blank board in one click. Boards last 24 hours, so sign up to keep one.

MCPBrainstorm with MockFlow MCP

Add MockFlow as an MCP connector in Claude, Cursor, or any MCP-compatible AI assistant to generate flowcharts, mindmaps, architecture diagrams, and 16 types of visualizations.

Desktop App MCP Powerful
CLI Web MCP Developer
Web MCP Easiest

Built into the MockFlow Desktop App. AI creates visuals directly on your open canvas — no URLs, no waiting.

1
Open Desktop App → open a MockFlow project
2
In Claude Code / Cursor, run:
claude mcp add --transport http -s user mockflow-ideaboard http://localhost:21193/mcp
3
Ask: "Create a flowchart for..."

Best for: Designers, product teams, daily MockFlow users.

Download Desktop App →

Install from npm, log in via browser (OAuth), and boards are saved to your MockFlow account.

1
npm install -g @mockflow/ideaboard-mcp
2
mockflow-ideaboard-mcp login
3
mockflow-ideaboard-mcp

Best for: Developers using Claude Code, Cursor, or VS Code Copilot.

npm Package →

Add MockFlow as a connector in Claude.ai or ChatGPT. No installation. A new board is created and you get a shareable URL.

1
Open Claude.ai → Settings → Connectors
2
Paste this URL, then click Connect and sign in to MockFlow: https://app.mockflow.com/ideaboard/connector/mcp
3
Ask Claude to create a flowchart — done!

ChatGPT: use https://app.mockflow.com/ideaboard/mcp and save its boards to your account to keep them

Best for: Managers, marketers, anyone using Claude.ai or ChatGPT in the browser.

Welcome back
Don't have an account? Sign up

Faster ways in

Sign in with an account you already use.