# lucas-brt/kenku_control architecture

> Architecture diagram of the GitHub repository lucas-brt/kenku_control, 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/kenku_control
- Repository: https://github.com/lucas-brt/kenku_control

## Overview

##### Project Type Analysis
This is a Rust library project that serves as a control interface for Kenku FM, focusing on audio playback and management. It's primarily an API wrapper/controller library.

##### Main Components

A. Core Components:
- Controller Module (Main Interface)
- Soundboard Module
- Playlist Module
- Utils Module

B. External Components:
- Kenku FM Remote
- Client Application (Consumer)

**Top Layer (Client Applications):**
- [Client Applications] --> Shows how external applications consume the library

**Middle Layer (Kenku Control Library):**
- [Controller]
- [Soundboard Module]
- [Playlist Module]
- [Utils Module]

**Bottom Layer (External Service):**
- [Kenku FM Remote]

##### Specific Elements

a) Components:
- Use rectangles for modules
- Use hexagons for external interfaces
- Use rounded rectangles for core functionality

b) Connections:
- Double lines for TCP/IP connections (between Controller and Kenku FM Remote)

- Blue: Core library components
- Green: External interfaces
- Gray: Supporting utilities
- Orange: Client applications

##### Implementation Details to Highlight

- TCP/IP connection (port 3333) between Controller and Kenku FM Remote
- Async communication patterns (since the library uses async/await)
- Main public interfaces for each module
- Error handling pathways

**Client Layer:**
- [External Rust Applications] --> Shows how clients implement the library

**Library Core:**
- [Controller]
- new(host: String, port: u16)
- get_soundboard()
- playlist controls

**Module Layer:**
- [Soundboard Module]
- Sound management
- Playback controls

- [Playlist Module]
- Playlist management
- Track controls

- [Utils Module]
- Helper functions
- Common utilities

**External Service:**
- [Kenku FM Remote]
- TCP/IP Interface (Port 3333)

##### Testing Integration

A section showing how the test modules interact with the system:
- Basic Commands Test
- Basic Usage Test
- Playlist Playback Test

Remember to use standardized UML or C4 model notation where appropriate, but prioritize clarity and understanding over strict adherence to any particular notation system.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef client fill:#FFA500,stroke:#000
    classDef core fill:#4682B4,stroke:#000
    classDef module fill:#6495ED,stroke:#000
    classDef utils fill:#808080,stroke:#000
    classDef external fill:#90EE90,stroke:#000
    classDef test fill:#DEB887,stroke:#000

    %% Client Layer
    Client["External Rust Applications"]:::client

    %% Core Library Layer
    Controller["Controller<br/>(Main Interface)<br/>- new(host, port)<br/>- get_soundboard()<br/>- playlist controls"]:::core
    click Controller "https://github.com/Lucas-BRT/kenku_control/blob/main/src/lib.rs"

    %% Module Layer
    Soundboard["Soundboard Module<br/>- Sound Management<br/>- Playback Controls"]:::module
    click Soundboard "https://github.com/Lucas-BRT/kenku_control/blob/main/src/soundboard.rs"

    Playlist["Playlist Module<br/>- Playlist Management<br/>- Track Controls"]:::module
    click Playlist "https://github.com/Lucas-BRT/kenku_control/blob/main/src/playlist.rs"

    Utils["Utils Module<br/>- Helper Functions<br/>- Common Utilities"]:::module
    click Utils "https://github.com/Lucas-BRT/kenku_control/blob/main/src/utils.rs"

    %% External Service Layer
    KenkuFM["Kenku FM Remote<br/>(TCP/IP Port 3333)"]:::external

    %% Test Layer
    subgraph Tests
        BasicCmd["Basic Commands Test"]:::test
        click BasicCmd "https://github.com/Lucas-BRT/kenku_control/blob/main/tests/basic_commands_test.rs"
        BasicUsage["Basic Usage Test"]:::test
        click BasicUsage "https://github.com/Lucas-BRT/kenku_control/blob/main/tests/basic_usage_test.rs"
        PlaylistTest["Playlist Playback Test"]:::test
        click PlaylistTest "https://github.com/Lucas-BRT/kenku_control/blob/main/tests/playlist_playback_test.rs"
    end

    %% Relationships
    Client --> Controller
    Controller --> Soundboard
    Controller --> Playlist
    Controller --> Utils
    Controller -.->|TCP/IP| KenkuFM
    Soundboard --> Utils
    Playlist --> Utils
    BasicCmd -.->|Tests| Controller
    BasicUsage -.->|Tests| Controller
    PlaylistTest -.->|Tests| Controller

    %% Legend
    subgraph Legend
        L1["Client Application"]:::client
        L2["Core Component"]:::core
        L3["Module"]:::module
        L4["Utilities"]:::utils
        L5["External Service"]:::external
        L6["Test Component"]:::test
    end
```
