c4studio v0.5.0

Structurizr DSL: language support#

Which parts of the Structurizr DSL c4studio understands, keyword by keyword.

Reference: the published language reference at <https://docs.structurizr.com/dsl/language>, which lists 73 keywords. Where that page and the Java source disagree, ../structurizr/structurizr-dsl/ settles it — each parser there declares a literal GRAMMAR string.

How the support column was established: by parsing a minimal snippet for each keyword and inspecting the resulting model, not by reading the parser. Verified August 2026 against the parser in src/c4studio/parser/dsl.py; re-probed September 2026, which corrected instanceOf and caught the deploymentEnvironment alias leak, since fixed (PP-138).

Living coverage: samples/logistics_network.dsl exercises most ✅ keywords in one workspace — groups, custom elements, this ->, relationship bodies, the bulk !… directives, deployment groups, health checks, view animation, branding, terminology. Every keyword it uses is pinned to its model effect by tests/test_samples/test_logistics_network.py, so this table cannot silently drift for those rows.

Meaning
✅Parsed, and it changes the model as documented
◐Partially supported — see the note
⚠️Parses silently and does nothing. No warning, no effect. These are defects, not decisions — no row carries this any more, and a new one is a bug, not a status
⛔Skipped, and recorded as a diagnostic you can see
🚫Deliberately unsupported and staying that way

Comments: //, /* … */ and full-line # are all supported. A # only starts a comment when nothing but whitespace precedes it on the line — mid-line it is a hex colour (background #1a2b3c), the same rule as structurizr-java (^\s*?(//|#)).

