Structurizr Java

repository·master·Indexed 22 days ago

https://github.com/structurizr/java

A collection of Java libraries for creating and managing software architecture models based on the C4 model. It includes structurizr-core for programmatic model definition, structurizr-dsl for a 'Diagrams as Code' workflow, structurizr-client for API interaction, and specialized libraries for automatic layout via Graphviz, component discovery, workspace importing, inspection, and exporting to formats such as PlantUML, Mermaid, DOT, and Ilograph.

Tokens
2.7K
Snippets
8
Records
20
Agent score
77%

What's inside structurizr-java

  1. Overview of structurizr-core

    master
    The structurizr-core library provides the fundamental functionality for creating and managing Structurizr workspaces using Java. It allows developers to programmatically define software architecture models, including elements like people, software systems, containers, components, and their relationships, which can then be exported or used with the Structurizr renderer.
  2. Overview of structurizr-component

    master

    The structurizr-component library is a tool for discovering components within a Java codebase. It uses a combination of Apache Commons BCEL and JavaParser to scan code and identify components based on a pluggable and customizable set of matching and filtering rules.

    This functionality can be used in two ways:

    1. Programmatically via the Java library: Integrate the library directly into your Java application or build process.
    2. Via Structurizr DSL: Use the !components keyword within a Structurizr DSL workspace to trigger component discovery.
  3. Overview of structurizr-annotation

    master

    The structurizr-annotation library provides custom Java annotations designed to facilitate the extraction of software architecture models from source code. These annotations serve two primary purposes:

    1. Explicit Component Extraction: Using annotations like @Component to define how specific code elements should be mapped to architectural components.
    2. Model Supplementation: Using annotations like @Property or @Tag to add metadata and additional information to the software architecture model.

    Key characteristics:

    • Zero Dependencies: The library does not introduce any external dependencies to your project.
    • Runtime Retention: All annotations use a RUNTIME retention policy, ensuring they are available in the compiled bytecode for reflection-based extraction tools.
  4. Overview of structurizr-inspection

    master
    The structurizr-inspection library provides utilities to inspect a Structurizr workspace to identify and report warnings. It is designed to help developers ensure their workspace models adhere to expected patterns or quality standards by programmatically scanning the workspace content.
  5. Use PlantUML exporters in Structurizr for Java

    master

    The structurizr-export package provides two distinct PlantUML exporters for converting Structurizr models into PlantUML format:

    1. StructurizrPlantUMLExporter: A general-purpose exporter for PlantUML.
    2. C4PlantUMLExporter: An exporter specifically designed for C4 model diagrams in PlantUML.

    For detailed instructions on how to use these exporters and integrate them into your workflow, refer to the official Structurizr export documentation at https://docs.structurizr.com/export.

  6. Importable artifacts in structurizr-import

    master

    The library supports importing the following types of content into a Structurizr workspace:

    • Diagrams: Supports PlantUML, Mermaid, and Kroki formats.
    • Documentation: Supports supplementary Markdown and AsciiDoc files.
    • Architecture Decision Records (ADRs): Imports ADRs to provide context to the architecture.
    • Images: Imports images to be used within diagrams or documentation.
  7. Install structurizr-autolayout

    master

    The structurizr-autolayout library is available on Maven Central. You must have the Graphviz tool installed on your system for the layout engine to function, as the library wraps the Graphviz dot command.

    <!-- Add the dependency to your Maven pom.xml -->
    <dependency>
        <groupId>com.structurizr</groupId>
        <artifactId>structurizr-autolayout</artifactId>
        <version>VERSION</version>
    </dependency>
  8. Install the structurizr-client library

    master

    The structurizr-client library is available on Maven Central. You can use it to interact with the Structurizr Cloud service or an on-premises installation via their Workspace and Admin APIs.

    <!-- Add the following dependency to your Maven pom.xml -->
    <dependency>
        <groupId>com.structurizr</groupId>
        <artifactId>structurizr-client</artifactId>
        <version>5.0.3</version>
    </dependency>
  9. Export dynamic views to WebSequenceDiagrams format

    master

    Use the WebSequenceDiagramsExporter class to convert Structurizr dynamic views into diagram definitions compatible with websequencediagrams.com. You can export either an entire workspace's worth of dynamic views or a specific single dynamic view.

    // Export all dynamic views in a workspace
    Workspace workspace = ...
    WebSequenceDiagramsExporter exporter = new WebSequenceDiagramsExporter();
    Collection<Diagram> diagrams = exporter.export(workspace);
    
    // OR export a single dynamic view
    DynamicView view = ...
    WebSequenceDiagramsExporter exporter = new WebSequenceDiagramsExporter();
    Diagram diagram = exporter.export(view);