When you're starting a new project it's crucial that you are able to understand quickly how the systems that you'll be working on connect to each other and the general idea behind their architecture. Then on a deeper level, you'll need to understand how the components of those systems works together.
![]() |
A code generated container diagram |
Often happens that they give you a general architecture diagram that's really neat but it doesn't tell you exactly what you need to know in order to be able to do your job.
Other times you have to implement or refactor some features that alter the way things are connected at the moment and you have to re-route them or connect to other systems.
On rare occasions, you start a brand new project in which you are responsible to define how the components of the particular software you're trying to build connects to one another.
Throughout the years I had the chance to experiment all of the aforementioned situations. In some of them I had more documentation at hand and in others... well... let's say that it had some room for improvement in that area.
At the time I was working for Southwest Airlines the diagrams (sequence, modules, etc) were made using WebSequenceDiagrams and/or Microsoft Visio. They looked really neat and everything. But there were a few problems from my point of view:
- When the diagrams were done then the cost of updating them was really high. You needed to copy the source file if it was in Visio and change them using drag & drop with the mouse. A hideous task for a software developer.
- For some additional features it was necessary to have a premium account.
- The tooling was different from the everyday one.
- It was complicated to version them.
- Collaboration was limited.
![]() |
That's me making a fool of myself... |
So when we had to design a new login feature I decided to investigate how can that be done better. I definitely was looking for a tool that you can write the code and it would create the diagrams from it (Just like WebSequenceDiagrams but with versioning and open source). That's when I found PlantUML.
By using that tool it was really easy to maintain architecture diagrams as they where evolving alongside the features or the new requirements that we need to implement. Building a sequence diagram to visualize how particular services should interact had become an enjoyable task for developers and we also had that versioned in our code repository. Even when I had to document a card it was really painless to write a few lines and render the diagram (a sequence diagram for instance) on it just with the use of your favourite IDE.
A few years later when moved to LATAM Airlines project they were using PlantUML as well but they made a huge improvement. On top of PlantUML they decided to use the C4 Model for modeling software architecture. That is exactly what I want to show you in this post.
At this point you may be willing to get your hands dirty and start writing those beautiful diagrams, don't you? Well, the wait is over!
The first thing we need to do is clone this repository so we can have all the templates for the C4 software architecture model as foundation. You may also want to take a look at the README now that you are at it 😉
git clone https://github.com/plantuml-stdlib/C4-PlantUML.git
Note: There's no need to clone the repo because you can use directly by importing the web file from your diagram files. Nonetheless I think it's a good idea to take a look at it and play around with the templates.
Let's create our own project folder to start working on it. For simplicity I will call it "diagrams". Create the folder right next to the downloaded repository one.
Now download the PlantUML executable into it by issuing the following command:
wget https://github.com/plantuml/plantuml/releases/download/v1.2021.14/plantuml-1.2021.14.jarAt this moment we can start by creating our first dummy diagram. Copy and paste the following snippet into a dummy.puml file:
Now with the following command we'll generate the awesome image file:
java -jar plantuml-1.2021.14.jar .
And after a few seconds you should see a file called "My_First_Diagram.png" in the same folder.
![]() |
Example diagram |