# erikmeliska/meteleskublesku architecture

> Architecture diagram of the GitHub repository erikmeliska/meteleskublesku, 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/erikmeliska/meteleskublesku
- Repository: https://github.com/erikmeliska/meteleskublesku

## Overview

##### Main Components

a. Client Layer:
- Next.js Frontend Application
- Client-side Routes (/movie/[...params], index)

b. API Layer:
- Next.js API Routes
- Media Endpoints (getAudio, getImage, getMovie)
- YouTube Integration (searchYoutube)
- Management (getMovieList)
- Audio Processing (extractAudio)

c. External Services:
- Original Server (legacy system)
- YouTube API
- Cache Storage System

**[Client Layer]**
- ↕
**[API Layer]**
- ↕
**[External Services]**

##### Key Relationships to Highlight

a. Data Flow:
- Client requests → API Routes
- API Routes → Cache check
- Cache miss → External services
- Cache hit → Direct media serving
- Media storage flow

b. Caching Strategy:
- How the application serves as a caching proxy
- Cache check/store workflow

##### Specific Implementation Details

- Next.js Application Container
- Pages (index.js, movie/[...params].js)
- API Routes (all files under /api)
- Cache Storage
- Image cache
- Audio cache
- Movie cache
- External Systems
- Original meteleskublesku.cz server
- YouTube API integration

##### Important Notes

a. Emphasize:
- The caching mechanism as it's a key feature
- API route organization
- External service interactions

b. Include:
- Docker container boundary (based on Dockerfile presence)
- Environment configuration points
- Cache storage location

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Frontend["Next.js Frontend"]:::frontend
        IndexPage["Index Page"]:::frontend
        MovieRoutes["Movie Routes"]:::frontend
        GlobalStyles["Global Styles"]:::frontend
        AppEntry["App Entry"]:::frontend
    end

    subgraph API
        MediaEndpoints["Media Endpoints"]:::api
        GetAudio["Get Audio API"]:::api
        GetImage["Get Image API"]:::api
        GetMovie["Get Movie API"]:::api
        YouTubeAPI["YouTube Search API"]:::api
        ListManagement["Movie List API"]:::api
        AudioProcessing["Audio Extraction API"]:::api
    end

    subgraph External
        OriginalServer["Original Server"]:::external
        YouTube["YouTube API"]:::external
    end

    subgraph Cache
        ImageCache["Image Cache"]:::cache
        AudioCache["Audio Cache"]:::cache
        MovieCache["Movie Cache"]:::cache
    end

    subgraph Config
        AppConfig["Next.js Config"]:::config
        DockerConfig["Docker Config"]:::config
        EnvConfig["Environment Config"]:::config
    end

    %% Relationships
    Frontend --> IndexPage
    Frontend --> MovieRoutes
    Frontend --> GlobalStyles
    Frontend --> AppEntry
    
    Frontend --> MediaEndpoints
    MediaEndpoints --> GetAudio
    MediaEndpoints --> GetImage
    MediaEndpoints --> GetMovie
    
    GetAudio --> AudioCache
    GetImage --> ImageCache
    GetMovie --> MovieCache
    
    AudioCache --> OriginalServer
    ImageCache --> OriginalServer
    MovieCache --> OriginalServer
    
    Frontend --> YouTubeAPI
    Frontend --> ListManagement
    Frontend --> AudioProcessing
    
    YouTubeAPI --> YouTube
    
    %% Click Events
    click IndexPage "https://github.com/erikmeliska/meteleskublesku/blob/main/pages/index.js"
    click MovieRoutes "https://github.com/erikmeliska/meteleskublesku/blob/main/pages/movie/[...params].js"
    click GetAudio "https://github.com/erikmeliska/meteleskublesku/blob/main/pages/api/getAudio.js"
    click GetImage "https://github.com/erikmeliska/meteleskublesku/blob/main/pages/api/getImage.js"
    click GetMovie "https://github.com/erikmeliska/meteleskublesku/blob/main/pages/api/getMovie.js"
    click YouTubeAPI "https://github.com/erikmeliska/meteleskublesku/blob/main/pages/api/searchYoutube.js"
    click ListManagement "https://github.com/erikmeliska/meteleskublesku/blob/main/pages/api/getMovieList.js"
    click AudioProcessing "https://github.com/erikmeliska/meteleskublesku/blob/main/pages/api/extractAudio.js"
    click AppConfig "https://github.com/erikmeliska/meteleskublesku/blob/main/next.config.js"
    click DockerConfig "https://github.com/erikmeliska/meteleskublesku/tree/main/Dockerfile"
    click EnvConfig "https://github.com/erikmeliska/meteleskublesku/blob/main/.env.example"
    click GlobalStyles "https://github.com/erikmeliska/meteleskublesku/blob/main/styles/globals.css"
    click AppEntry "https://github.com/erikmeliska/meteleskublesku/blob/main/pages/_app.js"

    %% Styles
    classDef frontend fill:#2196F3,stroke:#1565C0,color:white
    classDef api fill:#4CAF50,stroke:#2E7D32,color:white
    classDef external fill:#9E9E9E,stroke:#616161,color:white
    classDef cache fill:#FFC107,stroke:#FFA000,color:black
    classDef config fill:#FF5722,stroke:#E64A19,color:white

    %% Legend
    subgraph Legend
        Frontend_L["Frontend Components"]:::frontend
        API_L["API Components"]:::api
        External_L["External Services"]:::external
        Cache_L["Cache Storage"]:::cache
        Config_L["Configuration"]:::config
    end
```
