Quick Start: Want to create professional software architecture diagrams fast? Structurizr examples show you how to build C4 model diagrams, system context views, and container diagrams with practical, real-world examples.
- What is Structurizr?
- What are the use cases for Structurizr?
- How do I create diagrams with Structurizr?
- How do I use the Structurizr CLI?
- Where do I learn more about Structurizr?
Structurizr Tutorial: Understanding the Basics
[Structurizr] is a diagram generation tool created by Simon Brown, the creator of the C4 Model. The tool’s primary focus is the rapid generation of several diagrams with the same components. Maybe Simon was tired of diagramming tools that make you repeat yourself? If so, I share the sentiment.
It’s [free for most use cases].
Primary Use Cases
- Creation of architectural diagrams
- Capture architecture decisions
- Diagram review
- Saving time!
When to Use Structurizr?
When you need to create a diagram quickly, Structurizr is the tool for you. It’s a great tool for capturing architecture decisions and sharing them with your team. For more on software architecture best practices, check out our guide on software design patterns.
Structurizr DSL Examples: Building Diagrams
Building diagrams can be very tedious, and Structurizr addresses this tedium. A typical workflow in Structurizr looks like this. These structurizr dsl examples demonstrate the power of code-based diagramming.
- Add diagram elements
- Create relationships
- Layout your diagram
- Download your diagrams
The CLI
Edit diagrams using the Structurizr command-line interface. You can follow these steps to edit your workspace if you’re on macOS.
# Install docker or some other docker-like app
cd /tmp
wget -P /tmp https://raw.githubusercontent.com/structurizr/examples/main/dsl/getting-started/workspace.dsl
docker pull structurizr/lite
docker run -it --rm -p 8080:8080 -v /tmp:/usr/local/structurizr structurizr/lite
open http://localhost:8080/ # Start editing!
# Update /tmp with your preferred directory
Structurizr Examples: Model Reuse
I use [Structurizr Lite] to create diagrams with code. I’ve found a way to reuse models using this method. Reusing models keeps the management of links to component details simple.
workspace "Reuse Models" "Demonstrate Model Reuse" {
model {
customer = person "Customer" "Customer" "Customer"
website = softwareSystem "Website" "Website" "Website"
system1 = softwareSystem "system1" "" "" {
rel1 = customer -> website "Relationship scoped to system1"
}
system2 = softwareSystem "system2" "" "" {
rel2 = website -> customer "Relationship scoped to system2"
}
}
views {
systemContext system1 {
include customer
include website
exclude rel2
autoLayout
}
systemContext system2 {
include customer
include website
exclude rel1
autoLayout
}
}
Comments #