# mostafaalagamy/metrolist architecture

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

- Interactive diagram: https://gitdiagram.com/mostafaalagamy/metrolist
- Repository: https://github.com/mostafaalagamy/metrolist

## Overview

##### Main Components
- App (UI & core functionality): The “app” module (with packages such as ui, viewmodels, db, playback, and themes) represents the primary Android client. It comprises multiple layers like Activities/Composables (screens and components), viewmodels (MVVM design), a local database (MusicDatabase with entities and DAOs), and playback services (MusicService, ExoDownloadService, etc.).
- Lyrics and Media Enhancements: Modules such as “lrclib” and “kugou” provide functionality for processing lyrics. Include these as specialized components that supply live or downloaded lyrics and additional media metadata.
- Build and Deployment Infrastructure: Although not part of runtime architecture, include build configuration elements (Gradle build scripts, GitHub workflows, Fastlane metadata) as an overlay showing CI/CD and deployment pipelines.

##### Relationships and Interactions
- ViewModels and Domain Layer: Illustrate that viewmodels (e.g., AlbumViewModel, HomeViewModel, etc.) serve as intermediaries binding UI to both local persistence (via repositories accessing MusicDatabase) and network calls through the innerTube module.
- Data Storage: Include the database component (with entities such as SongEntity, PlaylistEntity, etc.) and indicate flows from viewmodels or repositories to the database layer.
- Lyrics Providers: Represent lrclib and kugou modules as ancillary services that the app queries to display live lyrics. They may pass processed text (and possibly parsed timestamp info) back to the UI.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "App Module (Core Functionality)"
        A1["Main App Logic"]:::appLogic
        A2["UI Components (Screens, Navigation)"]:::ui
        A3["ViewModels (MVVM)"]:::vm
        A4["Database (MusicDatabase, DAOs)"]:::db
        A5["Database Schema"]:::db
        A6["Playback Services"]:::service
    end

    subgraph "Network/API Integration"
        N1["Innertube API Gateway"]:::network
    end

    subgraph "Lyrics & Media Enhancements"
        L1["LrcLib (Lyrics Processing)"]:::lyrics
        L2["KuGou (Alternative Lyrics Provider)"]:::lyrics
    end

    subgraph "External Integrations & Utilities"
        E1["Discord Integration (Kizzy)"]:::external
        E2["Dynamic Theming (Material Color)"]:::external
    end

    subgraph "Build & Deployment"
        B1["GitHub Actions (CI/CD)"]:::build
        B2["Fastlane Metadata"]:::build
        B3["Gradle Build Scripts"]:::build
    end

    %% App Module interactions
    A1 -->|"initiates"| A2
    A2 -->|"binds"| A3
    A3 -->|"accesses"| A4
    A3 -->|"controls"| A6
    A3 -->|"calls_API"| N1
    A3 -->|"retrieves_lyrics"| L1
    A3 -->|"retrieves_lyrics"| L2
    A3 -->|"syncs_with"| E1
    A2 -->|"applies"| E2
    A6 -->|"updates_UI"| A2

    %% Build & Deployment influences
    B1 -->|"builds"| A1
    B2 -->|"packages"| A1
    B3 -->|"compiles"| A1
    B1 -->|"builds"| N1

    %% Click Events
    click A1 "https://github.com/mostafaalagamy/metrolist/tree/main/app/src/main/java/com/metrolist/music"
    click A2 "https://github.com/mostafaalagamy/metrolist/tree/main/app/src/main/java/com/metrolist/music/ui"
    click A3 "https://github.com/mostafaalagamy/metrolist/tree/main/app/src/main/java/com/metrolist/music/viewmodels"
    click A4 "https://github.com/mostafaalagamy/metrolist/tree/main/app/src/main/java/com/metrolist/music/db"
    click A5 "https://github.com/mostafaalagamy/metrolist/blob/main/app/schemas/com.metrolist.music.db.InternalDatabase"
    click A6 "https://github.com/mostafaalagamy/metrolist/tree/main/app/src/main/java/com/metrolist/music/playback"
    click N1 "https://github.com/mostafaalagamy/metrolist/tree/main/innertube/src/main/java/com/metrolist/innertube"
    click L1 "https://github.com/mostafaalagamy/metrolist/tree/main/lrclib/src/main/java/com/metrolist/lrclib"
    click L2 "https://github.com/mostafaalagamy/metrolist/tree/main/kugou/src/main/java/com/metrolist/kugou"
    click E1 "https://github.com/mostafaalagamy/metrolist/tree/main/kizzy/src/main/java/com/my/kizzy"
    click E2 "https://github.com/mostafaalagamy/metrolist/tree/main/material-color-utilities/src/main/java/com/google/material/color"
    click B1 "https://github.com/mostafaalagamy/metrolist/tree/main/.github/workflows"
    click B2 "https://github.com/mostafaalagamy/metrolist/tree/main/fastlane/metadata"
    click B3 "https://github.com/mostafaalagamy/metrolist/blob/main/build.gradle.kts"

    %% Styles
    classDef appLogic fill:#f9c74f,stroke:#333,stroke-width:2px;
    classDef ui fill:#90be6d,stroke:#333,stroke-width:2px;
    classDef vm fill:#f9844a,stroke:#333,stroke-width:2px;
    classDef db fill:#577590,stroke:#fff,stroke-width:2px;
    classDef service fill:#277da1,stroke:#fff,stroke-width:2px;
    classDef network fill:#f94144,stroke:#333,stroke-width:2px;
    classDef lyrics fill:#f3722c,stroke:#333,stroke-width:2px;
    classDef external fill:#43aa8b,stroke:#333,stroke-width:2px;
    classDef build fill:#9d4edd,stroke:#333,stroke-width:2px;
```
