Archflow
Guides

Building a C4 Diagram

Step-by-step guide to creating C4 model architecture diagrams

This guide walks you through creating a complete C4 model diagram set in Archflow, from a high-level context view down to component details.

What is the C4 Model?

The C4 model is a set of four diagram types for visualizing software architecture at different levels of abstraction:

  1. Context --- How your system fits in the world
  2. Container --- The high-level technical building blocks
  3. Component --- The internals of each container
  4. Code --- (Optional) Class-level detail

Archflow supports the first three levels natively through its system hierarchy.

Example: E-Commerce Platform

Let's model an e-commerce platform step by step.

Level 1: System Context

Start by identifying the main actors and external systems.

Create these systems on the Systems page (click Add Element for each):

SystemTypeDescription
CustomerPersonBrowses products and places orders
E-Commerce PlatformSoftware SystemOur main application
Payment ProviderSoftware SystemProcesses credit card payments (external)
Email ServiceSoftware SystemSends transactional emails (external)
Shipping APISoftware SystemManages delivery logistics (external)

Create these connections from the Connections page or directly on the canvas by dragging between system handles:

FromToDescriptionTechnology
CustomerE-Commerce PlatformBrowses and purchasesHTTPS
E-Commerce PlatformPayment ProviderProcesses paymentsREST/HTTPS
E-Commerce PlatformEmail ServiceSends order confirmationsSMTP
E-Commerce PlatformShipping APICreates shipmentsREST/HTTPS

Create a diagram view: Navigate to Views, click Create Diagram, and name it "System Context". Open the Editor tab, then click Add to View to place all these systems on the canvas. Arrange the Customer at the top, your platform in the center, and external systems around it.

Level 2: Container Diagram

Now zoom into the E-Commerce Platform. On the Systems page, click Add Element and create these systems with "E-Commerce Platform" as the parent:

ContainerTypeTechnologyDescription
Web ApplicationContainerReact, Next.jsCustomer-facing storefront
API ServerContainerNode.js, ExpressBackend business logic
DatabaseContainerPostgreSQLStores products, orders, users
Search IndexContainerElasticsearchProduct search and filtering
Message QueueContainerRabbitMQAsync processing

Add connections between containers (from the canvas or Connections page):

FromToDescriptionTechnology
Web ApplicationAPI ServerAPI callsREST/HTTPS
API ServerDatabaseReads/writes dataPrisma/SQL
API ServerSearch IndexIndexes productsREST
API ServerMessage QueuePublishes eventsAMQP
Web ApplicationSearch IndexSearch queriesREST

Create a diagram view called "Container View" and add these internal containers using the Editor canvas.

Level 3: Component Diagram

Pick one container to decompose further. Let's detail the API Server by creating these as children of "API Server" on the Systems page:

ComponentTypeDescription
Auth ControllerComponentHandles authentication and authorization
Product ControllerComponentProduct CRUD operations
Order ControllerComponentOrder management
Payment ServiceComponentPayment processing integration
Notification ServiceComponentEmail and push notifications

Create a "API Components" diagram view to visualize these components and their interactions.

Layout Tips

  • Context diagrams: Place your system in the center, users on top, external systems around the edges
  • Container diagrams: Arrange by data flow, typically left-to-right or top-to-bottom
  • Component diagrams: Group related components together
  • Use descriptions: Every system and connection should have a description --- this improves AI documentation quality
  • Be consistent: Use the same terminology across all diagram levels
  • Use Archie: Ask the AI assistant for suggestions on system organization

Next Steps

Once your C4 diagrams are complete:

On this page