# tinylake/mindustryx architecture

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

- Interactive diagram: https://gitdiagram.com/tinylake/mindustryx
- Repository: https://github.com/tinylake/mindustryx

## Overview

##### Main Components

a) Core Components:
- Core API Layer (central component)
- Server Module
- Plugin/Mod Interface
- Upstream Mindustry Compatibility Layer

b) Feature Sets:
- API Extensions
- Server Optimizations
- Patch Management System

**┌─────────────────────────────────────────────┐**
- MindustryX                  │
- ┤
- Upstream Mindustry Compatibility Layer      │
- ┬──────────────┬──────────────┤
- Core API   │    Server    │ Plugin/Mod   │
- Extensions  │ Optimizations│  Interface   │
- ┴──────────────┴──────────────┘

##### Key Relationships

a) Patch System Flow:
- How patches are applied from /patches/main and /patches/picked
- Relationship between upstream version and MindustryX version

b) API Integration:
- How new APIs (like LogicBlock.running, SendPacketEvent) connect to the core
- Demonstrate plugin/mod interaction points

##### Implementation Details

Create sections showing:
- Event System (PlayerTeamChangedEvent, LogicAssembledEvent)
- Configuration Systems (Config.locale)
- Performance Optimizations (ControlPathfinder)

##### Deployment Flow

CI/CD pipeline:
**GitHub Actions → Build → JitPack Release**

##### Maintain hierarchy
- Top: Project Overview
- Middle: Core Components
- Bottom: Implementation Details

##### Use clear boundaries
- Separate server-only features
- Distinguish API additions
- Compatibility layers

##### Version flow
- Upstream version relationship
- Patch version progression
- Release cycle

##### Integration points
- Plugin API endpoints
- Mod interaction layers
- Server optimization hooks

Remember to:
- Keep the focus on server-side components as this is primarily a server-focused fork
- API extensions as they're a primary feature
- Clear separation between upstream compatibility and new features
- Patch management flow as it's crucial to the project's structure

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph MindustryX
        API[Core API Layer]:::api
        Server[Server Module]:::server
        Plugin[Plugin/Mod Interface]:::plugin
        Compat[Upstream Mindustry Compatibility]:::compat
        
        subgraph CoreFeatures
            APIExt[API Extensions]:::api
            ServerOpt[Server Optimizations]:::server
            PatchMgmt[Patch Management]:::system
        end
        
        subgraph Implementation
            Events[Event System]:::api
            Config[Configuration Systems]:::system
            Perf[Performance Optimizations]:::server
            Version[Version Management]:::system
        end
        
        subgraph Deployment
            CICD[CI/CD Pipeline]:::deployment
            Build[Build System]:::deployment
            Release[JitPack Release]:::deployment
        end
    end
    
    %% Core Relationships
    API --> APIExt
    API --> Plugin
    Server --> ServerOpt
    Compat --> API
    
    %% Feature Relationships
    APIExt --> Events
    ServerOpt --> Perf
    PatchMgmt --> Version
    
    %% Implementation Details
    Events --> Config
    Perf --> Server
    
    %% Deployment Flow
    CICD --> Build
    Build --> Release
    
    %% Click Events
    click API "https://github.com/TinyLake/MindustryX/blob/main/patches/main/0003-API-MindustryXApi.patch"
    click APIExt "https://github.com/TinyLake/MindustryX/tree/main/patches/main"
    click ServerOpt "https://github.com/TinyLake/MindustryX/tree/main/patches/main"
    click PatchMgmt "https://github.com/TinyLake/MindustryX/tree/main/patches"
    click Events "https://github.com/TinyLake/MindustryX/blob/main/patches/main/0012-API-add-LogicAssembledEvent.patch"
    click Config "https://github.com/TinyLake/MindustryX/blob/main/patches/main/0009-S-add-Config.locale-for-localizedName.patch"
    click Perf "https://github.com/TinyLake/MindustryX/blob/main/patches/main/0010-SO-improve-ControlPathfinder.java-limit-memory-use.patch"
    click Version "https://github.com/TinyLake/MindustryX/blob/main/patches/main/0002-Change-versionType-to-MindustryX.patch"
    click CICD "https://github.com/TinyLake/MindustryX/tree/main/.github/workflows"
    click Build "https://github.com/TinyLake/MindustryX/blob/main/.github/workflows/push.yml"
    click Release "https://github.com/TinyLake/MindustryX/blob/main/jitpack.yml"
    
    %% Styling
    classDef api fill:#2196F3,stroke:#1565C0,color:white
    classDef server fill:#4CAF50,stroke:#2E7D32,color:white
    classDef plugin fill:#FF9800,stroke:#EF6C00,color:white
    classDef compat fill:#9E9E9E,stroke:#616161,color:white
    classDef system fill:#673AB7,stroke:#4527A0,color:white
    classDef deployment fill:#795548,stroke:#4E342E,color:white
    
    %% Legend
    subgraph Legend
        L1[API Components]:::api
        L2[Server Components]:::server
        L3[Plugin Interface]:::plugin
        L4[Compatibility Layer]:::compat
        L5[System Components]:::system
        L6[Deployment Components]:::deployment
    end
```
