This GitHub repository contains an implementation of the Structurizr DSL - a way to create Structurizr software architecture models based upon the C4 model using a textual domain specific language (DSL). The Structurizr DSL has appeared on the ThoughtWorks Tech Radar - Techniques - Diagrams as code.
- Getting started with Structurizr Lite (using the DSL)
- Getting started with the Structurizr CLI and DSL
- Structurizr DSL demo
- Language reference
- Changelog
- Structurizr DSL cookbook (this is a work in progress)
As an example, the following text can be used to create a software architecture model and an associated view that describes a user using a software system.
workspace {
model {
user = person "User"
softwareSystem = softwareSystem "Software System"
user -> softwareSystem "Uses"
}
views {
systemContext softwareSystem {
include *
autolayout
}
theme default
}
}
The DSL can be rendered using a number of tools:
- Structurizr Lite (free)
- Structurizr cloud service/on-premises installation (free and paid), PlantUML, Mermaid, DOT (Graphviz), WebSequenceDiagrams, and Ilograph via the Structurizr CLI
The DSL is designed to be as compact as possible. In conjunction with the Structurizr CLI, the following DSL fragment will automatically create the implied relationship between the user
and softwareSystem
elements, create three views with auto-layout enabled (1 x System Landscape, 1 x System Context, 1 x Container), and add some default element styles.
workspace {
model {
user = person "User"
softwareSystem = softwareSystem "Software System" {
webapp = container "Web Application"
database = container "Database"
}
user -> webapp "Uses"
webapp -> database "Reads from and writes to"
}
views {
theme default
}
}
Here are some tools designed to support the Structurizr DSL.
- Structurizr Lite (web-based rendering tool)
- c4viz (web-based rendering tool)
- Structurizr CLI (command line utilities)
- VS Code extension (syntax highlighting and diagram previews; please note that there are some known issues with the syntax highlighting - see Divergences for more details, and Examples for examples that work correctly with the extension)
- VS Code extension (syntax highlighting)