Create diagrams using code

Structurizr is an implementation of the System Context, Container and Component diagrams from Simon Brown's C4 model, supplemented with a dynamic diagram that takes its influence from UML. Structurizr does not provide a "drag and drop" editor to create diagrams. Instead, you create a software architecture model using code and upload it via the web API. Here's a simple example using Java:

Workspace workspace = new Workspace("My model", "This is a model of my software system.");
Model model = workspace.getModel();

Person user = model.addPerson("User", "A user of my software system.");
SoftwareSystem softwareSystem = model.addSoftwareSystem("Software System", "My software system.");
user.uses(softwareSystem, "Uses");

ViewSet viewSet = workspace.getViews();
SystemContextView contextView = viewSet.createSystemContextView(softwareSystem, "context", "A simple example of a System Context diagram.");
contextView.addAllSoftwareSystems();
contextView.addAllPeople();

Styles styles = viewSet.getConfiguration().getStyles();
styles.addElementStyle(Tags.SOFTWARE_SYSTEM).background("#1168bd").color("#ffffff");
styles.addElementStyle(Tags.PERSON).background("#08427b").color("#ffffff").shape(Shape.Person);

StructurizrClient structurizrClient = new StructurizrClient("key", "secret");
structurizrClient.putWorkspace(25441, workspace);

And here's the resulting diagram when you open it in Structurizr, where the layout of the diagrams can be modified.

A simple diagram

In essence, Structurizr is an implementation of an executable architecture description language, a simple domain-specific language to describe static structure, using code. There are open source client libraries on GitHub for Java and the .NET platform, which include static analysis features to help you extract components from your codebase. If you integrate this with your continuous integration/build process, your diagrams stay up to date.

Structurizr for Java Structurizr for .NET

Create diagrams using text

Alternatively, if you just want to sketch something out quickly, Structurizr Express lets you create a single software architecture diagram without writing code.

Structurizr Express screenshot

You can create the following types of diagrams using Structurizr Express.

Enterprise Context diagram System Context diagram Container diagram Component diagram