# 805karansaini/youtube_playlist_analyser architecture

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

- Interactive diagram: https://gitdiagram.com/805karansaini/youtube_playlist_analyser
- Repository: https://github.com/805karansaini/youtube_playlist_analyser

## Overview

##### Main Components

A. Client Layer:
- Web Browser Interface
- Static Assets (CSS from /app/static)
- HTML Templates (from /app/templates)

B. Application Layer:
- FastAPI/Flask Web Server (indicated by gunicorn usage)
- Core Configuration Module (/app/core)
- Route Handlers (/app/routes)
- Service Layer (/app/services)
- Helper Utilities (/app/helper)
- Exception Handling (/app/exceptions)

C. External Services:
- YouTube Data API
- Environment Configuration (.env)

**[Client Tier]**

**[Application Tier]**

**[External Services Tier]**

##### Component Relationships to Highlight

a. Data Flow:
- Client → Route Handlers → YouTube Service → YouTube API
- YouTube API → YouTube Service → Route Handlers → Templates → Client

b. Dependencies:
- Configuration injection from core/config.py
- Error handling flow through exceptions
- Utility functions' integration

##### Specific Implementation Details

- Rectangles: Core application components
- Hexagons: Configuration elements

- Blue: Client-side components
- Green: Application logic
- Yellow: External services
- Red: Error handling components
- Gray: Configuration and utilities

**[Web Browser] → [Static Assets (CSS)]**
- ↓
**[Route Handler (home_routes.py)]**
- ↓
**[YouTube Service Layer]**
- ↓
**[YouTube Data API]**

Top Section:
- Client interface
- Static asset handling
- Template rendering

Middle Section:
- Core application logic
- Route handling
- Service layer implementation

Bottom Section:
- External API integration
- Configuration management
- Error handling

##### Technical Details to Note

- Python 3.12 runtime environment
- Gunicorn server implementation
- Docker containerization
- Environment variable management
- Documentation system (MkDocs)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Layer
    subgraph Client
        Browser["Web Browser"]
        Static["Static Assets"]:::static
        Templates["HTML Templates"]:::templates
    end

    %% Application Layer
    subgraph Application
        WebServer["FastAPI/Flask Server"]:::server
        
        subgraph Core
            Config["Core Configuration"]:::config
            EnvConfig["Environment Config"]:::env
        end
        
        subgraph Handlers
            Routes["Route Handlers"]:::routes
        end
        
        subgraph Services
            YTService["YouTube Service"]:::ytservice
        end
        
        subgraph Utils
            Helpers["Helper Utilities"]:::helpers
            ErrorHandler["Exception Handling"]:::error
        end
    end

    %% External Services Layer
    subgraph External
        YTAPI["YouTube Data API"]
        Docker["Docker Container"]:::docker
        Deploy["Deployment\n(Vercel/Railway)"]:::deploy
        Docs["Documentation\n(MkDocs)"]:::docs
    end

    %% Relationships
    Browser --> Static
    Browser --> Templates
    Browser --> Routes
    
    Routes --> YTService
    YTService --> YTAPI
    
    Config --> Routes
    Config --> YTService
    EnvConfig --> Config
    
    Helpers --> Routes
    Helpers --> YTService
    
    ErrorHandler --> Routes
    ErrorHandler --> YTService
    
    Docker --> WebServer
    Deploy --> WebServer
    
    %% Styles
    classDef static fill:#6495ED
    classDef templates fill:#6495ED
    classDef server fill:#90EE90
    classDef config fill:#D3D3D3
    classDef env fill:#D3D3D3
    classDef routes fill:#90EE90
    classDef ytservice fill:#90EE90
    classDef helpers fill:#D3D3D3
    classDef error fill:#FFB6C1
    classDef docker fill:#FFE4B5
    classDef deploy fill:#FFE4B5
    classDef docs fill:#FFE4B5

    %% Click Events
    click Static "https://github.com/805karansaini/youtube_playlist_analyser/blob/master/app/static/main.css"
    click Templates "https://github.com/805karansaini/youtube_playlist_analyser/tree/master/app/templates/"
    click WebServer "https://github.com/805karansaini/youtube_playlist_analyser/blob/master/app/main.py"
    click Config "https://github.com/805karansaini/youtube_playlist_analyser/blob/master/app/core/config.py"
    click Routes "https://github.com/805karansaini/youtube_playlist_analyser/blob/master/app/routes/home_routes.py"
    click YTService "https://github.com/805karansaini/youtube_playlist_analyser/blob/master/app/services/youtube_service.py"
    click Helpers "https://github.com/805karansaini/youtube_playlist_analyser/blob/master/app/helper/utils.py"
    click ErrorHandler "https://github.com/805karansaini/youtube_playlist_analyser/blob/master/app/exceptions/exception.py"
    click EnvConfig "https://github.com/805karansaini/youtube_playlist_analyser/blob/master/.env.example"
    click Docker "https://github.com/805karansaini/youtube_playlist_analyser/tree/master/Dockerfile"
    click Docs "https://github.com/805karansaini/youtube_playlist_analyser/tree/master/docs/"
    click Deploy "https://github.com/805karansaini/youtube_playlist_analyser/blob/master/vercel.json"
```
