# justjoostnl/f1mv-lights-integration architecture

> Architecture diagram of the GitHub repository justjoostnl/f1mv-lights-integration, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/justjoostnl/f1mv-lights-integration
- Repository: https://github.com/justjoostnl/f1mv-lights-integration

## Overview

##### Project Type and Purpose
- The README and file tree confirm that this project is an Electron desktop application that integrates smart lights with the MultiViewer experience.
- It is built with modern web stack components (TypeScript, React/Vite) and uses a variety of integration modules to support different smart lighting protocols (Philips Hue, OpenRGB, Home Assistant, etc.).

##### File Structure
- Top-Level Structure:
- Configuration files (.eslintrc.json, .prettierrc, tsconfig files) and build/deployment scripts (electron-builder.json5, build directory, etc.).
- A clear separation into directories such as “src/main”, “src/preload”, and “src/renderer” indicates the traditional Electron application architecture: main process, preload scripts (bridging between main and renderer), and frontend UI (React).
- Inside src/main:
- You have subdirectories like “analytics”, “deeplinking”, “ipc”, “lightController”, and “multiviewer”. These indicate that the main process handles analytics, deep linking, inter-process communication (IPC), and especially the light control functionality through various integrations. The lightController directory further divides into integration modules for different protocols (Discord, Govee, Home Assistant, Homebridge, MQTT, OpenRGB, Philips Hue, etc.).
- Inside src/preload:
- Contains modules that mirror the IPC functions found in the main process. These ensure secure communication between the renderer and main processes.
- Inside src/renderer:
- This folder holds React components, pages, hooks, and assets for building the UI. Components for event editing, home page functions, integrations monitoring, and settings highlight the interactive aspects of the application.
- Shared and configuration directories:
- In “src/shared”, you find configurations and types that are shared across different parts of the application (like integrations and updater modules).

##### README
- The README confirms the application’s purpose—to connect smart home lights with MultiViewer—and cites the technologies used (Electron, React, Vite, Socket.io, etc.).

##### Elements
- Labels: Each component (Main Process, Renderer, Preload, and integration modules) and external services should be clearly labeled.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Renderer Process"
        renderer["Renderer Process (React UI)"]:::renderer
    end

    subgraph "Preload Scripts"
        preload["Preload Scripts"]:::preload
    end

    subgraph "Main Electron Process"
        main["Main Process"]:::main
        subgraph "Integration Modules"
            philipsHue["Philips Hue Module"]:::integration
            openrgb["OpenRGB Module"]:::integration
            homeAssistant["Home Assistant Module"]:::integration
            govee["Govee Module"]:::integration
            discord["Discord Module"]:::integration
            mqtt["MQTT Module"]:::integration
            homebridge["Homebridge Module"]:::integration
            tradfri["Tradfri Module"]:::integration
            streamdeck["Streamdeck Module"]:::integration
            webserver["Webserver Module"]:::integration
            wled["WLED Module"]:::integration
        end
        multiviewer["MultiViewer Integration"]:::external
    end

    renderer -->|"IPC_Request"| preload
    preload -->|"Forward_IPC"| main
    main -->|"Call_Philips_Hue"| philipsHue
    main -->|"Call_OpenRGB"| openrgb
    main -->|"Call_Home_Assistant"| homeAssistant
    main -->|"Call_Govee"| govee
    main -->|"Call_Discord"| discord
    main -->|"Call_MQTT"| mqtt
    main -->|"Call_Homebridge"| homebridge
    main -->|"Call_Tradfri"| tradfri
    main -->|"Call_Streamdeck"| streamdeck
    main -->|"Call_Webserver"| webserver
    main -->|"Call_WLED"| wled
    main -->|"Connect_MultiViewer"| multiviewer

    click renderer "https://github.com/justjoostnl/f1mv-lights-integration/tree/master/src/renderer"
    click preload "https://github.com/justjoostnl/f1mv-lights-integration/tree/master/src/preload"
    click main "https://github.com/justjoostnl/f1mv-lights-integration/tree/master/src/main"
    click philipsHue "https://github.com/justjoostnl/f1mv-lights-integration/tree/master/src/main/lightController/integrations/philipsHue"
    click openrgb "https://github.com/justjoostnl/f1mv-lights-integration/tree/master/src/main/lightController/integrations/openrgb"
    click homeAssistant "https://github.com/justjoostnl/f1mv-lights-integration/tree/master/src/main/lightController/integrations/homeAssistant"
    click govee "https://github.com/justjoostnl/f1mv-lights-integration/tree/master/src/main/lightController/integrations/govee"
    click discord "https://github.com/justjoostnl/f1mv-lights-integration/tree/master/src/main/lightController/integrations/discord"
    click mqtt "https://github.com/justjoostnl/f1mv-lights-integration/tree/master/src/main/lightController/integrations/mqtt"
    click homebridge "https://github.com/justjoostnl/f1mv-lights-integration/tree/master/src/main/lightController/integrations/homebridge"
    click tradfri "https://github.com/justjoostnl/f1mv-lights-integration/tree/master/src/main/lightController/integrations/tradfri"
    click streamdeck "https://github.com/justjoostnl/f1mv-lights-integration/tree/master/src/main/lightController/integrations/streamdeck"
    click webserver "https://github.com/justjoostnl/f1mv-lights-integration/tree/master/src/main/lightController/integrations/webserver"
    click wled "https://github.com/justjoostnl/f1mv-lights-integration/tree/master/src/main/lightController/integrations/wled"
    click multiviewer "https://github.com/justjoostnl/f1mv-lights-integration/tree/master/src/main/multiviewer"

    classDef renderer fill:#E3F2FD,stroke:#039BE5,stroke-width:2px;
    classDef preload fill:#FFF9C4,stroke:#FBC02D,stroke-width:2px;
    classDef main fill:#C8E6C9,stroke:#388E3C,stroke-width:2px;
    classDef integration fill:#FFECB3,stroke:#FFA000,stroke-width:2px;
    classDef external fill:#FFCDD2,stroke:#D32F2F,stroke-width:2px;
```
