# uladzimirfilipchanka/noredraw architecture

> Architecture diagram of the GitHub repository uladzimirfilipchanka/noredraw, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/uladzimirfilipchanka/noredraw
- Repository: https://github.com/uladzimirfilipchanka/noredraw

## Overview

##### File structure
- Top-level modules (all Gradle-based):
- noredraw-app: the command-line entrypoint, configuration, argument parsing, Docker setup
- noredraw-core: central engine (model definitions, linking, merging, processing context)
- noredraw-loader: input source code retrieval (local folder or remote Git URL)
- noredraw-providers: built-in “plugins” that parse specific filetypes (Docker, Terraform-AWS, GitHub Actions, Gradle) to produce raw resources
- noredraw-custom-example: shows how to add your own Provider (custom extension)
- Key patterns: modular plugin architecture (Provider, Exporter, LinkStrategy, MergeStrategy interfaces), dependency injection via “@Named” annotations, staged pipeline (load → provide → link → merge → export).

##### Key insights from the README
- CLI parameters drive source location, export format, merge/link strategies, output path
- Providers are discovered on the classpath (core + custom jars)
- Core engine applies two phases: linking (connect related resources) and merging (collapse or group similar resources)
- Highly extensible: new Provider, Exporter, MergeStrategy, LinkStrategy can be added in minutes

