# lucas-brt/kreck architecture

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

- Interactive diagram: https://gitdiagram.com/lucas-brt/kreck
- Repository: https://github.com/lucas-brt/kreck

## Overview

##### Main Components

a) Desktop Application Layer (Tauri + Rust):
- GUI Module (src-tauri/src/gui)
- Server Module (src-tauri/src/commands)
- Controller Module (src-tauri/src/controller.rs)
- Network Handler (src-tauri/src/network.rs)

b) Web Interface Layer:
- Create two separate containers:
- Desktop Web Interface (src/)
- Mobile Web Interface (src-mobile/)

c) External Integration:
- A connection to Discord bots and Kenku FM

##### Component Relationships

**[Mobile Device] ←→ [Internal Web Server (Rocket)]**
- ↕
**[Desktop Web UI] ←→ [Tauri Backend] ←→ [Kenku FM]**
- ↕
- [Discord Bots]

##### Detailed Component Breakdown

- Playback endpoints
- Playlist endpoints
- Soundboard endpoints
- Tracks endpoints
- Sounds endpoints

b) Frontend Components:
- Track management
- Playback controls
- Sound controls
- Configuration interface

##### Implementation Details

a) Desktop Application:
**┌─ Tauri Desktop App ─────────────┐**
- ┌─ GUI Layer ─┐ ┌─ Server ───┐ │
- Tray     │ │ - Rocket   │ │
- Windows  │ │ - Endpoints│ │
- ┘ └────────────┘ │
- ┌─ Controller ┐              │
- Commands  │              │
- ┘              │
- ┘

b) Web Interfaces:
**┌─ Web Interfaces ──────────────┐**
- ┌─ Mobile UI ┐ ┌─ Desktop UI┐│
- Tracks   │ │ - Config   ││
- Playback │ │ - QR Code  ││
- ┘ └────────────┘│
- ┘

##### Additional Elements

- Version/environment indicators
- Security boundaries
- Network protocols (HTTP/WebSocket)

##### Key Architectural Patterns to Highlight

- Client-Server architecture
- Event-driven communication
- Multi-platform UI separation
- REST API structure

Remember to:
- Keep the main components visible at a glance
- Use consistent styling throughout
- A brief textual description of key interactions
- Error handling paths
- Asynchronous operations

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Desktop["Desktop Application Layer"]
        TauriApp["Tauri Desktop App"]:::core
        
        subgraph Backend["Backend Components"]
            GUI["GUI Module"]:::core
            Server["Server Module"]:::core
            Controller["Controller Module"]:::core
            Network["Network Handler"]:::core
            
            Server --> Controller
            Controller --> Network
            GUI --> Controller
        end
        
        subgraph Endpoints["Server Endpoints"]
            Play["Playback Endpoints"]:::endpoint
            List["Playlist Endpoints"]:::endpoint
            Sound["Soundboard Endpoints"]:::endpoint
            Track["Tracks Endpoints"]:::endpoint
            SoundE["Sounds Endpoints"]:::endpoint
        end
        
        Server --> Endpoints
    end
    
    subgraph Web["Web Interface Layer"]
        Desktop_UI["Desktop Web Interface"]:::ui
        Mobile_UI["Mobile Web Interface"]:::ui
        
        subgraph Desktop_Components["Desktop Components"]
            Config["Configuration Interface"]:::ui
            QR["QR Code Interface"]:::ui
        end
        
        subgraph Mobile_Components["Mobile Components"]
            PlayControls["Playback Controls"]:::ui
            TrackMgmt["Track Management"]:::ui
        end
        
        Desktop_UI --> Desktop_Components
        Mobile_UI --> Mobile_Components
    end
    
    subgraph External["External Services"]
        Discord["Discord Bots"]:::external
        Kenku["Kenku FM"]:::external
    end
    
    Mobile_UI --> Server
    Desktop_UI --> TauriApp
    TauriApp --> Discord
    TauriApp --> Kenku
    
    %% Click Events
    click GUI "https://github.com/Lucas-BRT/Kreck/tree/main/src-tauri/src/gui/"
    click Server "https://github.com/Lucas-BRT/Kreck/tree/main/src-tauri/src/commands/"
    click Controller "https://github.com/Lucas-BRT/Kreck/blob/main/src-tauri/src/controller.rs"
    click Network "https://github.com/Lucas-BRT/Kreck/blob/main/src-tauri/src/network.rs"
    click Desktop_UI "https://github.com/Lucas-BRT/Kreck/tree/main/src/"
    click Mobile_UI "https://github.com/Lucas-BRT/Kreck/tree/main/src-mobile/"
    click Play "https://github.com/Lucas-BRT/Kreck/blob/main/src-tauri/src/server/endpoints/playback.rs"
    click List "https://github.com/Lucas-BRT/Kreck/blob/main/src-tauri/src/server/endpoints/playlist.rs"
    click Sound "https://github.com/Lucas-BRT/Kreck/blob/main/src-tauri/src/server/endpoints/soundboard.rs"
    click Track "https://github.com/Lucas-BRT/Kreck/blob/main/src-tauri/src/server/endpoints/tracks.rs"
    click SoundE "https://github.com/Lucas-BRT/Kreck/blob/main/src-tauri/src/server/endpoints/sounds.rs"
    click Config "https://github.com/Lucas-BRT/Kreck/blob/main/src/pages/config.html"
    click QR "https://github.com/Lucas-BRT/Kreck/blob/main/src/pages/qrcode.html"
    click PlayControls "https://github.com/Lucas-BRT/Kreck/blob/main/src-mobile/script/handlers/handlePlayPlaybackbar.js"
    click TrackMgmt "https://github.com/Lucas-BRT/Kreck/blob/main/src-mobile/script/components/handleTracks.js"
    
    %% Styling
    classDef core fill:#2374ab
    classDef ui fill:#57a773
    classDef external fill:#ff8c42
    classDef endpoint fill:#984447
    
    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["User Interfaces"]:::ui
        L3["External Services"]:::external
        L4["Endpoints"]:::endpoint
    end
```
