June 21, 2021

What is a C4 Model? How to Make C4 Software Architecture Diagrams

Diagrams for Software Engineering
Software Development
Back to top

What is C4 Modeling?

A C4 Model describes or defines software architecture at different levels of detail. A C4 Model is a set of diagrams representing the context, containers, components, and code of a piece of software. The hierarchy of these diagrams allows different audiences to understand the software architecture at the level of detail they need.

You can use a C4 model for microservices, to show how you’re planning to build a system, to describe an existing system, or visualize your enterprise cloud strategy. C4 diagrams are an alternative, simplified framework compared to UML diagrams and can describe multiple systems, unlike more specific AWS architecture diagrams, GCP architecture diagrams, or Azure architecture diagrams.

The C4 Model was created by Software Architecture for Developers author, Simon Brown.

To diagram key structures and processes directly alongside your software architecture documentation, you can sign up for a free trial of Gliffy for Confluence today.

Back to top

Four Levels of C4 Models

There are four types of C4 models, each one for a different audience and containing a different level of detail. These are the context, container, components, and code diagrams that make up your C4 model.

Level 1: Context Diagrams

Context diagrams are the most general description of what your system does, who will use it, and what other systems it will interact with. A context diagram will help you describe the scope of your project and help you pinpoint who the user is and what problem you’re going to solve.

Level 2: Container Diagrams

The container diagram takes the first step into describing the software system and shows the APIs, applications, databases, and microservices that the system will use. Each of these applications or services is represented with a container and the interactions between them are shown at a high level.

Level 3: Component Diagrams

One step deeper than the container diagram, the component diagram details groups of code within a single container. These components represent abstractions of your codebase.

This diagram type is comparable to a UML component diagram, but follows a less-strict set of “rules” in order to create the software architecture diagram.

Level 4: Representing Code with Class Diagrams

The last level requires lots of detail to show how the code of a single component is actually implemented. To do this, you would want to make a UML class diagram or entity relationship diagram that describes the component.

Representing Software with All Four Levels

Depending on your project and the containers or components you need to describe, you’ll end up having a set of four or more diagrams that represent your C4 model. If you make a C4 model in Gliffy, you can use links directly on shapes in your diagrams to allow users to double-click into deeper levels of your model.

Back to top

How to Make a C4 Model with Gliffy

Step 1: Drag & Drop Shapes for the Context Diagram

In Gliffy, you’ll open a new diagram and use basic shapes to build your C4 Model. Drag and drop the shapes that represent your software system, including your user or persona and any software systems connected to the one you’re diagramming. As you drag and drop shapes, type to add text that labels or describes the components in your diagram.

Each shape in C4 Models usually includes:

  • The name of an element in your diagram
  • A brief description of the role of a system, database, component, or container
  • The type of technology you’re describing (ie: JSON component, XML component)
  • Arrows with descriptions that describe how elements interact with one another
Step 1 for making a C4 Model
Back to top

Make a C4 Model with Gliffy

For basic C4 modeling, you can use Gliffy to describe your architecture. Gliffy also supports drawing and diagramming for other types of architecture diagrams or software engineering diagrams, like  UML diagramsEntity-Relationship diagrams, and cloud architecture diagrams.

If you haven’t yet, be sure to sign up for a free trial to try it yourself.

TRY GLIFFY FOR CONFLUENCE  TRY GLIFFY ONLINE

 

Back to top