# tuxedocomputers/tuxedo-control-center architecture

> Architecture diagram of the GitHub repository tuxedocomputers/tuxedo-control-center, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tuxedocomputers/tuxedo-control-center
- Repository: https://github.com/tuxedocomputers/tuxedo-control-center

## Overview

##### Main Components

a) Frontend Layer:
- Angular GUI Application (ng-app)
- Electron wrapper (e-app)
- User interface components for system monitoring, profiles, tools, and settings

b) Backend Layer:
- Node.js Service Daemon (service-app)
- DBus Interface
- System Controllers (CPU, Fan, Power, etc.)

c) Hardware Interface Layer:
- Native Library Interface (tuxedo_io_lib)
- System File System Controllers
- Hardware Drivers Integration

##### Component Relationships

**[Angular GUI Components] ←→ [Electron Main Process]**
- ↕
**[DBus Interface/Service Layer]**
- ↕
**[System Controllers/Workers]**
- ↕
**[Hardware Interface Layer] ←→ [Physical Hardware]**

##### Detailed Component Breakdown

Frontend Layer:
- Main GUI components (Dashboard, Profile Manager, Tools, Settings)
- Angular services for state management
- Electron main process integration

Service Layer:
- Worker components (ChargingWorker, CpuWorker, FanControlWorker, etc.)
- DBus service interface
- Configuration management

Hardware Interface:
- Native library bindings
- System file system controllers
- Hardware monitoring components

##### Key Interactions to Highlight

- User interface to service communication via DBus
- Service worker interactions with hardware
- Configuration and profile management flow
- State management and monitoring loops

##### Additional Elements

- Data flow direction indicators
- Configuration file locations and their purpose
- External dependencies (tuxedo-io module)

##### Implementation Details

- The modular architecture with clear separation of concerns
- The event-driven nature of the system
- Hardware abstraction layers
- Security boundaries between user interface and system level operations

##### Notes for Implementation

- Version information and system requirements
- Both runtime and build-time relationships

Remember to include the cross-platform nature of the application and how it interfaces with different Linux distributions' specific requirements.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        GUI["Angular GUI Application"]
        EL["Electron Wrapper"]
        subgraph Components
            DASH["Dashboard"]
            PROF["Profile Manager"]
            SETS["Settings"]
            TOOL["Tools"]
        end
        STATE["State Management"]
    end

    subgraph Service
        DBUS["DBus Interface"]
        CONF["Configuration Management"]
        subgraph Workers
            CHGW["Charging Worker"]
            CPUW["CPU Worker"]
            FANW["Fan Control Worker"]
        end
    end

    subgraph Hardware
        HWIF["Hardware Interface Layer"]
        subgraph Controllers
            CPUC["CPU Controller"]
            FANC["Fan Controller"]
            PWRC["Power Controller"]
            USBC["USB Controller"]
        end
        SYSC["System File Controllers"]
    end

    subgraph Physical
        HW["Physical Hardware"]
    end

    %% Frontend Relationships
    GUI --- EL
    GUI --- Components
    DASH & PROF & SETS & TOOL --- STATE
    EL --- DBUS

    %% Service Relationships
    DBUS --- Workers
    Workers --- CONF
    CPUW --- CPUC
    FANW --- FANC
    CHGW --- PWRC

    %% Hardware Relationships
    Controllers --- HWIF
    Controllers --- SYSC
    HWIF --- HW

    %% Styling
    classDef frontend fill:#a8d1f0
    classDef service fill:#90EE90
    classDef hardware fill:#ffb366
    classDef physical fill:#d3d3d3

    class GUI,EL,DASH,PROF,SETS,TOOL,STATE frontend
    class DBUS,CONF,CHGW,CPUW,FANW service
    class HWIF,CPUC,FANC,PWRC,USBC,SYSC hardware
    class HW physical

    %% Click Events
    click GUI "https://github.com/tuxedocomputers/tuxedo-control-center/tree/master/src/ng-app"
    click EL "https://github.com/tuxedocomputers/tuxedo-control-center/tree/master/src/e-app"
    click DBUS "https://github.com/tuxedocomputers/tuxedo-control-center/blob/master/src/service-app/classes/TccDBusInterface.ts"
    click HWIF "https://github.com/tuxedocomputers/tuxedo-control-center/tree/master/src/native-lib/tuxedo_io_lib"
    click CONF "https://github.com/tuxedocomputers/tuxedo-control-center/blob/master/src/common/classes/ConfigHandler.ts"
    click DASH "https://github.com/tuxedocomputers/tuxedo-control-center/tree/master/src/ng-app/app/cpu-dashboard"
    click PROF "https://github.com/tuxedocomputers/tuxedo-control-center/tree/master/src/ng-app/app/profile-manager"
    click SETS "https://github.com/tuxedocomputers/tuxedo-control-center/tree/master/src/ng-app/app/global-settings"
    click TOOL "https://github.com/tuxedocomputers/tuxedo-control-center/tree/master/src/ng-app/app/tools"
    click CPUC "https://github.com/tuxedocomputers/tuxedo-control-center/blob/master/src/common/classes/CpuController.ts"
    click FANC "https://github.com/tuxedocomputers/tuxedo-control-center/blob/master/src/common/classes/FanUtils.ts"
    click PWRC "https://github.com/tuxedocomputers/tuxedo-control-center/blob/master/src/common/classes/PowerController.ts"
    click USBC "https://github.com/tuxedocomputers/tuxedo-control-center/blob/master/src/common/classes/UsbController.ts"
    click STATE "https://github.com/tuxedocomputers/tuxedo-control-center/blob/master/src/ng-app/app/state.service.ts"
    click SYSC "https://github.com/tuxedocomputers/tuxedo-control-center/blob/master/src/common/classes/SysFsController.ts"
```
