architecture-handbook

Structurizr

We recommend using the C4 Model in conjunction with the Structurizr DSL as a way to automatically generate the C4 diagrams from code. This allows for the Structurizr code to be kept in the same repository as the code of the system, making it easier to keep the two up to date together.

A Structurizr Lite quick start template has been created that you can use as a starting point in your own projects.

Quick overview

All the code to define the model, relationships and views are held in a single workspace.dsl file that Structurizr uses to build the visual diagams.

Structurizr workspace

The following code will generate a very simple diagram showing a basic relationship between a user and a software system

workspace {
  model {
    u = person "User"
    s = softwareSystem "Software System" 

    u -> s "uses"
  }
  views {
    container s {
       include *
       autoLayout
  }
}

Watch

Structurizr: Software architecture models as code CoP session (1st August 2023)

Software architecture models as code Made Tech internal only video

Peter Bridger explains how to get up and running with Structurizr to create your own interactive diagrams, along with using the documentation and ADR abilities of Structurizr Lite using the quick start template mentioned previously.

Futher reading