# ximatai/muyun architecture

> Architecture diagram of the GitHub repository ximatai/muyun, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ximatai/muyun
- Repository: https://github.com/ximatai/muyun

## Overview

##### Main Components Identification

a. Core Framework Components:
- muyun-core: Base framework functionality
- muyun-boot: Application bootstrap and runtime
- muyun-platform: Platform-specific features
- muyun-database: Database access layer
- muyun-authorization: Authentication/authorization
- muyun-fileserver: File management system
- muyun-proxy: Reverse proxy functionality
- muyun-log: Logging system

b. Runtime Components:
- muyun-runtime-gateway: Gateway implementation
- muyun-runtime-session: Session management

##### Architecture Layers

**Client Layer**

**API Gateway Layer (muyun-proxy)**

**Application Layer (muyun-boot)**
- Platform Services (muyun-platform)
- Authorization (muyun-authorization)
- File Server (muyun-fileserver)
- Logging (muyun-log)

**Core Framework Layer (muyun-core)**

**Data Access Layer (muyun-database)**

**Database Layer (PostgreSQL)**

##### Component Interactions

- Client → Gateway: HTTP/WebSocket requests
- Gateway → Application: Request routing
- Application → Core: Framework services
- Core → Database: Data access
- Platform Services ↔ Core: Business logic
- All Components → Logging: System-wide logging

##### Key Features to Highlight

- Synchronous/Asynchronous dual-track support
- Cloud-native capabilities
- Security features (authentication, authorization)
- File management system
- Message broadcasting system
- Data validation and encryption

##### Additional Elements

Annotations for:
- Docker container boundaries
- External service integrations
- WebSocket connections
- Event broadcasting paths
- Data flow directions

##### Technical Details

Technical specifications such as:
- Java 21 runtime
- PostgreSQL database
- Quarkus framework
- Docker/container support
- WebSocket/SockJS support

## Diagram (Mermaid)

```mermaid
graph TB
    %% Client Layer
    Client[Client Applications]

    %% API Gateway Layer
    subgraph Gateway
        Proxy["API Gateway/Proxy"]:::gateway
        GatewayRuntime["Gateway Runtime"]:::runtime
    end

    %% Application Layer
    subgraph AppLayer["Application Layer"]
        Boot["Boot Application"]:::app
        SessionRuntime["Session Runtime"]:::runtime
    end

    %% Platform Services Layer
    subgraph PlatformLayer["Platform Services"]
        Platform["Platform Services"]:::platform
        MessageBroadcast["Message Broadcasting"]:::platform
        FileServer["File Server"]:::platform
        Auth["Authorization System"]:::security
    end

    %% Core Framework Layer
    subgraph CoreLayer["Core Framework"]
        Core["Core Framework"]:::core
        Security["Security Components"]:::security
    end

    %% Data Layer
    subgraph DataLayer["Data Layer"]
        Database["Database Access Layer"]:::data
        Logging["Logging System"]:::system
        PostgreSQL[(PostgreSQL)]:::database
    end

    %% Relationships
    Client --> Proxy
    Proxy --> GatewayRuntime
    GatewayRuntime --> Boot
    Boot --> SessionRuntime
    Boot --> Platform
    Platform --> Core
    Platform --> MessageBroadcast
    Platform --> FileServer
    Platform --> Auth
    Core --> Security
    Core --> Database
    Database --> PostgreSQL
    
    %% System-wide logging
    Proxy & GatewayRuntime & Boot & Platform & Core & Database --> Logging

    %% Styling
    classDef gateway fill:#f9a,stroke:#333
    classDef runtime fill:#9f9,stroke:#333
    classDef app fill:#99f,stroke:#333
    classDef platform fill:#f90,stroke:#333
    classDef core fill:#09f,stroke:#333
    classDef security fill:#c9f,stroke:#333
    classDef data fill:#999,stroke:#333
    classDef system fill:#ccc,stroke:#333
    classDef database fill:#666,stroke:#333

    %% Click events
    click Core "https://github.com/ximatai/MuYun/tree/master/muyun-core/src/main/java/net/ximatai/muyun/core/"
    click Boot "https://github.com/ximatai/MuYun/blob/master/muyun-boot/src/main/java/net/ximatai/muyun/boot/MainApp.java"
    click Platform "https://github.com/ximatai/MuYun/tree/master/muyun-platform/src/main/java/net/ximatai/muyun/platform/"
    click Database "https://github.com/ximatai/MuYun/tree/master/muyun-database/src/main/java/net/ximatai/muyun/database/"
    click Auth "https://github.com/ximatai/MuYun/blob/master/muyun-authorization/src/main/java/net/ximatai/muyun/authorization/AuthorizationService.java"
    click FileServer "https://github.com/ximatai/MuYun/blob/master/muyun-fileserver/src/main/java/net/ximatai/muyun/fileserver/FileServer.java"
    click Proxy "https://github.com/ximatai/MuYun/blob/master/muyun-proxy/src/main/java/net/ximatai/muyun/proxy/MuYunProxy.java"
    click Logging "https://github.com/ximatai/MuYun/tree/master/muyun-log/src/main/java/net/ximatai/muyun/log/"
    click GatewayRuntime "https://github.com/ximatai/MuYun/blob/master/muyun-runtime-gateway/src/main/java/net/ximatai/muyun/runtime/gateway/GatewayRuntimeProvider.java"
    click SessionRuntime "https://github.com/ximatai/MuYun/blob/master/muyun-runtime-session/src/main/java/net/ximatai/muyun/runtime/session/SessionRuntimeProvider.java"
    click Security "https://github.com/ximatai/MuYun/tree/master/muyun-core/src/main/java/net/ximatai/muyun/core/security/"
    click MessageBroadcast "https://github.com/ximatai/MuYun/blob/master/muyun-platform/src/main/java/net/ximatai/muyun/platform/service/MessageCenter.java"
```
