Structurizr DSL


The Structurizr DSL (as mentioned on the ThoughtWorks Tech Radar - Techniques - Diagrams as code) allows you to create multiple diagrams based upon the C4 model, in multiple output formats, from a single DSL source file. There are a number of options for authoring workspaces with the Structurizr DSL.

Structurizr Lite

Recommended

Structurizr Lite provides a way to quickly work with a single workspace. It's free to use, and allows you to view/edit diagrams, view documentation, and view architecture decision records defined in a DSL workspace.

The auto-sync feature provides the ability to sync your local changes with a workspace stored on the Structurizr cloud service or an on-premises installation.

Structurizr CLI

Recommended

The Structurizr CLI is a command line utility, designed to be used in conjunction with the Structurizr DSL. It provides the ability to push/pull workspaces to/from the Structurizr cloud service or an on-premises installation, in additional to exporting the views defined in a DSL file to other formats (PlantUML, Mermaid, WebSequenceDiagrams, and Ilograph).

See Getting started with the Structurizr CLI and DSL for more information.

DSL editor

Not recommended

If you'd rather not use Structurizr Lite or the Structurizr CLI, the Structurizr cloud service/on-premises installation provides a basic online DSL editor. The editor provides some rudimentary syntax highlighting and the ability to use the DSL without installing any tooling, but it does not provide access to the full feature set of the DSL - see the comparison table below.

The DSL editor can be opened using the link on your workspace summary page.

Comparison

Structurizr Lite

Recommended

Structurizr CLI

Recommended

DSL editor (and demo page)

Not recommended

DSL files are stored on local disk, and can be easily added to source code control
Diagrams
Documentation !docs
Architecture decision records !adrs
Branding logo logo HTTPS URLs (important notes) and data URIs only
Element style icons icon HTTPS URLs (important notes) and data URIs only
Workspace extension extends HTTPS URLs only
DSL includes !include HTTPS URLs only
Plugins !plugin
Scripts !script
Export to PlantUML, Mermaid, DOT, WebSequenceDiagrams, and Ilograph Demo page only

Recommended workflow

Our recommended workflow is to use Structurizr Lite and/or the Structurizr CLI, and to store your DSL file(s) in source code control. If you use the online DSL editor, please note that (1) it does not provide access to the full feature set and (2) you should ensure your DSL is backed up outside of the Structurizr cloud service/on-premises installation.

Disabling the online DSL editor

If you'd like to disable the online browser-based DSL editor, to ensure that team members don't accidentally use it, you can set a workspace property named structurizr.dslEditor to false. For example:


workspace {

    properties {
        "structurizr.dslEditor" "false"
    }

    model {
        ...
    }

    views {
        ...
    }

}

If you are using the on-premises installation, you can disable the DSL editor for all workspaces via the structurizr.properties file, by setting a property named structurizr.dslEditor to false.