Multi-line strings: """ text blocks and a trailing \ for line continuation are both supported, read as structurizr-java's preProcessLines reads them (PP-202). Before that a text block parsed silently to an empty string — a ⚠️ in all but name.

Anything marked ⛔ follows the parser's fail-soft contract: the construct and any { … } body are skipped whole, never half-applied, and recorded in Workspace.diagnostics (and parse_warnings), which c4 check prints. A skipped construct never consumes its enclosing scope.

Workspace#

KeywordSupportNotes
workspace [name] [description]✅
`workspace extends <file\url>`◐A local DSL file is extended as upstream does (PP-210): the base's identifiers, constants, model and views are in scope, and declaring a person, software system, container or component the base already has, by name, means that element. Unlike upstream, an argument left out keeps the base's value instead of resetting it. The base's !docs, !adrs and theme paths resolve from its own directory, and editing it live-reloads. A URL is not fetched and a JSON base is not read: both are reported (unsupported-extends) and the file is parsed on its own
`!identifiers hierarchical\flat`◐Accepted, but identifier resolution is always flat; the requested mode is ignored
`!impliedRelationships <true\false>`✅
properties { … } (workspace level)✅On Workspace.properties, exported at the top level of the JSON as upstream's AbstractWorkspace.properties is. Previously written to the views configuration instead, which is a different statement's target — see the Views table
configuration { … }✅scope, visibility, users all parse
`!include <file\directory>`✅Works from a file (parse_dsl_file); a string parsed with no file context cannot resolve relative paths
!docs <path>✅Needs a file context; raises a clear error when parsed from a string. Scoped to where it is written — workspace level documents the workspace, an element body documents that element (PP-185)
!adrs <path>✅Same
!decisions <path>⛔The upstream alias for !adrs; not wired up
!script🚫Never executed. Skipped whole, with a diagnostic. Executing arbitrary Groovy/Kotlin/Ruby from a parsed file is not something this tool will do
!plugin🚫Same reasoning — arbitrary JVM classes
!components⛔Component discovery by classpath scanning; a JVM feature with no equivalent here

Model#

KeywordSupportNotes
model { … }✅
group "<name>" { … }✅Model level, element bodies, and nested; renders as a boundary
person <name> [description] [tags]✅
softwareSystem <name> [description] [tags]✅
container <name> [description] [technology] [tags]✅
component <name> [description] [technology] [tags]✅
element <name> [metadata] [description] [tags]✅Custom elements parse and round-trip; not shown in the built-in views
<identifier> -> <identifier> [description] [technology] [tags]✅Including this -> and implicit-source forms
<identifier> -/> <identifier>⛔Relationship removal is not implemented
archetypes { … }⛔A newer upstream feature; the whole block is skipped
deploymentEnvironment <name> { … }✅Both forms. The aliased form prod = deploymentEnvironment "Production" { … } used to be rejected and leak its body into model scope; fixed in PP-138, and the alias now resolves in a deployment view's environment slot the way upstream resolves it
deploymentGroup <name>✅Declarations and instance membership
deploymentNode <name> […] [instances] { … }✅Positional instances supported, including ranges like "0..N"
infrastructureNode <name> […]✅
softwareSystemInstance <identifier> […]✅
containerInstance <identifier> […]✅
instanceOf <identifier> […]⛔Skipped with a diagnostic ('instanceOf' is not valid inside deploymentnode). Upstream sugar that picks software-system vs container instance from the referenced element; use softwareSystemInstance / containerInstance explicitly
healthCheck <name> <url> […]✅Valid inside a container or software system instance only, as upstream (StaticStructureElementInstanceDslContext); on a deploymentNode or infrastructureNode it is skipped with unexpected-token. Parsed and round-tripped; not evaluated — the only feature that makes HTTP calls is a dynamic perspective, and only behind --dynamic-perspectives

Element and relationship bodies#

KeywordSupportNotes
tags "<a,b>"✅
description "<text>"✅
technology "<text>"✅
url "<url>"✅
properties { … }✅
perspectives { … }✅Highlighted and completed in the editor since PP-177. Both upstream forms: <name> <description> [value] and perspective <name> { description … value … url … }. Parsed and round-tripped; rendered in the viewer as a static perspective overlay (PP-173), and a dynamic perspective's url is read by the server behind c4 webapp --dynamic-perspectives (PP-179), off by default. Until PP-172 the block form was misread as perspectives named description/value/url with no warning; a malformed line, an unknown property in a block, a block without the perspective keyword, and a duplicate name (which upstream rejects) are now reported as diagnostics and skipped
instances "<n>" as a body keyword⛔Only the positional form on deploymentNode is understood
tag (archetype-related)◐Accepted without error; no archetype support behind it

Bulk operations and references#

KeywordSupportNotes
!element <identifier> { … }✅
!elements <expression> { … }✅Applies the body to every matching element
!relationship <alias> { … }✅Applies tags, url, properties and perspectives — the whole vocabulary a relationship block has, upstream included: it is a ModelItemDslContext, and technology/description are not gated on it. Those are positional on the -> line, or bulk-set via !relationships. Anything else in the block, and an alias that resolves to nothing, are now reported rather than dropped
!relationships <expression> { … }✅Tag and property expressions, plus the wildcard forms: * (rewritten to *->*, as upstream does), "*->*", and half-wildcards like a -> * and "*->c". An expression matching nothing is now reported rather than passing silently
!extend <identifier> { … }⛔
!ref <identifier> { … }⛔

Views#

KeywordSupportNotes
systemLandscape [key] { … }✅Enterprise boundary included
systemContext <system> [key] { … }✅
container <system> [key] { … }✅
component <container> [key] { … }✅
dynamic <scope> [key] { … }✅Ordered steps, animated in the viewer
deployment <scope> <environment> [key] { … }✅
custom [key] [title] { … }◐Parses and round-trips; not rendered in the viewer or by render
image <scope> [key] { … }◐Same
`filtered <baseKey> <include\exclude> <tags>`✅
include / exclude✅Wildcards, identifiers, relationship expressions and element.tag== predicates
autoLayout [rankDirection] [rankSep] [nodeSep]✅Direction and separations are honoured by the viewer and by render
default✅The default view opens first
animation { … }✅
parallel { … } (dynamic views)✅Steps inside share one step number, as upstream numbers them. Until PP-186 the block's closing brace was read as the end of the view, so steps written after it were dropped
paperSize <size>◐Parsed into View.paper_size and exported (PP-186); no renderer draws to a page size. An unknown value warns with unknown-paper-size
title / description / properties✅Per-view. Distinct from views { properties … }, the views configuration's own properties, which was skipped as an unsupported block until PP-105 — while workspace-level properties were being written there by mistake. The two were the wrong way round

Styles, themes and terminology#

KeywordSupportNotes
styles { element … }◐Every property parses. Painted: background, color, shape, icon, border, stroke, strokeWidth, opacity, metadata, description. Parsed and exported but not painted: width, height, fontSize, iconPosition — each warns (ignored-style-property), as does an unrecognised property name (unknown-style-property). height matters less than it looks: a node is already sized to fit its own text (see below)
styles { relationship … }◐Every property parses and exports. Painted: color, style / dashed (solid/dashed/dotted; style wins when both are set), thickness, opacity, metadata, description. routing Orthogonal draws the line with the step router, on the canvas and in c4 render, whatever the toolbar's line style (PP-209); Direct and Curved leave the toolbar's style in charge, and a later rule overrides an earlier one. Parsed and exported but not painted: jump, position, width, fontSize. Unstyled relationships render dashed, 2px, #707070 (a deliberate divergence from upstream's #444444 — see docs/structurizr-parity.md), so mark special edges with style dotted/style solid or a colour, not dashed true. Every styled tag in use becomes a legend row named after it, so the tag is the wording the reader sees (PP-174) — or the c4studio.legend property when the tag is not enough (PP-175)
styles { … properties { … } }✅A style is a PropertyHolder upstream (AbstractStyle), and the block is valid in both element and relationship styles; it was silently dropped here until PP-175. Round-tripped through JSON. c4studio.legend names that style's legend row when the tag is not wording enough — a namespaced key upstream ignores, the same escape hatch as structurizr.perspective.interval
light { … } / dark { … }◐Colour-scheme variants parse; the viewer renders one scheme
`theme <url\default\file>`✅A URL is fetched, cached and merged; workspace styles win. A file (PP-199) is read relative to the workspace and inlined at parse time, icons as data: URIs, so it needs no network. Upstream lets declaration order decide between a file theme and the workspace's styles; here the workspace always wins, the same rule as a URL theme
`themes <url\file> <url\file…>`✅URLs and files mix freely
branding { … }✅Logo and font, including the font URL
terminology { … }✅

How much text a node shows#

Nodes are a fixed 200px wide and as tall as their own text needs, so a wordy element grows downward rather than clipping. The measurement lives in packages/diagram-core/src/nodeMetrics.ts and is shared by the layout engine, the SVG emitter and the web app's CSS clamps — one number, so the box that is drawn is the box the layout reserved.

Each field still has a ceiling, past which text is ellipsised and shown in full on hover: 4 lines for the name, 2 for the [Kind: technology] line, 4 for the description. Those are generous enough that no node in any bundled sample clips, but a diagram is a poor place for prose — put the long version in !docs and keep the description to a sentence.

Width is deliberately not part of this: equal-width boxes are most of what makes ranks scannable. Upstream's width/height element-style properties remain unsupported.

Per-boundary layout hints (c4studio.autolayout)#

autoLayout sets one rank direction for the whole view. To lay a single boundary's interior out differently, c4studio reads a property — not a DSL extension, so the file stays valid for every Structurizr tool, which simply carries the property through untouched:

softwareSystem "Platform" {
    properties {
        "c4studio.autolayout" "lr"    // this boundary's children flow left-to-right
    }
    ...
}

views {
    container platform Containers {
        include *
        autoLayout tb                  // the view itself stays top-to-bottom
        properties {
            // groups have no properties of their own, so a group
            // boundary's hint is keyed by group name on the view
            "c4studio.autolayout.Core Services" "lr"
        }
    }
}

Values are tb, bt, lr, rl (case-insensitive); anything else is ignored. The hint applies wherever that element renders as a boundary — the view's own scope, an element expanded in place, a deployment node — and is purely local: the boundary still sits in its parent's flow. It steers auto-layout only; positions saved in a layout sidecar still win. samples/logistics_network.dsl shows both forms.

Marking elements as new, existing or deprecated#

There is no lifecycle keyword in the DSL. The only styling axis is the tag: tag the elements, style the tag, and the legend follows — c4studio derives one row per visually distinct combination of colour, shape and border, labelled by the most specific style tag that matched.

container "Fraud Check" "" "Go" { tags "New" }
...
styles {
    element "Existing"   { background #4b7bb5 }
    element "New"        { background #2e7d32 border dashed strokeWidth 3 }
    element "Deprecated" { background #90a4ae border dotted opacity 55 }
}

Three things that are easy to get wrong:

  • Tag the unchanged elements too. An untagged element falls back to its C4 kind, so you get "New" vs "Container" rather than "New" vs "Existing".
  • The last matching rule names the row. Every matching rule contributes its own properties, but the legend label comes from the one declared last. Put the rule you want as the label after the others.
  • The swatch carries colour, shape and border — not opacity. Two greys separated only by a fade are one row apart in the diagram and indistinguishable in the legend; give one of them a border.

samples/delta_release.dsl is a complete worked example, including tag composition and the ordering rule.

Configuration#

KeywordSupportNotes
scope✅
visibility✅
users { … }✅Parsed and round-tripped. c4studio is local-first: there is no auth to apply it to

The gaps worth knowing about#

Nothing now parses silently and does nothing. That list had three entries; the last, !relationships with wildcard expressions, went in PP-104. Whatever a statement cannot apply is recorded in Workspace.diagnostics and printed by c4 check.

!relationship <alias> { … } was listed here and should not have been. It applies every property a relationship block accepts; the report behind that entry set technology, which is not one of them in this DSL at all. What was true is that it said nothing — neither about the ignored property nor about an alias matching nothing. Both are diagnostics now.

And one construct half-announces itself: an aliased prod = deploymentEnvironment … { … } produces a diagnostic for the statement, but its body still leaks into the enclosing model scope (see the Model table above).

Everything else that is unsupported announces itself: c4 check lists it, and the webapp surfaces it. If a construct you rely on is missing here and does not appear in check output, that is a bug worth filing.

What will not be supported#

!script and !plugin execute arbitrary code — Groovy, Kotlin, Ruby or a JVM class — named by the file being parsed. c4studio parses untrusted DSL in a CLI, a web app and (potentially) a browser, so it skips both and says so. This is a deliberate boundary, not a missing feature.

Edit this page on GitHub