# galaxy-projects/uniflow architecture

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

- Interactive diagram: https://gitdiagram.com/galaxy-projects/uniflow
- Repository: https://github.com/galaxy-projects/uniflow

## Overview

##### Project type and purpose
- Uniflow is a Java library (not a standalone application) whose purpose is to provide a unified, platform-agnostic API for Java code processing on two platforms:
- The Java compiler’s AST (via javac/AP)
- The IntelliJ IDEA PSI (via IntelliJ plugin SDK)
- It exposes a common model (UniElement, UniClass, UniMethod, etc.), factory abstractions for code generation (UniElementFactory), logging/diagnostics (UniMessager), and file generation (UniFiler).

##### README for architectural clues
- Emphasis on factory abstraction over platform-specific APIs
- Dual initialization paths for two environments
- Shared logic (common model, logging, file generation) kept separate from platform bridges

##### Final checklist
– All major components labeled
– Notation of key classes or interfaces at each boundary
– Annotations noting design patterns (e.g., «Adapter», «Factory»)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Clients Layer
    subgraph "Clients"
        AP["Annotation Processor"]:::client
        IP["IntelliJ Plugin"]:::client
    end

    %% Facade
    UF["Uniflow Facade\n(Uniflow.initForJavac/initForIntelliJ)"]:::core

    %% Adapters Layer
    subgraph "Platform Adapters"
        JA["Javac Adapter\n«Adapter»"]:::adapter
        IA["IntelliJ Adapter\n«Adapter»"]:::adapter
    end

    %% Core Model & Utilities
    subgraph "Core Model & Utilities"
        CM["Common Model\n(UniElement, UniClass, UniMethod…)"]:::core
        LG["Logging & Diagnostics\n(UniMessager)"]:::core
        FG["File Generation\n(UniFiler)"]:::core
    end

    %% External Platforms
    subgraph "External Platforms"
        JC["Java Compiler\n(AST, TreeMaker, Filer)"]:::external
        IPF["IntelliJ PSI\n(PsiElementFactory, VFS)"]:::external
    end

    %% Documentation
    subgraph "Project Documentation"
        RD["README.md"]:::doc
        GH[".github/"]:::doc
        LI["LICENSE"]:::doc
    end

    %% Connections
    AP -->|"initForJavac"| UF
    IP -->|"initForIntelliJ"| UF
    UF --> JA
    UF --> IA
    JA --> CM
    JA --> LG
    JA --> FG
    IA --> CM
    IA --> LG
    IA --> FG
    JA -->|"uses AST & Filer"| JC
    IA -->|"uses PSI & VFS"| IPF

    %% Click Events
    click RD "https://github.com/galaxy-projects/uniflow/blob/main/README.md"
    click GH "https://github.com/galaxy-projects/uniflow/tree/main/.github/"
    click LI "https://github.com/galaxy-projects/uniflow/tree/main/LICENSE"

    %% Styles
    classDef client fill:#f9c784,stroke:#e38b00,color:#000
    classDef adapter fill:#a8e6cf,stroke:#2e7d32,color:#000
    classDef core fill:#d0e1f9,stroke:#1565c0,color:#000
    classDef external fill:#eeeeee,stroke:#757575,color:#000
    classDef doc fill:#ffe6e6,stroke:#d32f2f,color:#000
```
