Top 7 diagrams as code tools for software architecture
Tags: architecture, tooling, diagrams
Published: 2023-02-09 18:06:14

## ⚡ Tl;dr

- Software architecture tools can be categorized into three groups, modelling tools, diagrams as code and diagramming tools.
- Diagrams as code tools are suited for long-term documentation as they can be checked into source control with version history.

## 🚀 Let’s kick-off

Diagramming software architecture provides several benefits to how we communicate complexity. Clear system designs give engineering teams an enhanced understanding of the architecture and plan for future development whilst identifying potential issues.

Diagrams as code involve writing your model objects, relationships and diagrams using a markup language which can be checked into source control. These tools often include auto-layout capabilities for automatically drawing diagrams.

## 1️⃣ Structurizr

[Structurizr](https://structurizr.com) builds upon "diagrams as code", allowing you to create multiple diagrams from a single model using a number of tools and programming languages.

Free and open source with a paid web platform.

Best for technical people who want to use the C4 model with a DSL and check it into source control.

It includes features such as:
- [Apache License 2.0](https://choosealicense.com/licenses/apache-2.0)
- Diagrams as code to draw diagrams using the Structurizr DSL.
- Stored in source control to be where the engineering team is.
- Designed to support C4 Model.
- Architectural Decision Records in a documentation tool.

![Structurizr screenshot!](https://assets.icepanel.io/blog/top-7-diagrams-as-code-tools-for-software-architecture/structurizr.png "Structurizr screenshot")

## 2️⃣ PlantUML

[PlantUML](https://plantuml.com) is a tool that allows you to write diagrams such as sequence, object, component, usecase, class diagrams and more.

Free and open source.

Best for technical people who want the flexibility of creating many different diagram types and checking them into source control.

It includes features such as:
- [GPL 3.0 license](https://choosealicense.com/licenses/gpl-3.0)
- Sequence, use-case, class, object and activity diagrams.
- Component and deployment diagrams.
- C4 model plugin.
- Many more types of diagrams.

## 3️⃣ Terrastruct

[D2](https://d2lang.com) from [Terrastruct](https://terrastruct.com) is a diagram scripting language that turns text into diagrams.

Free and open source with a paid web platform.

Best for developers who want to create flexible diagrams in code with auto-layout functionality.

It includes features such as:
- [MPL 2.0 license](https://choosealicense.com/licenses/mpl-2.0)
- TALA automatic layout engine.
- SQL tables, classes and sequence diagrams.
- Sketch-drawn diagram mode.
- Interactive tooltip and links.

![Terrastruct screenshot!](https://assets.icepanel.io/blog/top-7-diagrams-as-code-tools-for-software-architecture/terrastruct.png "Terrastruct screenshot")

## 4️⃣ Mermaid

[Mermaid.js](https://mermaid.js.org) is an easy-to-use JavaScript-based diagramming and charting tool.

Free and open source.

Best for developers who want quickly create a range of diagram types and use GitHub to consume them.

It includes features such as:
- [MIT license](https://choosealicense.com/licenses/mit)
- Flowchart, sequence, class, state and entity relationship diagrams.
- User journey, Gantt and requirement diagrams.
- Mindmaps and pie charts.
- Native render preview on GitHub.

![Mermaid screenshot!](https://assets.icepanel.io/blog/top-7-diagrams-as-code-tools-for-software-architecture/mermaid.png "Mermaid screenshot")

## 5️⃣ Ilograph

[Ilograph](https://www.ilograph.com) allows interactive diagrams to be drawn using YAML with auto layout, changing the view when you want to see different perspectives.

Free and paid.

Best for semi-technical people who want a web-based solution for visualizing diagrams written as code.

It includes features such as:
- Side-by-side code editing 
- Auto layout of diagram objects
- Dynamic layout to change diagrams depending on perspective
- Diagram sequences to show use cases within diagrams

![Ilograph screenshot!](https://assets.icepanel.io/blog/top-7-diagrams-as-code-tools-for-software-architecture/ilograph.png "Ilograph screenshot")

## 6️⃣ Diagrams

[Diagrams](https://diagrams.mingrammer.com) allow you to draw cloud system architectures using Python code.

Free and open source.

Best for developers who want to draw diagrams using popular cloud provider icons and styles quickly.

It includes features such as:
- [MIT license](https://choosealicense.com/licenses/mit)
- AWS, Azure, GCP, OpenStack, K8S and DigitalOcean icons.
- Automatic layout engine.
- Generic technology and programming-related icons.
- Use custom local icons.

![Diagrams screenshot!](https://assets.icepanel.io/blog/top-7-diagrams-as-code-tools-for-software-architecture/diagrams.png "Diagrams screenshot")

## 7️⃣ Graphviz
Graphviz is a graph visualization software for representing structural information as diagrams.

Free and open source.

Best for developers trying to visualize large and complex graph-based information from code.

It includes features such as:
- [CPL 1.0 license](https://opensource.org/licenses/cpl1.0.php)
- Custom shapes and line styles.
- Hyperlinks.
- Style, colour and font customization.
- Automatic layout engine.

## 🏁 To wrap up

There are many diagrams as code tools to choose from, and it’s important to consider which is best suited for your use case.

Some key things to consider.
- Open source license and team maintaining the project.
- Support for standards and diagram types you wish to use.
- Access and learning curve for those who need to use the tool.

Stay chill 🧊