/java

Structurizr for Java

Primary LanguageJavaApache License 2.0Apache-2.0

Structurizr

Structurizr for Java

This GitHub repository is a collection of tooling to help you visualise, document and explore the software architecture of a software system. In summary, it allows you to create a software architecture model based upon Simon Brown's C4 model using Java code, and then export that model to be visualised using tools such as:

  1. Structurizr: a web-based software as a service and on-premises product to render software architecture diagrams and supplementary Markdown/AsciiDoc documentation.
  2. PlantUML: a tool to create UML diagrams using a simple textual domain specific language.
  3. Graphviz: a tool to render directed graphs using the DOT format.

As an example, the following Java code can be used to create a software architecture model that describes a user using a software system.

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();
}

If using Structurizr, the end-result, after adding some styling and positioning the diagram elements, is a system context diagram like this:

Getting Started with Structurizr for Java

You can see the live workspace at https://structurizr.com/share/25441.

Build Status

Table of contents