a. Main components to show:
- CLI Runner (AppRunner & StarterService in noredraw-app)
- Configuration/Args parser (CliArgs, converters)
- Source loader (LocalSourceCodeProvider & RemoteRepoSourceCodeProvider in noredraw-loader)
- Provider modules (noredraw-providers + any custom jars) implementing Provider interface
- Core engine (ProcessingContext, GraphService, MergingService, model classes)
- External systems: Git repository, local filesystem
b. Relationships & interactions (data flow):
1. User invokes CLI Runner → parses arguments → Configuration
2. Loader fetches code → hands over source files to each active Provider
3. Each Provider emits zero-or-more Resource/Re-lic objects
4. Core LinkingService applies LinkStrategy implementations → produces a connected ResourceGraph
5. Core MergingService applies MergeStrategy implementations → produces final Graph model
c. Architectural patterns / design principles:
- Pipeline / staged processing
- Strategy pattern (LinkStrategy, MergeStrategy, Provider, Exporter)
- Dependency injection & module discovery (@Named annotation)
- Separation of concerns: CLI, loading, providing, core processing, exporting
d. Technology & frameworks:
- Java 17 (Eclipse-Temurin)
- Gradle multi-module build
- SLF4J + Logback
- Docker (Dockerfile for containerized CLI)

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "CLI Frontend"
        direction TB
        AppRunner["AppRunner"]:::frontend
        StarterService["StarterService"]:::frontend
        Configuration["Configuration"]:::frontend
        CliArgs["CliArgs"]:::frontend
        ExporterConverter["ExporterConverter"]:::frontend
        LinkStrategyConverter["LinkStrategyConverter"]:::frontend
        MergeStrategyConverter["MergeStrategyConverter"]:::frontend
        NamedClassUtils["NamedClassUtils"]:::frontend
        NamedAnnotation["Named (annotation)"]:::frontend
    end

    subgraph "Input Loader"
        direction TB
        SourceFactory["SourceCodeProviderFactory"]:::frontend
        LocalProvider["LocalSourceCodeProvider"]:::frontend
        RemoteProvider["RemoteRepoSourceCodeProvider"]:::frontend
    end

    subgraph "Providers Plugins"
        direction TB
        BuiltinProviders["Built-in Providers\n(Docker, Terraform-AWS,\nAmazonECS, GitHub Actions,\nGradle)"]:::plugin
        CustomProvider["MyCustomProvider"]:::plugin
    end

    subgraph "Core Engine"
        direction TB
        ProcessingContext["ProcessingContext"]:::core
        LinkingService["GraphService\n+ StrategyBasedGraphService"]:::core
        MergingService["MergingService\n+ StrategyBasedMergingService"]:::core
        ModelDefinitions["Model Definitions\n(Resource, Relic,\nResourceGraph, Sources,\nMatchers)"]:::core
    end

    subgraph "Exporter Plugins"
        direction TB
        ExporterInterface["Exporter Interface"]:::plugin
        PNGExporter["PngHttpExporter"]:::plugin
        StructurizrExporters["Structurizr-based Exporters"]:::plugin
    end

    GitRepo[(Git Repository)]:::external
    LocalFS[(Local File System)]:::external
    TextOutput[/"Mermaid/PlantUML/DOT Text"/]:::external
    PNGOutput[/"PNG Diagram"/]:::external

    %% Data flow
    AppRunner --> StarterService
    StarterService --> Configuration
    Configuration --> CliArgs
    CliArgs --> ExporterConverter
    CliArgs --> LinkStrategyConverter
    CliArgs --> MergeStrategyConverter
    StarterService --> NamedClassUtils
    NamedClassUtils --> NamedAnnotation

    StarterService --> SourceFactory
    SourceFactory --> LocalProvider
    SourceFactory --> RemoteProvider

    LocalProvider --> GitRepo
    RemoteProvider --> GitRepo
    LocalProvider --> LocalFS
    RemoteProvider --> LocalFS

    LocalProvider --> BuiltinProviders
    RemoteProvider --> BuiltinProviders
    LocalProvider --> CustomProvider
    RemoteProvider --> CustomProvider

    BuiltinProviders --> ProcessingContext
    CustomProvider --> ProcessingContext

    ProcessingContext --> LinkingService
    LinkingService --> MergingService
    MergingService --> ExporterInterface

    ExporterInterface --> PNGExporter
    ExporterInterface --> StructurizrExporters

    PNGExporter --> PNGOutput
    StructurizrExporters --> TextOutput
    TextOutput --> LocalFS
    PNGOutput --> LocalFS

    %% Click Events
    click AppRunner "https://github.com/uladzimirfilipchanka/noredraw/blob/main/noredraw-app/src/main/java/noredraw/AppRunner.java"
    click StarterService "https://github.com/uladzimirfilipchanka/noredraw/blob/main/noredraw-app/src/main/java/noredraw/StarterService.java"
    click Configuration "https://github.com/uladzimirfilipchanka/noredraw/blob/main/noredraw-app/src/main/java/noredraw/Configuration.java"
    click CliArgs "https://github.com/uladzimirfilipchanka/noredraw/blob/main/noredraw-app/src/main/java/noredraw/args/CliArgs.java"
    click ExporterConverter "https://github.com/uladzimirfilipchanka/noredraw/blob/main/noredraw-app/src/main/java/noredraw/args/ExporterConverter.java"
    click LinkStrategyConverter "https://github.com/uladzimirfilipchanka/noredraw/blob/main/noredraw-app/src/main/java/noredraw/args/LinkStrategyConverter.java"
    click MergeStrategyConverter "https://github.com/uladzimirfilipchanka/noredraw/blob/main/noredraw-app/src/main/java/noredraw/args/MergeStrategyConverter.java"
    click NamedClassUtils "https://github.com/uladzimirfilipchanka/noredraw/blob/main/noredraw-app/src/main/java/noredraw/utils/NamedClassUtils.java"
    click NamedAnnotation "https://github.com/uladzimirfilipchanka/noredraw/blob/main/noredraw-core/src/main/java/noredraw/core/annotation/Named.java"
    click LocalProvider "https://github.com/uladzimirfilipchanka/noredraw/blob/main/noredraw-loader/src/main/java/noredraw/loader/LocalSourceCodeProvider.java"
    click RemoteProvider "https://github.com/uladzimirfilipchanka/noredraw/blob/main/noredraw-loader/src/main/java/noredraw/loader/RemoteRepoSourceCodeProvider.java"
    click SourceFactory "https://github.com/uladzimirfilipchanka/noredraw/blob/main/noredraw-loader/src/main/java/noredraw/loader/SourceCodeProviderFactory.java"
    click ProcessingContext "https://github.com/uladzimirfilipchanka/noredraw/blob/main/noredraw-core/src/main/java/noredraw/ProcessingContext.java"
    click LinkingService "https://github.com/uladzimirfilipchanka/noredraw/blob/main/noredraw-core/src/main/java/noredraw/core/link/GraphService.java"
    click MergingService "https://github.com/uladzimirfilipchanka/noredraw/blob/main/noredraw-core/src/main/java/noredraw/core/merge/MergingService.java"
    click ModelDefinitions "https://github.com/uladzimirfilipchanka/noredraw/blob/main/noredraw-core/src/main/java/noredraw/core/model/Resource.java"
    click BuiltinProviders "https://github.com/uladzimirfilipchanka/noredraw/blob/main/noredraw-providers/src/main/java/noredraw/providers/docker/DockerProvider.java"
    click CustomProvider "https://github.com/uladzimirfilipchanka/noredraw/blob/main/noredraw-custom-example/src/main/java/noredraw/MyCustomProvider.java"
    click ExporterInterface "https://github.com/uladzimirfilipchanka/noredraw/blob/main/noredraw-export/src/main/java/noredraw/export/Exporter.java"
    click PNGExporter "https://github.com/uladzimirfilipchanka/noredraw/blob/main/noredraw-export/src/main/java/noredraw/export/PngHttpExporter.java"
    click StructurizrExporters "https://github.com/uladzimirfilipchanka/noredraw/blob/main/noredraw-export/src/main/java/noredraw/export/structurizr/StructurizrBasedExporter.java"

    %% Styles
    classDef frontend fill:#BBDEFB,stroke:#333,stroke-width:1px
    classDef plugin fill:#C8E6C9,stroke:#333,stroke-width:1px
    classDef core fill:#90CAF9,stroke:#333,stroke-width:1px
    classDef external fill:#FFE0B2,stroke:#333,stroke-width:1px
```
