# dibishks/malayalam-youtube architecture

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

- Interactive diagram: https://gitdiagram.com/dibishks/malayalam-youtube
- Repository: https://github.com/dibishks/malayalam-youtube

## Overview

##### Project Type and Purpose
- Chithram is a single-page, front-end Angular application (no custom back end) that curates Malayalam videos by category using the YouTube Data API.
- It’s built with Angular CLI, TypeScript, Webpack/Babel, and outputs static assets for deployment (under `docs/`).

##### Key Files and Directories
- `src/` – application source code:
- `app.module.ts` – root Angular module
- `app.component.*` – root component
- `components/` – UI components (header, category filter, video grid, video player)
- `services/youtube.service.ts` – HTTP client for YouTube Data API
- `models/` – TypeScript interfaces for API responses and domain objects
- `pipes/safe.pipe.ts` – sanitize video embed URLs
- `angular.json`, `tsconfig.json`, `package.json` – build/configuration
- `docs/` – compiled output (HTML, JS bundles, CSS) ready for static hosting

##### Runtime Architecture Components
- Browser (Client)
- Static Host (e.g., GitHub Pages, Nginx) serving the Angular bundle
- Angular Application
- AppModule → wires up components, services, pipes
- Components communicate via Inputs/Outputs or the central YouTubeService
- YouTubeService uses HttpClient to call external YouTube Data API
- External Service: YouTube Data API (REST endpoints)

##### Build & Deployment Pipeline
- Developer writes TS/HTML/SCSS
- Angular CLI invokes Webpack & Babel (per `.angular/cache/…`)
- Transpile & bundle → `docs/` folder (static assets)
- Deploy static assets to hosting

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Developer Environment
    subgraph "Developer Environment"
        Developer["Developer"]:::blue
        CLI["Angular CLI"]:::blue
    end
    Developer -->|"writes code & runs ng commands"| CLI

    %% Build Pipeline
    subgraph "Build Pipeline"
        Build["Webpack & Babel"]:::blue
        Cache[".angular/cache"]:::blue
    end
    CLI -->|"ng build"| Build
    Build --> Cache
    Build -->|"outputs static assets"| Docs["docs/ (static assets)"]:::blue

    %% Deployment Host
    Docs -->|"deploy assets"| Host["Static Host (GitHub Pages/Nginx)"]:::blue

    %% Runtime
    subgraph "Runtime"
        Browser["Browser (Client)"]:::green
        Browser -->|"HTTP GET bundles"| Host
        Host -->|"serves index.html + bundles"| Browser
        Browser --> SPA["Angular SPA"]:::green

        subgraph "Angular Application"
            AppModule["AppModule"]:::green
            AppComponent["AppComponent"]:::green

            subgraph "UI Components"
                Header["Header Component"]:::green
                CategoryFilter["Category Filter Component"]:::green
                VideoGrid["Video Grid Component"]:::green
                VideoPlayer["Video Player Component"]:::green
            end

            subgraph "Service & Utilities"
                YouTubeService["YouTubeService"]:::green
                SafePipe["SafePipe"]:::green
                subgraph "Models"
                    EnvModel["Environment Model"]:::green
                    VideoModel["Video Model"]:::green
                    YTModel["YouTube API Model"]:::green
                end
            end
        end
    end

    %% Application Wiring
    SPA --> AppModule
    AppModule --> AppComponent
    AppModule --> Header
    AppModule --> CategoryFilter
    AppModule --> VideoGrid
    AppModule --> VideoPlayer
    AppModule --> YouTubeService
    AppModule --> SafePipe
    AppModule --> EnvModel
    AppModule --> VideoModel
    AppModule --> YTModel

    %% Component-Service Interactions
    CategoryFilter -->|"select category"| YouTubeService
    VideoGrid -->|"request videos"| YouTubeService
    VideoPlayer -->|"request video details"| YouTubeService

    YouTubeService -->|"HTTP GET /search"| YouTubeAPI["YouTube Data API"]:::orange
    YouTubeAPI -->|"JSON response"| YouTubeService
    YouTubeService --> EnvModel
    YouTubeService --> VideoModel
    YouTubeService --> YTModel
    SafePipe --> AppComponent

    %% External API
    YouTubeAPI

    %% Click Events
    click AppModule "https://github.com/dibishks/malayalam-youtube/blob/main/src/app/app.module.ts"
    click AppComponent "https://github.com/dibishks/malayalam-youtube/blob/main/src/app/app.component.ts"
    click Header "https://github.com/dibishks/malayalam-youtube/blob/main/src/app/components/header/header.component.ts"
    click CategoryFilter "https://github.com/dibishks/malayalam-youtube/blob/main/src/app/components/category-filter/category-filter.component.ts"
    click VideoGrid "https://github.com/dibishks/malayalam-youtube/blob/main/src/app/components/video-grid/video-grid.component.ts"
    click VideoPlayer "https://github.com/dibishks/malayalam-youtube/blob/main/src/app/components/video-player/video-player.component.ts"
    click YouTubeService "https://github.com/dibishks/malayalam-youtube/blob/main/src/app/services/youtube.service.ts"
    click SafePipe "https://github.com/dibishks/malayalam-youtube/blob/main/src/app/pipes/safe.pipe.ts"
    click EnvModel "https://github.com/dibishks/malayalam-youtube/blob/main/src/app/models/environment.model.ts"
    click VideoModel "https://github.com/dibishks/malayalam-youtube/blob/main/src/app/models/video.ts"
    click YTModel "https://github.com/dibishks/malayalam-youtube/blob/main/src/app/models/youtube.model.ts"
    click Main "https://github.com/dibishks/malayalam-youtube/blob/main/src/main.ts"
    click Index "https://github.com/dibishks/malayalam-youtube/blob/main/src/index.html"
    click Styles "https://github.com/dibishks/malayalam-youtube/blob/main/src/styles.scss"
    click AngularConfig "https://github.com/dibishks/malayalam-youtube/blob/main/angular.json"
    click Tsconfig "https://github.com/dibishks/malayalam-youtube/blob/main/tsconfig.json"
    click TsconfigApp "https://github.com/dibishks/malayalam-youtube/blob/main/tsconfig.app.json"
    click Package "https://github.com/dibishks/malayalam-youtube/blob/main/package.json"
    click Docs "https://github.com/dibishks/malayalam-youtube/tree/main/docs/"
    click Fallback "https://github.com/dibishks/malayalam-youtube/blob/main/docs/404.html"

    %% Styles
    classDef blue fill:#cce5ff,stroke:#888,stroke-width:1px
    classDef green fill:#d4edda,stroke:#888,stroke-width:1px
    classDef orange fill:#ffe5b4,stroke:#888,stroke-width:1px
```
