# mdanisulh/fusic architecture

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

- Interactive diagram: https://gitdiagram.com/mdanisulh/fusic
- Repository: https://github.com/mdanisulh/fusic

## Overview

##### Main Components

A. Frontend Layer (Next.js Application):
- Client-side Components
- Server-side Components
- API Routes

B. Core Features:
- Music Player System
- Search System
- Lyrics System
- Library Management
- Queue Management

C. External Services:
- Music Streaming Service (implied by 320kbps quality mention)
- Lyrics Service
- Transliteration API

**┌─────────────────────────────────────────────┐**
- Client Layer                 │
- (Components, Pages, Client-side Processing)  │
- ┘
- ↕
**┌─────────────────────────────────────────────┐**
- Application Layer               │
- (API Routes, Services, State Management)  │
- ┘
- ↕
**┌─────────────────────────────────────────────┐**
- External Services               │
- (Music API, Lyrics API, Transliteration)   │
- ┘

##### Detailed Component Breakdown

Client Layer:
- Player Components (BottomBar, PlayerControls, VolumeBar)
- Navigation Components (LeftSideBar, RightSideBar)
- Content Components (Cards, SearchBar)
- Page Components (Album, Artist, Playlist, Track views)

Application Layer:
- Key services:
- State Management (Various Providers)
- Data Services (albums.ts, artists.ts, songs.ts)
- IndexedDB Integration (idb.ts)
- API Routes (/api/transliterate)

External Services Layer:
- Connections to:
- Music Streaming API
- Lyrics Service
- Transliteration Service

##### State Management

Various providers:
- AudioProvider
- QueueProvider
- LibraryProvider
- HistoryProvider
- UIConfigProvider
- ContextMenuProvider

##### Technical Stack Indicators

Technology badges or labels for:
- Next.js
- TypeScript
- TailwindCSS
- IndexedDB
- Web Audio API

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        BC[Bottom Controls]
        PC[Player Controls]
        SB[Search Bar]
        LIB[Library]
        QV[Queue View]
        MV[Main Views]
    end

    subgraph Providers
        AP[Audio Provider]
        QP[Queue Provider]
        LP[Library Provider]
        HP[History Provider]
        UP[UI Config Provider]
        CP[Context Menu Provider]
    end

    subgraph Services
        AS[Album Service]
        ARS[Artist Service]
        SS[Songs Service]
        PS[Playlist Service]
        IDB[IndexedDB Service]
        SE[Search Service]
    end

    subgraph "API Layer"
        TR["/api/transliterate"]
        LY[Lyrics API]
    end

    subgraph "External Services"
        MS[Music Streaming API]
        LS[Lyrics Service]
        TS[Transliteration Service]
    end

    %% Connections
    BC --> AP
    PC --> AP
    QV --> QP
    LIB --> LP
    SB --> SE

    AP --> MS
    QP --> SS
    LP --> IDB
    SE --> SS
    SE --> AS
    SE --> ARS

    TR --> TS
    LY --> LS

    %% Click events
    click BC "https://github.com/mdanisulh/fusic/blob/main/src/components/bottomBar/BottomBar.tsx"
    click PC "https://github.com/mdanisulh/fusic/blob/main/src/components/bottomBar/PlayerControls.tsx"
    click SB "https://github.com/mdanisulh/fusic/blob/main/src/components/common/SearchBar.tsx"
    click LIB "https://github.com/mdanisulh/fusic/blob/main/src/components/sideBar/Library.tsx"
    click QV "https://github.com/mdanisulh/fusic/blob/main/src/components/sideBar/QueueView.tsx"
    click MV "https://github.com/mdanisulh/fusic/tree/main/src/app"
    click AP "https://github.com/mdanisulh/fusic/blob/main/src/lib/providers/AudioProvider.tsx"
    click QP "https://github.com/mdanisulh/fusic/blob/main/src/lib/providers/QueueProvider.tsx"
    click LP "https://github.com/mdanisulh/fusic/blob/main/src/lib/providers/LibraryProvider.tsx"
    click HP "https://github.com/mdanisulh/fusic/blob/main/src/lib/providers/HistoryProvider.tsx"
    click UP "https://github.com/mdanisulh/fusic/blob/main/src/lib/providers/UIConfigProvider.tsx"
    click CP "https://github.com/mdanisulh/fusic/blob/main/src/lib/providers/ContextMenuProvider.tsx"
    click AS "https://github.com/mdanisulh/fusic/blob/main/src/lib/services/albums.ts"
    click ARS "https://github.com/mdanisulh/fusic/blob/main/src/lib/services/artists.ts"
    click SS "https://github.com/mdanisulh/fusic/blob/main/src/lib/services/songs.ts"
    click PS "https://github.com/mdanisulh/fusic/blob/main/src/lib/services/playlists.ts"
    click IDB "https://github.com/mdanisulh/fusic/blob/main/src/lib/services/idb.ts"
    click SE "https://github.com/mdanisulh/fusic/blob/main/src/lib/services/search.ts"
    click TR "https://github.com/mdanisulh/fusic/blob/main/src/app/api/transliterate/route.ts"
    click LY "https://github.com/mdanisulh/fusic/blob/main/src/app/lyrics/page.tsx"

    %% Styling
    classDef client fill:#e1f5fe,stroke:#01579b
    classDef provider fill:#fff3e0,stroke:#ff6f00
    classDef service fill:#e8f5e9,stroke:#1b5e20
    classDef api fill:#fce4ec,stroke:#880e4f
    classDef external fill:#f3e5f5,stroke:#4a148c

    class BC,PC,SB,LIB,QV,MV client
    class AP,QP,LP,HP,UP,CP provider
    class AS,ARS,SS,PS,IDB,SE service
    class TR,LY api
    class MS,LS,TS external
```
