# tonycallaghan/playlist-llm architecture

> Architecture diagram of the GitHub repository tonycallaghan/playlist-llm, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tonycallaghan/playlist-llm
- Repository: https://github.com/tonycallaghan/playlist-llm

## Overview

##### Main Components

A. Frontend Layer:
- Next.js Application (React + TypeScript)
- Key Components:
- Header
- InputFields
- ResultGrid
- ResultOptions
- Tabs

B. API Layer:
- Next.js API Routes
- /api/recommended-songs endpoint

C. External Services:
- Firebase (indicated by .firebaserc and firebase.json)
- LLM Service (implied by project name)

D. Infrastructure:
- Docker containerization
- GitHub Actions CI/CD pipeline

**[Client Layer]**
- ↓
**[Next.js Frontend]**
- ↓
**[API Layer]**
- ↓
**[External Services]**

##### Detailed Component Representation

Frontend Section:
**[Pages]**
- index.tsx (Main page)
- _app.tsx (App wrapper)
- ↓
**[Components]**
- Header
- InputFields
- ResultGrid
- ResultOptions
- Tabs

##### Key Interactions to Highlight

- Client-Server Communication:
- API calls between frontend and backend
- Data flow to/from external services

- Infrastructure Flow:
- Docker container boundaries
- CI/CD pipeline flow

##### Technical Stack Indicators

Technology badges or labels for:
- Next.js
- TypeScript
- React
- Tailwind CSS (indicated by tailwind.config.ts)
- Firebase
- Docker
- GitHub Actions

##### Deployment Flow

A separate section showing:
- GitHub Actions workflow
- Docker build process
- Firebase deployment

##### Maintain hierarchy
- System level view at the top
- Component level details below
- Infrastructure details at the bottom

##### Use standardized symbols
- Rectangles for components
- Diamonds for decision points

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Browser["Web Browser"]
    end

    subgraph NextApp["Next.js Application"]
        direction TB
        Pages["Pages Layer"]
        Components["Components Layer"]
        
        subgraph PagesDetail["Pages"]
            direction TB
            Index["Main Page"]:::file
            AppWrapper["App Wrapper"]:::file
        end

        subgraph ComponentsDetail["Components"]
            direction TB
            Header["Header"]:::file
            InputFields["Input Fields"]:::file
            ResultGrid["Result Grid"]:::file
            ResultOptions["Result Options"]:::file
            Tabs["Tabs"]:::file
        end
    end

    subgraph APILayer["API Layer"]
        direction TB
        RecommendedSongs["/api/recommended-songs"]:::file
    end

    subgraph ExternalServices["External Services"]
        direction TB
        Firebase["Firebase"]:::file
        LLMService["LLM Service"]
    end

    subgraph Infrastructure["Infrastructure"]
        direction TB
        Docker["Docker"]:::file
        GithubActions["GitHub Actions CI/CD"]:::file
    end

    subgraph Testing["Testing Infrastructure"]
        direction TB
        Jest["Jest Config"]:::file
        TestFiles["Test Files"]:::file
    end

    subgraph Styling["Styling System"]
        direction TB
        TailwindConfig["Tailwind Config"]:::file
        PostCSS["PostCSS Config"]:::file
        GlobalStyles["Global Styles"]:::file
    end

    Browser --> Pages
    Pages --> Components
    Components --> APILayer
    APILayer --> ExternalServices
    Infrastructure --> NextApp

    %% Click Events
    click Header "https://github.com/TonyCallaghan/playlist-llm/blob/main/src/components/Header.tsx"
    click InputFields "https://github.com/TonyCallaghan/playlist-llm/blob/main/src/components/InputFields.tsx"
    click ResultGrid "https://github.com/TonyCallaghan/playlist-llm/blob/main/src/components/ResultGrid.tsx"
    click ResultOptions "https://github.com/TonyCallaghan/playlist-llm/blob/main/src/components/ResultOptions.tsx"
    click Tabs "https://github.com/TonyCallaghan/playlist-llm/blob/main/src/components/Tabs.tsx"
    click Index "https://github.com/TonyCallaghan/playlist-llm/blob/main/src/pages/index.tsx"
    click AppWrapper "https://github.com/TonyCallaghan/playlist-llm/blob/main/src/pages/_app.tsx"
    click RecommendedSongs "https://github.com/TonyCallaghan/playlist-llm/blob/main/src/pages/api/recommended-songs.ts"
    click Firebase "https://github.com/TonyCallaghan/playlist-llm/blob/main/.firebaserc"
    click Docker "https://github.com/TonyCallaghan/playlist-llm/tree/main/Dockerfile"
    click GithubActions "https://github.com/TonyCallaghan/playlist-llm/blob/main/.github/workflows/ci-cd.yml"
    click Jest "https://github.com/TonyCallaghan/playlist-llm/blob/main/jest/jest.config.ts"
    click TestFiles "https://github.com/TonyCallaghan/playlist-llm/tree/main/src/__tests__/"
    click TailwindConfig "https://github.com/TonyCallaghan/playlist-llm/blob/main/tailwind.config.ts"
    click PostCSS "https://github.com/TonyCallaghan/playlist-llm/blob/main/postcss.config.js"
    click GlobalStyles "https://github.com/TonyCallaghan/playlist-llm/blob/main/src/styles/globals.css"

    classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px
    classDef file fill:#e1f5fe,stroke:#0277bd,stroke-width:2px
    classDef api fill:#c8e6c9,stroke:#2e7d32,stroke-width:2px
    classDef external fill:#e1bee7,stroke:#6a1b9a,stroke-width:2px
    classDef infrastructure fill:#fff3e0,stroke:#ef6c00,stroke-width:2px

    %% Legend
    subgraph Legend
        L1["Component"]:::default
        L2["File Component"]:::file
        L3["API Endpoint"]:::api
        L4["External Service"]:::external
        L5["Infrastructure"]:::infrastructure
    end
```
