# thith-thith/youtube-music architecture

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

- Interactive diagram: https://gitdiagram.com/thith-thith/youtube-music
- Repository: https://github.com/thith-thith/youtube-music

## Overview

##### Main Application Components

a. Core Application Layer:
- It to the renderer process
- Preload script bridge between main and renderer
- IPC (Inter-Process Communication) channels

b. Plugin Architecture:
- Plugins into categories:
- Audio Processing (e.g., Audio Compressor, Equalizer)
- Integration (e.g., Discord, Scrobbler)
- Feature Enhancement (e.g., Downloader, Navigation)

##### Data Flow Components

a. External Services Integration:
- YouTube Music API connection
- Third-party services (Last.fm, ListenBrainz, Discord)
- Local file system for downloads and configurations

b. Configuration Management:
- Store configuration
- Plugin settings
- User preferences

##### User Interface Components

a. Main Window:
- Custom title bar
- Navigation controls
- Media controls
- Plugin UI elements

b. Additional Windows:
- Picture-in-Picture
- Settings/Configuration interface
- Plugin-specific windows

##### Specific technical details

- I18n system integration
- Plugin loading mechanism
- Event system for media controls
- Build/packaging process

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Core
        Main["Main Process"]:::core
        Renderer["Renderer Process"]:::core
        Preload["Preload Bridge"]:::core
        IPC["IPC Channels"]:::core
    end

    subgraph "Plugin System"
        PluginMgr["Plugin Manager"]:::plugin
        
        subgraph "UI Plugins"
            Menu["In-App Menu"]:::plugin
            Nav["Navigation Controls"]:::plugin
            PiP["Picture-in-Picture"]:::plugin
        end
        
        subgraph "Audio Plugins"
            Comp["Audio Compressor"]:::plugin
            EQ["Equalizer"]:::plugin
            Visual["Visualizer"]:::plugin
        end
        
        subgraph "Integration Plugins"
            Discord["Discord"]:::plugin
            Scrobbler["Last.fm/ListenBrainz"]:::plugin
        end
        
        subgraph "Feature Plugins"
            Download["Downloader"]:::plugin
            Lyrics["Synced Lyrics"]:::plugin
            Notify["Notifications"]:::plugin
        end
    end

    subgraph "External Services"
        YTMusic["YouTube Music API"]:::external
        LastFM["Last.fm API"]:::external
        DiscordAPI["Discord API"]:::external
    end

    subgraph "System Components"
        Config["Configuration Store"]:::system
        I18N["i18n System"]:::system
        MediaCtrl["Media Controls"]:::system
        AppCtrl["App Controls"]:::system
    end

    Main --> Preload
    Preload --> Renderer
    Main <--> IPC
    Renderer <--> IPC
    
    PluginMgr --> Main
    PluginMgr --> Renderer
    
    Config --> PluginMgr
    I18N --> Renderer
    
    MediaCtrl --> Main
    AppCtrl --> Main
    
    Discord --> DiscordAPI
    Scrobbler --> LastFM
    Renderer --> YTMusic

    classDef core fill:#3498db,stroke:#2980b9,color:white
    classDef plugin fill:#2ecc71,stroke:#27ae60,color:white
    classDef external fill:#e67e22,stroke:#d35400,color:white
    classDef system fill:#9b59b6,stroke:#8e44ad,color:white

    click Main "https://github.com/Thith-thith/youtube-music/blob/master/src/loader/main.ts"
    click Renderer "https://github.com/Thith-thith/youtube-music/blob/master/src/loader/renderer.ts"
    click Preload "https://github.com/Thith-thith/youtube-music/blob/master/src/loader/preload.ts"
    click PluginMgr "https://github.com/Thith-thith/youtube-music/blob/master/src/config/plugins.ts"
    click Config "https://github.com/Thith-thith/youtube-music/blob/master/src/config/store.ts"
    click Discord "https://github.com/Thith-thith/youtube-music/tree/master/src/plugins/discord"
    click Scrobbler "https://github.com/Thith-thith/youtube-music/tree/master/src/plugins/scrobbler"
    click Menu "https://github.com/Thith-thith/youtube-music/tree/master/src/plugins/in-app-menu"
    click Nav "https://github.com/Thith-thith/youtube-music/tree/master/src/plugins/navigation"
    click PiP "https://github.com/Thith-thith/youtube-music/tree/master/src/plugins/picture-in-picture"
    click Comp "https://github.com/Thith-thith/youtube-music/blob/master/src/plugins/audio-compressor.ts"
    click EQ "https://github.com/Thith-thith/youtube-music/tree/master/src/plugins/equalizer"
    click Visual "https://github.com/Thith-thith/youtube-music/tree/master/src/plugins/visualizer"
    click Download "https://github.com/Thith-thith/youtube-music/tree/master/src/plugins/downloader"
    click Lyrics "https://github.com/Thith-thith/youtube-music/tree/master/src/plugins/synced-lyrics"
    click Notify "https://github.com/Thith-thith/youtube-music/tree/master/src/plugins/notifications"
    click I18N "https://github.com/Thith-thith/youtube-music/tree/master/src/i18n"
    click MediaCtrl "https://github.com/Thith-thith/youtube-music/blob/master/src/providers/song-controls.ts"
    click AppCtrl "https://github.com/Thith-thith/youtube-music/blob/master/src/providers/app-controls.ts"
```
