# eraxium-mc/lofty-launcher architecture

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

- Interactive diagram: https://gitdiagram.com/eraxium-mc/lofty-launcher
- Repository: https://github.com/eraxium-mc/lofty-launcher

## Overview

##### Main Components

a. Frontend Layer (UI Components):
- Landing Page (landing.ejs)
- Login System (login.ejs, loginOptions.ejs)
- Settings Panel (settings.ejs)
- Overlay System (overlay.ejs)
- Welcome Screen (welcome.ejs)

b. Core Services Layer:
- Authentication Manager (authmanager.js)
- Configuration Manager (configmanager.js)
- Distribution Manager (distromanager.js)
- Language Manager (langloader.js)
- Discord Integration (discordwrapper.js)

c. System Integration Layer:
- Components for:
- Process Builder (processbuilder.js)
- Server Status Handler (serverstatus.js)
- Drop-in Mod Utility (dropinmodutil.js)

d. Asset Management:
- Containers for:
- Static Assets (images, CSS, fonts)
- Configuration Files
- Language Files

##### Connection Flow

- User Interface → Authentication Manager
- Authentication Manager → Configuration Manager
- Distribution Manager → Process Builder
- Language Manager → UI Components
- Discord Wrapper → External Discord Service

##### Important Architectural Patterns to Highlight

- Event-driven architecture (IPC Constants)
- Service-based modular design
- Multi-language support system
- Configuration management system

##### Technical Details

- Electron Runtime Environment
- Node.js Backend Services
- EJS Template Engine
- Java Integration (libraries/java)

##### External Integrations

- Discord Services
- Microsoft Authentication (referenced in docs/MicrosoftAuth.md)
- Game Distribution System (referenced in docs/distro.md)

##### Development Tools Layer

A separate section for:
- Build System (electron-builder.yml)
- Development Tools (.eslintrc.json)
- CI/CD Pipeline (.github/workflows)

User Interface Layer (Top)
↓
Core Services Layer
↓
System Integration Layer
↓
External Services (Bottom)

This structure reflects the launcher's primary purpose of managing game distributions, handling authentication, and providing a user-friendly interface for game management.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef core fill:#2ecc71,stroke:#27ae60,color:white
    classDef system fill:#f1c40f,stroke:#f39c12,color:black
    classDef assets fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef external fill:#e74c3c,stroke:#c0392b,color:white
    classDef dev fill:#9b59b6,stroke:#8e44ad,color:white

    %% Frontend Layer
    subgraph Frontend
        Landing["Landing Page"]:::ui
        Login["Login System"]:::ui
        Settings["Settings Panel"]:::ui
        Overlay["Overlay System"]:::ui
        Welcome["Welcome Screen"]:::ui
    end

    %% Core Services Layer
    subgraph CoreServices
        AuthMgr["Authentication Manager"]:::core
        ConfigMgr["Configuration Manager"]:::core
        DistroMgr["Distribution Manager"]:::core
        LangMgr["Language Manager"]:::core
        Discord["Discord Integration"]:::core
    end

    %% System Integration Layer
    subgraph SystemIntegration
        ProcessBuilder["Process Builder"]:::system
        ServerStatus["Server Status Handler"]:::system
        ModUtil["Drop-in Mod Utility"]:::system
    end

    %% Asset Management
    subgraph Assets
        StaticAssets["Static Assets"]:::assets
        ConfigFiles["Configuration Files"]:::assets
        LangFiles["Language Files"]:::assets
    end

    %% Development Tools
    subgraph DevTools
        BuildSystem["Build System"]:::dev
        CICD["CI/CD Pipeline"]:::dev
    end

    %% External Services
    DiscordService["Discord Service"]:::external
    MSAuth["Microsoft Authentication"]:::external
    GameDistro["Game Distribution System"]:::external

    %% Relationships
    Frontend --> CoreServices
    CoreServices --> SystemIntegration
    CoreServices --> Assets
    Discord --> DiscordService
    AuthMgr --> MSAuth
    DistroMgr --> GameDistro
    
    %% Click Events
    click Landing "https://github.com/Eraxium-mc/lofty-launcher/blob/V2.2/app/landing.ejs"
    click Login "https://github.com/Eraxium-mc/lofty-launcher/blob/V2.2/app/login.ejs"
    click Settings "https://github.com/Eraxium-mc/lofty-launcher/blob/V2.2/app/settings.ejs"
    click Overlay "https://github.com/Eraxium-mc/lofty-launcher/blob/V2.2/app/overlay.ejs"
    click Welcome "https://github.com/Eraxium-mc/lofty-launcher/blob/V2.2/app/welcome.ejs"
    click AuthMgr "https://github.com/Eraxium-mc/lofty-launcher/blob/V2.2/app/assets/js/authmanager.js"
    click ConfigMgr "https://github.com/Eraxium-mc/lofty-launcher/blob/V2.2/app/assets/js/configmanager.js"
    click DistroMgr "https://github.com/Eraxium-mc/lofty-launcher/blob/V2.2/app/assets/js/distromanager.js"
    click LangMgr "https://github.com/Eraxium-mc/lofty-launcher/blob/V2.2/app/assets/js/langloader.js"
    click Discord "https://github.com/Eraxium-mc/lofty-launcher/blob/V2.2/app/assets/js/discordwrapper.js"
    click ProcessBuilder "https://github.com/Eraxium-mc/lofty-launcher/blob/V2.2/app/assets/js/processbuilder.js"
    click ServerStatus "https://github.com/Eraxium-mc/lofty-launcher/blob/V2.2/app/assets/js/serverstatus.js"
    click ModUtil "https://github.com/Eraxium-mc/lofty-launcher/blob/V2.2/app/assets/js/dropinmodutil.js"
    click StaticAssets "https://github.com/Eraxium-mc/lofty-launcher/tree/V2.2/app/assets/images/"
    click ConfigFiles "https://github.com/Eraxium-mc/lofty-launcher/tree/V2.2/app/assets/config/"
    click LangFiles "https://github.com/Eraxium-mc/lofty-launcher/tree/V2.2/app/assets/lang/"
    click BuildSystem "https://github.com/Eraxium-mc/lofty-launcher/blob/V2.2/electron-builder.yml"
    click CICD "https://github.com/Eraxium-mc/lofty-launcher/blob/V2.2/.github/workflows/build.yml"
    click MSAuth "https://github.com/Eraxium-mc/lofty-launcher/blob/V2.2/docs/MicrosoftAuth.md"
    click GameDistro "https://github.com/Eraxium-mc/lofty-launcher/blob/V2.2/docs/distro.md"

    %% Legend
    subgraph Legend
        UI["UI Components"]:::ui
        Core["Core Services"]:::core
        Sys["System Integration"]:::system
        Asset["Assets"]:::assets
        Ext["External Services"]:::external
        Dev["Development Tools"]:::dev
    end
```
