java icon indicating copy to clipboard operation
java copied to clipboard

Structurizr for Java

Structurizr

Structurizr for Java

This GitHub repository is (1) a client library for the Structurizr cloud service and on-premises installation and (2) a way to create a Structurizr workspace using Java code. Looking for the Structurizr DSL instead?

A quick example

As an example, the following Java code can be used to create a software architecture model and an associated view that describes a user using a software system, based upon the C4 model.

public static void main(String[] args) throws Exception {
    Workspace workspace = new Workspace("Getting Started", "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 views = workspace.getViews();
    SystemContextView contextView = views.createSystemContextView(softwareSystem, "SystemContext", "An example of a System Context diagram.");
    contextView.addAllSoftwareSystems();
    contextView.addAllPeople();
}

The view can then be exported to be visualised using the Structurizr cloud service/on-premises installation/Lite, or other formats including PlantUML, Mermaid, DOT, and WebSequenceDiagrams via the structurizr-export library.

Table of contents

  • Introduction
    • Getting started
    • Basic concepts (workspaces, models, views and documentation)
    • C4 model
    • Examples
    • Binaries
    • Building from source
    • API client
    • Usage patterns
    • FAQ
  • Model
    • Creating your model
    • Implied relationships
  • Views
    • Creating views
    • System Context diagram
    • Container diagram
    • Component diagram
    • Dynamic diagram
    • Deployment diagram
    • System Landscape diagram
    • Styling elements
    • Styling relationships
    • Filtered views
    • Graphviz automatic layout
  • Other
    • Client-side encryption
  • Related projects
    • structurizr-dsl: A text-based DSL for authoring Structurizr workspaces.
    • java-quickstart: A simple starting point for using Structurizr for Java
    • structurizr-export: Export model and views to external formats (e.g. PlantUML, Mermaid, etc).
    • structurizr-documentation: Import Markdown/AsciiDoc documentation and ADRs into a Structurizr workspace.
    • java-extensions: A collection of Structurizr for Java extensions; including the ability to extract software architecture information from code.
    • structurizr-kotlin: An extension for Structurizr that lets you create your models in a fluent way.
    • structurizr-spring-boot: A way to apply dependency management to help modularise Structurizr code.
    • structurizr-groovy: An initial version of a Groovy wrapper around Structurizr for Java.
  • changelog