Relationships
Relationships define how elements in your architecture communicate with each other. They are a core part of the Structurizr DSL model.
Basic syntax
Section titled “Basic syntax”source -> destination "description"With technology:
source -> destination "description" "technology"Examples
Section titled “Examples”user -> webapp "Uses"webapp -> api "Makes API calls to" "HTTPS/JSON"api -> db "Reads from and writes to" "JDBC"api -> emailService "Sends notifications via" "SMTP"Implicit relationships
Section titled “Implicit relationships”Inside an element block, you can use implicit this to define relationships from the current element:
person "User" { -> system "Uses"}
softwareSystem "My System" { -> externalApi "Fetches data from" "REST"}This is equivalent to:
user = person "User"system = softwareSystem "My System"user -> system "Uses"Relationship properties
Section titled “Relationship properties”Relationships support the same metadata as elements:
user -> system "Uses" { tags "Critical" "External" properties { "Protocol" "HTTPS" "SLA" "99.9%" }}Relationship identifiers
Section titled “Relationship identifiers”You can assign identifiers to relationships for referencing in views:
rel = user -> system "Uses"This is optional but useful when you need to reference specific relationships in dynamic views or filtered views.
Styling relationships
Section titled “Styling relationships”Use the styles block to style relationships by tag:
styles { relationship "Relationship" { color "#707070" thickness 2 style dashed } relationship "Critical" { color "#ff0000" thickness 3 }}Supported style properties
Section titled “Supported style properties”| Property | Description | Values |
|---|---|---|
color / colour |
Line color | Hex color (e.g., "#707070") |
thickness |
Line thickness | Number (e.g., 2) |
opacity |
Line opacity | 0–100 |
routing |
Line routing | Direct, Orthogonal |
style |
Line style | dashed (solid is default) |
Relationships in views
Section titled “Relationships in views”Relationships appear automatically in views when both the source and target elements are included. Use include and exclude to control which elements (and therefore which relationships) are visible:
systemContext mySystem "Context" { include * autoLayout}In dynamic views, relationships are referenced as ordered interaction steps:
dynamic mySystem "Flow" { user -> webapp "Submits form" webapp -> api "Forwards request" api -> db "Queries data"}Default tag
Section titled “Default tag”All relationships automatically have the Relationship tag. A style like relationship "Relationship" { ... } applies to all relationships unless overridden by more specific tag styles.
See also
Section titled “See also”- DSL Basics — Workspace structure and element types
- Views — How views display relationships
- Dynamic Views — Ordered interactions in dynamic views