# yupiik/fusion architecture

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

- Interactive diagram: https://gitdiagram.com/yupiik/fusion
- Repository: https://github.com/yupiik/fusion

## Overview

##### Main Components

a) Core Framework Layer:
- fusion-api: Core framework APIs and container management
- fusion-processor: Build-time processing and code generation
- fusion-build-api: Build system integration

b) Web Layer:
- fusion-http-server: HTTP server implementation
- fusion-jsonrpc: JSON-RPC support
- fusion-httpclient: HTTP client functionality

c) Data Layer:
- fusion-json: JSON processing
- fusion-persistence: Database integration
- fusion-handlebars: Template engine

d) Infrastructure Layer:
- fusion-kubernetes-operator-base: Kubernetes integration
- fusion-jwt: Security and authentication
- fusion-tracing: Distributed tracing
- fusion-observability: Metrics and monitoring

##### Relationships and Flow

**Build Time                     Runtime**

- Processor  |-------------->| Container      |
- generates    | Runtime        |

- v

- HTTP Server     |
- JSON Processing |
- Persistence     |

##### Component Details

- Blue rectangles: Core components
- Green hexagons: Web-related components
- Purple diamonds: Infrastructure services

##### Integration Points

Integration with:
- GraalVM native image
- Kubernetes clusters
- Database systems
- Monitoring systems

##### Architectural Patterns

Emphasize:
- Build-time processing
- Dependency injection
- Event-driven components
- Modular design

This architecture should reflect Fusion's core values of build-time orientation, flexibility, and native-friendliness while showing how all components work together to create a high-performance web framework.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Build ["Build Time Processing"]
        Processor["Build-time Processor"]:::processor
        BuildAPI["Build System Integration"]:::build
        CodeGen["Code Generation"]:::processor
    end

    subgraph Runtime ["Runtime Environment"]
        Container["Container Management"]:::core
        BeanRes["Bean Resolution"]:::core
        
        subgraph Web ["Web Layer"]
            HTTPServer["HTTP Server"]:::web
            JSONRPC["JSON-RPC"]:::web
            HTTPClient["HTTP Client"]:::web
        end
        
        subgraph Data ["Data Layer"]
            JSON["JSON Processing"]:::data
            Persistence["Database Integration"]:::data
            Templates["Template Processing"]:::data
        end
    end

    subgraph Infra ["Infrastructure Layer"]
        K8s["Kubernetes Integration"]:::infra
        JWT["Security & Auth"]:::infra
        Tracing["Distributed Tracing"]:::infra
        Observability["Monitoring & Metrics"]:::infra
    end

    %% Build Time Relationships
    Processor --> CodeGen
    CodeGen --> Container
    BuildAPI --> Container

    %% Runtime Relationships
    Container --> BeanRes
    BeanRes --> Web
    BeanRes --> Data
    
    %% Web Layer Internal
    HTTPServer --> JSONRPC
    HTTPServer --> HTTPClient
    
    %% Data Layer Internal
    JSON --> Persistence
    JSON --> Templates
    
    %% Infrastructure Integration
    Web --> Infra
    Data --> Infra
    
    %% Click Events
    click Processor "https://github.com/yupiik/fusion/tree/master/fusion-processor/"
    click BuildAPI "https://github.com/yupiik/fusion/tree/master/fusion-build-api/"
    click Container "https://github.com/yupiik/fusion/blob/master/fusion-api/src/main/java/io/yupiik/fusion/framework/api/RuntimeContainer.java"
    click BeanRes "https://github.com/yupiik/fusion/blob/master/fusion-api/src/main/java/io/yupiik/fusion/framework/api/container/Beans.java"
    click CodeGen "https://github.com/yupiik/fusion/blob/master/fusion-processor/src/main/java/io/yupiik/fusion/framework/processor/FusionProcessor.java"
    click HTTPServer "https://github.com/yupiik/fusion/blob/master/fusion-http-server/src/main/java/io/yupiik/fusion/http/server/api/WebServer.java"
    click JSONRPC "https://github.com/yupiik/fusion/tree/master/fusion-jsonrpc/"
    click HTTPClient "https://github.com/yupiik/fusion/tree/master/fusion-httpclient-parent/fusion-httpclient/"
    click JSON "https://github.com/yupiik/fusion/blob/master/fusion-json/src/main/java/io/yupiik/fusion/json/JsonMapper.java"
    click Persistence "https://github.com/yupiik/fusion/blob/master/fusion-persistence/src/main/java/io/yupiik/fusion/persistence/api/Database.java"
    click Templates "https://github.com/yupiik/fusion/tree/master/fusion-handlebars/"
    click K8s "https://github.com/yupiik/fusion/tree/master/fusion-kubernetes-operator-base/"
    click JWT "https://github.com/yupiik/fusion/tree/master/fusion-jwt/"
    click Tracing "https://github.com/yupiik/fusion/tree/master/fusion-tracing/"
    click Observability "https://github.com/yupiik/fusion/tree/master/fusion-observability/"

    %% Styling
    classDef processor fill:#ff9900,stroke:#333,stroke-width:2px
    classDef build fill:#ffcc00,stroke:#333,stroke-width:2px
    classDef core fill:#3498db,stroke:#333,stroke-width:2px
    classDef web fill:#2ecc71,stroke:#333,stroke-width:2px
    classDef data fill:#e74c3c,stroke:#333,stroke-width:2px
    classDef infra fill:#9b59b6,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        P["Processor"]:::processor
        B["Build"]:::build
        C["Core"]:::core
        W["Web"]:::web
        D["Data"]:::data
        I["Infrastructure"]:::infra
    end
```
