# aurorateam/launcher architecture

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

- Interactive diagram: https://gitdiagram.com/aurorateam/launcher
- Repository: https://github.com/aurorateam/launcher

## Overview

##### Main Components

A. Core Application Layer:
- Electron Main Process (`src/main`)
- Electron Renderer Process (`src/renderer`)
- Preload Scripts (`src/preload`)
- IPC Communication Channels (`src/common/channels.ts`)

B. Main Process Components:
- Core System Management
- Launcher Core (`src/main/core/Launcher.ts`)
- System Handler (`src/main/core/System.ts`)
- Window Management (`src/main/core/LauncherWindow.ts`)

- Game Management
- Game Service (`src/main/game/GameService.ts`)
- Java Management (`src/main/game/JavaManager.ts`)
- Authentication (`src/main/game/AuthlibInjector.ts`)
- Update System (`src/main/game/Updater.ts`)
- Game Monitoring (`src/main/game/Watcher.ts`)

- API Layer
- API Management (`src/main/api/APIManager.ts`)
- Authorization Service (`src/main/api/AuthorizationService.ts`)

C. Renderer Components:
- UI Scenes
- Login Scene
- Servers List Scene
- Server Panel Scene
- Shared Components
- Modal System
- Title Bar
- Server Button
- Skin Viewer

##### User Interface Layer (Renderer Process)
- Three main scenes
- Shared components

##### Bridge Layer (Preload Scripts)
- IPC communication channels

##### Core Application Layer (Main Process)
- Related services (Game, API, System)

##### External Systems
- Minecraft Game Instance
- Authentication Server
- Game Content Server

##### Connection Flows

- IPC communication between renderer and main processes
- Game service interactions with Minecraft
- API calls to external services
- File system operations
- Authentication flows

##### Important Details

- Clear separation between Electron processes
- Security boundary between renderer and main processes
- Data flow directions
- State management paths
- File system interaction points
- External API communication points

- Rectangles: Main components
- Hexagons: Services
- Clouds: External services

- Process boundaries
- Security zones

##### UI state management

Keep the abstraction level focused on the architectural components while showing the key interactions that make this launcher function. This will help other developers understand both the structure and the dynamic aspects of the system.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph External
        MC[Minecraft Game Instance]:::game
        AS[Authentication Servers]:::external
        GS[Game Servers]:::external
        US[Update Sources]:::external
    end

    subgraph Renderer
        RC[React Components]:::frontend
        SM1[Scene Management]:::frontend
        UI[UI Components]:::frontend
        click SM1 "https://github.com/AuroraTeam/Launcher/tree/master/src/renderer/runtime/scenes/"
        click UI "https://github.com/AuroraTeam/Launcher/tree/master/src/renderer/runtime/components/"

        subgraph Scenes
            LS[Login Scene]:::scene
            SP[Server Panel]:::scene
            SL[Servers List]:::scene
            click LS "https://github.com/AuroraTeam/Launcher/tree/master/src/renderer/runtime/scenes/Login/"
            click SP "https://github.com/AuroraTeam/Launcher/tree/master/src/renderer/runtime/scenes/ServerPanel/"
            click SL "https://github.com/AuroraTeam/Launcher/tree/master/src/renderer/runtime/scenes/ServersList/"
        end
    end

    subgraph IPC
        PS[Preload Scripts]:::bridge
        IC[IPC Channels]:::bridge
        PB[Preload Bridge]:::bridge
        click PS "https://github.com/AuroraTeam/Launcher/tree/master/src/preload/components/"
        click IC "https://github.com/AuroraTeam/Launcher/blob/master/src/common/channels.ts"
    end

    subgraph Main
        subgraph Core
            LC[Launcher Core]:::core
            SYS[System Management]:::core
            WM[Window Management]:::core
            click LC "https://github.com/AuroraTeam/Launcher/blob/master/src/main/core/Launcher.ts"
            click SYS "https://github.com/AuroraTeam/Launcher/blob/master/src/main/core/System.ts"
            click WM "https://github.com/AuroraTeam/Launcher/blob/master/src/main/core/LauncherWindow.ts"
        end

        subgraph Services
            GMS[Game Service]:::service
            JM[Java Management]:::service
            AUS[Authentication Service]:::service
            LM[Libraries Management]:::service
            US1[Update System]:::service
            click GMS "https://github.com/AuroraTeam/Launcher/blob/master/src/main/game/GameService.ts"
            click JM "https://github.com/AuroraTeam/Launcher/blob/master/src/main/game/JavaManager.ts"
            click AUS "https://github.com/AuroraTeam/Launcher/blob/master/src/main/api/AuthorizationService.ts"
            click LM "https://github.com/AuroraTeam/Launcher/blob/master/src/main/game/LibrariesMatcher.ts"
            click US1 "https://github.com/AuroraTeam/Launcher/blob/master/src/main/game/Updater.ts"
        end

        subgraph Management
            AM[API Manager]:::manager
            GW[Game Window]:::manager
            ST[Storage System]:::manager
            LG[Logging System]:::manager
            PH[Platform Helpers]:::manager
            click AM "https://github.com/AuroraTeam/Launcher/blob/master/src/main/api/APIManager.ts"
            click GW "https://github.com/AuroraTeam/Launcher/blob/master/src/main/game/GameWindow.ts"
            click ST "https://github.com/AuroraTeam/Launcher/blob/master/src/main/helpers/StorageHelper.ts"
            click LG "https://github.com/AuroraTeam/Launcher/blob/master/src/main/helpers/LogHelper.ts"
            click PH "https://github.com/AuroraTeam/Launcher/blob/master/src/main/helpers/PlatformHelper.ts"
        end
    end

    %% Relationships
    RC --> SM1
    SM1 --> Scenes
    Scenes --> UI

    Renderer --> PS
    PS --> IC
    IC --> PB
    PB --> Main

    LC --> SYS
    LC --> WM
    LC --> Services

    GMS --> MC
    AUS --> AS
    GMS --> GS
    US1 --> US

    AM --> Services
    Services --> Management

    %% Styles
    classDef frontend fill:#FFA500,stroke:#333,stroke-width:2px
    classDef bridge fill:#800080,stroke:#333,stroke-width:2px
    classDef core fill:#0000FF,stroke:#333,stroke-width:2px
    classDef service fill:#008000,stroke:#333,stroke-width:2px
    classDef manager fill:#4169E1,stroke:#333,stroke-width:2px
    classDef external fill:#808080,stroke:#333,stroke-width:2px
    classDef game fill:#FF4500,stroke:#333,stroke-width:2px
    classDef scene fill:#DEB887,stroke:#333,stroke-width:2px
```
