Top Related Projects
Generate diagrams from textual description
Generation of diagrams like flowcharts or sequence diagrams from text in a similar manner as markdown
D2 is a modern diagram scripting language that turns text to diagrams.
:art: Diagram as Code for prototyping cloud system architectures
Quick Overview
Structurizr DSL is a domain-specific language and toolset for creating software architecture models based on the C4 model. It allows developers and architects to define and visualize software systems, containers, components, and code elements using a simple text-based format.
Pros
- Easy to learn and use, with a simple syntax for describing architecture
- Version control friendly, as models are defined in plain text
- Integrates well with other tools in the Structurizr ecosystem
- Supports automatic diagram generation from the model
Cons
- Limited customization options compared to graphical modeling tools
- Requires learning a new DSL syntax
- May not be suitable for complex, highly detailed architectural models
- Lacks real-time collaboration features found in some visual modeling tools
Code Examples
- Defining a simple system:
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 {
systemContext softwareSystem "SystemContext" {
include *
autoLayout
}
container softwareSystem {
include *
autoLayout
}
}
}
- Adding styles to elements:
styles {
element "Software System" {
background #1168bd
color #ffffff
}
element "Person" {
shape person
background #08427b
color #ffffff
}
}
- Defining relationships between components:
component "Component A" {
-> "Component B" "Depends on"
-> "Component C" "Uses"
}
component "Component B"
component "Component C"
Getting Started
-
Install the Structurizr CLI:
brew install structurizr-cli
-
Create a new DSL file (e.g.,
architecture.dsl
) and define your model:workspace { model { user = person "User" system = softwareSystem "My System" user -> system "Uses" } views { systemContext system { include * autoLayout } } }
-
Generate diagrams using the CLI:
structurizr-cli export -workspace architecture.dsl -format plantuml
This will create PlantUML diagrams based on your model, which you can then render or further process as needed.
Competitor Comparisons
Generate diagrams from textual description
Pros of PlantUML
- Wider range of diagram types supported (sequence, class, use case, etc.)
- More extensive community and ecosystem
- Simpler syntax for quick diagramming
Cons of PlantUML
- Less focus on software architecture specific diagrams
- Limited support for hierarchical structures and relationships
- Can become cluttered and hard to read for complex systems
Code Comparison
PlantUML:
@startuml
class User {
+name: String
+email: String
}
class Order {
+id: int
+date: Date
}
User --> Order: places
@enduml
Structurizr DSL:
workspace {
model {
user = person "User"
softwareSystem = softwareSystem "E-commerce System" {
orderComponent = container "Order Management"
}
user -> softwareSystem "Places order"
}
}
The PlantUML example shows a simple class diagram, while the Structurizr DSL example demonstrates a high-level system context diagram. Structurizr DSL is more focused on architectural concepts, while PlantUML offers a broader range of diagram types.
Generation of diagrams like flowcharts or sequence diagrams from text in a similar manner as markdown
Pros of Mermaid
- Broader diagram support (flowcharts, sequence diagrams, Gantt charts, etc.)
- Easier integration with various platforms (Markdown, websites, documentation tools)
- More active community and frequent updates
Cons of Mermaid
- Less focused on software architecture specifically
- Limited support for complex system modeling and views
Code Comparison
Mermaid (flowchart):
graph TD
A[Client] -->|HTTP Request| B[Load Balancer]
B --> C[Server1]
B --> D[Server2]
Structurizr DSL (system context):
workspace {
model {
softwareSystem = softwareSystem "Software System"
user = person "User"
user -> softwareSystem "Uses"
}
views {
systemContext softwareSystem "SystemContext" {
include *
autoLayout
}
}
}
Both DSLs offer concise ways to describe diagrams, but Structurizr is more tailored for software architecture, while Mermaid provides a wider range of diagram types with simpler syntax.
D2 is a modern diagram scripting language that turns text to diagrams.
Pros of D2
- More versatile, supporting a wider range of diagram types beyond software architecture
- Simpler syntax, making it easier for beginners to get started
- Built-in support for themes and styling options
Cons of D2
- Less focused on software architecture specifics compared to Structurizr DSL
- Lacks some of the advanced features for detailed system modeling found in Structurizr DSL
- May require additional effort to create complex software architecture diagrams
Code Comparison
D2:
shape: sequence_diagram
alice -> bob: Hello
bob -> charlie: Hi
charlie -> alice: Greetings
Structurizr DSL:
workspace {
model {
user = person "User"
softwareSystem = softwareSystem "Software System"
user -> softwareSystem "Uses"
}
views {
systemContext softwareSystem "SystemContext" {
include *
autoLayout
}
}
}
The D2 example shows a simple sequence diagram, while the Structurizr DSL example demonstrates a basic software system context diagram. D2's syntax is more concise, but Structurizr DSL provides more detailed modeling capabilities for software architecture.
:art: Diagram as Code for prototyping cloud system architectures
Pros of Diagrams
- Python-based, allowing for easier integration with existing Python codebases
- Extensive library of pre-built icons and shapes for various cloud providers and services
- Supports programmatic generation of diagrams, enabling dynamic creation based on data or configurations
Cons of Diagrams
- Limited to creating architecture diagrams, lacking support for other types of software documentation
- Requires Python knowledge, which may not be ideal for non-developers or teams using other languages
- Less focus on the underlying architecture model, primarily centered on visual representation
Code Comparison
Diagrams:
from diagrams import Diagram
from diagrams.aws.compute import EC2
with Diagram("Simple Diagram"):
EC2("Web Server")
Structurizr DSL:
workspace {
model {
webServer = softwareSystem "Web Server"
}
views {
systemContext webServer "SimpleContext" {
include *
}
}
}
Both examples create a simple diagram with a single component, but Diagrams uses Python code while Structurizr DSL uses a domain-specific language. Diagrams focuses on visual elements, while Structurizr DSL emphasizes the architecture model and relationships between components.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
The code in this repo has been moved to https://github.com/structurizr/java/tree/master/structurizr-dsl
Top Related Projects
Generate diagrams from textual description
Generation of diagrams like flowcharts or sequence diagrams from text in a similar manner as markdown
D2 is a modern diagram scripting language that turns text to diagrams.
:art: Diagram as Code for prototyping cloud system architectures
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot