
C4 model on legacy software: when everything is one monolith
Published: November 29, 2026
A lot of teams don't bother with the C4 model, because when they try to fit it onto their own system, it turns into a struggle to keep a single lonely software system from being all that's left on the diagram. Several teams may work on it, supposedly on different parts of the system, but the codebase is still one kneaded-together lump without sharp boundaries, so there isn't really another way to draw it. So what can you do about it? And do you need to do anything at all?
At one of my workshops, the team members were drawing exactly this kind of system. Lots and lots of systems came up, and everyone felt their own system was a separate element within the company. Yet in most cases we ended up in the same place: the bulk of the code each team was responsible for was a slice of the same monolith (and therefore the same container). No matter how they twisted and turned it, there wasn't much to be done about that. That can be really demotivating: in their earlier diagrams these were separate parts, and now it's all one big lump?
Later, when we drew things at the container level, it wasn't clear either which team owned which of the 40 containers that had suddenly appeared. That also broke the rule that a team can do anything inside its own system as long as the APIs and other contracts facing outward stay intact. The teams had to work closely together, and every small change could ripple into someone else's work, mostly because almost everything ended up in one shared database. That made it even clearer that these weren't separate systems.
This is where one of the participants asked: what's the point of all this? Why do we want to draw it? Does putting it on a diagram help their work at all?
Of course, we don't draw these diagrams so the team can be horrified by them. A diagram like this may look nothing like what we'd want, but at least it shows where the boundaries haven't been drawn. At the workshop, this is what opened a lot of people's eyes to how much work they still had ahead of them if they wanted to sort it out.
But how do you turn this into something you can actually work with? If the goal sooner or later is to break up or rewrite the monolith, it's worth starting from functional decomposition, and for that the container level is still too high. First you have to show the components: what functional units live inside the monolith, and what they do.
But how do you know what components a legacy codebase has? The package or module structure is a good starting point, but it rarely tells the truth: over the years everyone put new code wherever it was convenient at the time. The actual dependencies are worth extracting with a tool: in Java, jdeps or the IDE's dependency graph shows which package calls which. The git log tells you a lot too: if certain files almost always change in the same commit, they probably belong to the same functional unit, however far apart they sit in the directory tree. And finally, sit down with the people who work in this code every day, because they know exactly which module nobody dares to touch.
This is usually where the first surprise comes: it often turns out that the components themselves aren't well shaped either. One module is responsible for three different things, and elsewhere the same function exists in two places, just under different names. Until these are sorted out, there's not much point in staring at the dependencies between them, because you can't tell whether an arrow runs between two separate responsibilities or it's just two halves of a badly cut module talking to each other.
Components first, then dependencies, and only then the cut.
Take a webshop, for example. The order management module doesn't just handle orders: it also calculates discounts and sends out the confirmation e-mail, while the cart has its own discount calculation too, just done a bit differently. Draw it like that and you get an arrow between the cart and the orders, when the real question is who owns the discount. Until that's answered, the arrow doesn't say much either.
Once the components are in place, the dependencies come next, and that's where the diagram starts to get really interesting. You can see which component almost everyone uses, and which one only talks to a few others. Among the former there will be some you can pull out into a shared lib, because they're really just common helper code that everyone pulls in (date handling, permission checks, notifications). The latter are good candidates to live on as standalone containers sooner or later.
It may also turn out that the most obvious cut runs along the user journeys. In a web application, registration, checkout or account management could each move to their own subpages, even their own applications, each with its own components. For that, though, you need a diagram where you see all these elements together, otherwise you can only guess which journey drags which components along with it.
Sticking with the webshop: checkout drags along the cart, the discounts, payment and inventory, while account management only needs user data and permissions. That makes account management much easier to split off, even onto its own subpage, while for checkout you first have to clean up the dependencies around inventory and discounts.
The component view does have one big problem, of course: it's the hardest one to maintain, since it changes the most often. A new module, a rename, a new dependency, and the diagram is already out of date. Many people don't even start because of this, yet for planning this is exactly the view that helps the most. If you want to move a feature, this is where you see what has to move with it, which components are affected, and which teams you'll need to sit down with. If, say, you want to consolidate the discount calculation in one place, the diagram tells you that the cart, the orders and the reports all use it, so you'll have to get at least three teams around one table. It doesn't have to be up to date all the time. It's enough to refresh it before planning and use it for what it's for.
Later, once you've been through this and managed to carve out pieces that a single team actually owns, and that can therefore be treated as systems, you don't need to go this deep for those parts anymore, and you don't need to spend as much time on the diagrams either, since system context and container diagrams don't change that often.
What you do have to watch out for is that the boundaries you drew with so much effort don't get tangled up again. The diagram won't stop anyone from calling straight into another module's internal classes. That's what tools like ArchUnit are for: they let you write the rules drawn on the component view as tests:
@ArchTest
static final ArchRule cartDoesNotDependOnOrderInternals =
noClasses().that().resideInAPackage("..cart..")
.should().dependOnClassesThat().resideInAPackage("..order.internal..");
@ArchTest
static final ArchRule noCyclic =
slices().matching("..webshop.(*)..").should().beFreeOfCycles();
If someone breaks the rule, the build fails, and you don't find out six months later, at yet another workshop, that the isolation you worked so hard for is gone. That way the component view lives in the code too, not just on the wiki.
If drawing the diagram itself is what gives you a headache, I wrote about that in more detail in this post, and about what happens when the boundaries are just guessed here.
