# dan-garden/lyrics architecture

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

- Interactive diagram: https://gitdiagram.com/dan-garden/lyrics
- Repository: https://github.com/dan-garden/lyrics

## Overview

##### Main System Components

a) Client-Side Layer:
- Public Web Interface (Vue.js based)
- Documentation Interface

b) Server Layer:
- Express.js API Server
- Lyrics Providers System

c) External Services:
- Multiple Lyrics Sources (AZLyrics, Genius, LyricsMode, SongLyrics)

##### Component Relationships

- Client → Server: HTTP requests for lyrics
- Server → Provider Manager: Internal routing
- Provider Manager → Individual Providers: Delegation
- Providers → External Services: Web scraping
- Server → Documentation: API documentation serving

##### Technical Details

Labels indicating:
- Node.js runtime environment
- Vue.js for frontend
- Express.js for backend
- Web scraping functionality
- RESTful API endpoints

##### Important Notes

Specific architectural aspects:
- Modular provider system
- Separation between the API and web interface
- Documentation system integration
- Error handling and fallback between different providers

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        WebUI["Vue.js Web Interface"]
        DocUI["Documentation Interface"]
    end

    subgraph Server
        API["Express.js Server"]
        ProviderMgr["Provider Manager"]
        
        subgraph Providers
            AZLyrics["AZLyrics Provider"]
            Genius["Genius Provider"]
            LyricsMode["LyricsMode Provider"]
            SongLyrics["SongLyrics Provider"]
        end
    end

    subgraph External
        AZLyricsWeb["AZLyrics Website"]:::external
        GeniusWeb["Genius Website"]:::external
        LyricsModeWeb["LyricsMode Website"]:::external
        SongLyricsWeb["SongLyrics Website"]:::external
    end

    WebUI --> |"HTTP Requests"| API
    DocUI --> |"Documentation Requests"| API
    API --> ProviderMgr
    ProviderMgr --> AZLyrics
    ProviderMgr --> Genius
    ProviderMgr --> LyricsMode
    ProviderMgr --> SongLyrics
    
    AZLyrics --> |"Web Scraping"| AZLyricsWeb
    Genius --> |"Web Scraping"| GeniusWeb
    LyricsMode --> |"Web Scraping"| LyricsModeWeb
    SongLyrics --> |"Web Scraping"| SongLyricsWeb

    %% Click Events
    click API "https://github.com/dan-garden/lyrics/blob/master/index.js"
    click ProviderMgr "https://github.com/dan-garden/lyrics/blob/master/providers.js"
    click AZLyrics "https://github.com/dan-garden/lyrics/blob/master/providers/azlyrics.js"
    click Genius "https://github.com/dan-garden/lyrics/blob/master/providers/genius.js"
    click LyricsMode "https://github.com/dan-garden/lyrics/blob/master/providers/lyricsmode.js"
    click SongLyrics "https://github.com/dan-garden/lyrics/blob/master/providers/songlyrics.js"
    click WebUI "https://github.com/dan-garden/lyrics/blob/master/public/index.html"
    click DocUI "https://github.com/dan-garden/lyrics/blob/master/public/docs/index.html"

    %% Styling
    classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px
    classDef external fill:#gray,stroke:#666,stroke-width:2px,stroke-dasharray: 5 5
    classDef client fill:#b3e0ff,stroke:#333,stroke-width:2px
    classDef server fill:#98FB98,stroke:#333,stroke-width:2px
    classDef provider fill:#FFE4B5,stroke:#333,stroke-width:2px

    class WebUI,DocUI client
    class API,ProviderMgr server
    class AZLyrics,Genius,LyricsMode,SongLyrics provider
    class AZLyricsWeb,GeniusWeb,LyricsModeWeb,SongLyricsWeb external

    %% Legend
    subgraph Legend
        Client_Component["Client Component"]:::client
        Server_Component["Server Component"]:::server
        Provider_Component["Provider Component"]:::provider
        External_Service["External Service"]:::external
    end
```
