# luuxis/selvania-launcher architecture

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

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

## Overview

##### Project type and purpose
- From the file tree (build.js, package.json, src/app.js, js/windows, IPC-style utils) and README (desktop installer binaries, auto-update via GitHub, Windows/Linux/macOS), this is an Electron-based desktop launcher (“CraftLaunch”) for Minecraft.
- Its main purpose is to provide a cohesive UI for authentication, version and mod management, news feed, server status, automatic Java installation, and self-updates.

##### File structure
- Top-level:
- build.js & .github/workflows/build.yml → build and CI pipeline (GitHub Actions)
- package.json → dependencies (Electron, Node modules)
- docs/ → user and developer docs
- src/
- app.js → Electron main process entry point
- index.html, launcher.html → renderer entry HTML pages
- js/
– windows/ → definitions for `mainWindow.js` (launcher UI) and `updateWindow.js`
– panels/ + panels HTML → individual renderer views (home, login, settings)
– utils/ → modular services (config, database, logger, popup, skin, slider)
- No separate “backend” folder because Electron’s main process acts as your back end.

##### README for additional insights
- Features: auto-updates (GitHub), MS authentication, mod support, news, server status, Java management
- Target platforms: Windows, Linux, macOS

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Main Process
    subgraph "Main Process"
        MP["Electron Main Process\n(app.js)"]:::mainproc
    end
    click MP "https://github.com/luuxis/selvania-launcher/blob/master/src/app.js"

    %% CI/CD Pipeline
    subgraph "CI/CD Pipeline"
        CI1["build.js"]:::ci
        CI2[".github/workflows/build.yml"]:::ci
    end
    click CI1 "https://github.com/luuxis/selvania-launcher/blob/master/build.js"
    click CI2 "https://github.com/luuxis/selvania-launcher/blob/master/.github/workflows/build.yml"

    %% Renderer Layer
    subgraph "Renderer Layer"
        direction TB
        subgraph "Windows"
            MW["Main Window\n(mainWindow.js)"]:::renderer
            UW["Update Window\n(updateWindow.js)"]:::renderer
        end
        subgraph "Shells"
            SH1["Launcher Shell\n(index.html)"]:::renderer
            SH2["Update Shell\n(launcher.html)"]:::renderer
        end
        subgraph "Panels"
            HP["Home Panel\n(home.html)"]:::renderer
            LP["Login Panel\n(login.html)"]:::renderer
            SP["Settings Panel\n(settings.html)"]:::renderer
        end
        subgraph "Panel Controllers"
            HC["Home Logic\n(home.js)"]:::renderer
            LC["Login Logic\n(login.js)"]:::renderer
            SC["Settings Logic\n(settings.js)"]:::renderer
        end
    end
    click MW "https://github.com/luuxis/selvania-launcher/blob/master/src/assets/js/windows/mainWindow.js"
    click UW "https://github.com/luuxis/selvania-launcher/blob/master/src/assets/js/windows/updateWindow.js"
    click SH1 "https://github.com/luuxis/selvania-launcher/blob/master/src/index.html"
    click SH2 "https://github.com/luuxis/selvania-launcher/blob/master/src/launcher.html"
    click HP "https://github.com/luuxis/selvania-launcher/blob/master/src/panels/home.html"
    click LP "https://github.com/luuxis/selvania-launcher/blob/master/src/panels/login.html"
    click SP "https://github.com/luuxis/selvania-launcher/blob/master/src/panels/settings.html"
    click HC "https://github.com/luuxis/selvania-launcher/blob/master/src/assets/js/panels/home.js"
    click LC "https://github.com/luuxis/selvania-launcher/blob/master/src/assets/js/panels/login.js"
    click SC "https://github.com/luuxis/selvania-launcher/blob/master/src/assets/js/panels/settings.js"

    %% Utilities
    subgraph "Utility Modules"
        direction TB
        UM1["Config Manager\n(config.js)"]:::util
        UM2["Local Database\n(database.js)"]:::util
        UM3["Logger Service\n(logger.js)"]:::util
        UM4["Popup Manager\n(popup.js)"]:::util
        subgraph "Skin & Theme Engine"
            SK1["Core Skin API\n(skin.js)"]:::util
            SK2["2D Skin Renderer\n(Skin/skin2D.js)"]:::util
            SK3["Skin Table Helper\n(Skin/table.js)"]:::util
        end
        UM5["UI Helper\n(slider.js)"]:::util
        UB["Global Utils Bundle\n(utils.js)"]:::util
    end
    click UM1 "https://github.com/luuxis/selvania-launcher/blob/master/src/assets/js/utils/config.js"
    click UM2 "https://github.com/luuxis/selvania-launcher/blob/master/src/assets/js/utils/database.js"
    click UM3 "https://github.com/luuxis/selvania-launcher/blob/master/src/assets/js/utils/logger.js"
    click UM4 "https://github.com/luuxis/selvania-launcher/blob/master/src/assets/js/utils/popup.js"
    click SK1 "https://github.com/luuxis/selvania-launcher/blob/master/src/assets/js/utils/skin.js"
    click SK2 "https://github.com/luuxis/selvania-launcher/blob/master/src/assets/js/utils/Skin/skin2D.js"
    click SK3 "https://github.com/luuxis/selvania-launcher/blob/master/src/assets/js/utils/Skin/table.js"
    click UM5 "https://github.com/luuxis/selvania-launcher/blob/master/src/assets/js/utils/slider.js"
    click UB "https://github.com/luuxis/selvania-launcher/blob/master/src/assets/js/utils.js"

    %% Static Assets
    subgraph "Static Assets"
        CSS["CSS Stylesheets\n(src/assets/css/)"]:::static
        IMG["Images & Icons\n(src/assets/images/)"]:::static
    end
    click CSS "https://github.com/luuxis/selvania-launcher/tree/master/src/assets/css/"
    click IMG "https://github.com/luuxis/selvania-launcher/tree/master/src/assets/images/"

    %% OS & Java Installer
    OS["OS/Java Installer\n(child_process)"]:::os
    %% External Services
    subgraph "External Services"
        GH["GitHub API"]:::external
        MS["Microsoft OAuth"]:::external
        MC["Minecraft Servers/API"]:::external
        NF["News Feed API"]:::external
    end

    %% Connections
    %% Renderer IPC to Main
    MW -->|"IPC: renderer-ready"| MP
    UW -->|"IPC: update-ready"| MP
    HP -->|"IPC: fetchHomeData"| MP
    LP -->|"IPC: login.submit"| MP
    SP -->|"IPC: saveSettings"| MP

    %% Main uses Utilities
    MP -.->|"uses"| UM1
    MP -.->|"uses"| UM2
    MP -.->|"uses"| UM3
    MP -.->|"uses"| UM4
    MP -.->|"uses"| SK1
    MP -.->|"uses"| SK2
    MP -.->|"uses"| SK3
    MP -.->|"uses"| UM5
    MP -.->|"bundle via"| UB

    %% Main to External
    MP ===>|"checkUpdates() / download"| GH
    MP ===>|"authenticate()"| MS
    MP ===>|"fetchStatus()"| MC
    MP ===>|"fetchNews()"| NF

    %% Main to OS Installer
    MP -->|"installJava()"| OS

    %% Windows load Shells and Panels
    MW --> SH1
    MW --> HP
    MW --> LP
    MW --> SP
    UW --> SH2

    %% Panel Controllers to HTML Panels
    HC --> HP
    LC --> LP
    SC --> SP

    %% Styles
    classDef mainproc fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef util fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef renderer fill:#ccffcc,stroke:#333,stroke-width:1px
    classDef external fill:#ffe5b4,stroke:#333,stroke-width:1px
    classDef os fill:#e0e0e0,stroke:#333,stroke-width:1px
    classDef ci fill:#e5ffe5,stroke:#333,stroke-width:1px
    classDef static fill:#f2f2f2,stroke:#333,stroke-width:1px
```
