# tjmcraft/tjmc-launcher architecture

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

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

## Overview

##### Main Components
- Host (Main Process):
- Located in the “src/main” directory.
- Key files include Host.js, Launcher.js, MainWindow.js, Updater.js along with several “managers” (e.g., AuthManager, ConfigManager, InstallationsManager, InstanceManager, VersionManager) and game-related subcomponents (Minecraft.js, JavaManager.js).
- Responsible for bootstrapping the application, managing native integrations, handling file system operations, launching game processes, and updating the app.
- Render (UI/Renderer Process):
- Found in the “src/render” directory.
- Implements the UI using Preact. Organized into components (e.g., App.tsx, components for authentication, main view components, modals, etc.), state management layers (Store, Reducers, Selectors), and a variety of utility modules.
- Uses IPC libraries (under “src/render/Libs/IPCHostConnect”) to communicate with the main process.
- External Libraries & Tools:
- Libraries such as Electron, electron-builder, fs-extra, and several networking and crypto libraries aid the Host process.
- Frontend uses Babel, Webpack, preact, and an assortment of styling and utility plugins.
- Build and Deployment Artifacts:
- CI/CD and repository tools can be inferred from the “.github” workflows and configuration files indicating automated build and release processes.

##### Relationships and Interactions
- Inter-Process Communication (IPC):
- The Renderer interacts with the Host via specific IPC modules (IPCHostConnect) to execute backend operations.
- Module Dependencies:
- Within the main process, “managers” and game-related modules interact to handle user authentication, configuration setups, installation management, etc.
- On the render side, the UI components access data from the centralized store, managed via a Redux-like pattern (using Actions, Reducers, and Selectors).

##### Architectural Patterns and Design Principles
- Separation of Concerns:
- Clear split between the Host (responsible for system-level tasks and updates) and Render (presentation and user interaction logic).
- IPC Communication:
- Emphasis on clearly defined communication channels between the processes, representing event-driven or message-passing patterns.
- Modular and Scalable Design:
- Multiple managers and utility modules indicate componentization, which can be represented as separate blocks that contribute to the overall functionality.
- Build and Deployment:
- The use of platform-specific build scripts (as seen in package.json and GitHub workflows) indicates CI/CD integration that should be noted (even if in a “deployment pipeline” note).

## Diagram (Mermaid)

```mermaid
flowchart TD 
    subgraph "Main Process (Host)"
        mainCore["Core Services (Host.js, Launcher.js, MainWindow.js, Updater.js, main.js)"]:::backend
        mainManagers["Managers (Auth, Config, Installations, Instance, Version)"]:::backend
        mainGame["Game Modules (Minecraft.js, JavaManager.js)"]:::backend
    end

    subgraph "Renderer Process (UI)"
        renderUI["UI Elements (index.html, index.tsx, App.tsx)"]:::frontend
        renderLogic["State Logic (Actions, Reducers, Selectors)"]:::frontend
        renderStore["Store"]:::frontend
        renderIPC["IPC Communication (IPCHostConnect)"]:::frontend
    end

    subgraph "IPC Modules"
        ipcHost["IPC Host Module (TCHost.js)"]:::ipc
    end

    subgraph "Build & Deployment"
        buildDir["Build Directory"]:::deployment
        assetsDir["Assets"]:::deployment
        cicd["CI/CD Workflows"]:::deployment
        projConfig["Project Config (package.json, webpack.config.js)"]:::deployment
    end

    renderUI -->|"UIEvent"| renderLogic
    renderLogic -->|"UpdateState"| renderStore
    renderStore -->|"TriggerIPC"| renderIPC
    renderIPC -->|"SendIPC"| ipcHost
    ipcHost -->|"ExecuteCommand"| mainCore
    mainCore -->|"ManagerActions"| mainManagers
    mainCore -->|"GameHandling"| mainGame

    click mainCore "https://github.com/tjmcraft/tjmc-launcher/tree/main/src/main"
    click mainManagers "https://github.com/tjmcraft/tjmc-launcher/tree/main/src/main/managers"
    click mainGame "https://github.com/tjmcraft/tjmc-launcher/tree/main/src/main/game"
    click renderUI "https://github.com/tjmcraft/tjmc-launcher/tree/main/src/render/components"
    click renderLogic "https://github.com/tjmcraft/tjmc-launcher/tree/main/src/render/Model"
    click renderStore "https://github.com/tjmcraft/tjmc-launcher/tree/main/src/render/Store"
    click renderIPC "https://github.com/tjmcraft/tjmc-launcher/tree/main/src/render/Libs/IPCHostConnect"
    click ipcHost "https://github.com/tjmcraft/tjmc-launcher/tree/main/src/main/libs"
    click buildDir "https://github.com/tjmcraft/tjmc-launcher/tree/main/build"
    click assetsDir "https://github.com/tjmcraft/tjmc-launcher/tree/main/assets"
    click cicd "https://github.com/tjmcraft/tjmc-launcher/tree/main/.github/workflows"
    click projConfig "https://github.com/tjmcraft/tjmc-launcher/blob/main/package.json"

    classDef backend fill:#ffcccc,stroke:#cc0000,stroke-width:2px;
    classDef frontend fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef deployment fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef ipc fill:#ffeeba,stroke:#856404,stroke-width:2px;
```
