# yusufmalikul/learn-from-youtube architecture

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

- Interactive diagram: https://gitdiagram.com/yusufmalikul/learn-from-youtube
- Repository: https://github.com/yusufmalikul/learn-from-youtube

## Overview

##### Project type and purpose
- This is a small full-stack “data-ingestion + static-view” application.
- Purpose: Every hour it fetches YouTube videos by topic, appends them to a JSON file, and exposes a simple browser view of the aggregated list.

##### File structure
- Top-level scripts and assets:
- app.py             → the Python fetcher (and possible web server).
- index.html         → static frontend that reads videos.json.
- videos.json        → file-based data store.
- requirements.txt   → Python dependencies (e.g., requests, Flask?).
- CI/automation:
- .github/workflows/run_app.yaml → scheduled GitHub Action that invokes app.py each hour.
- No external database or microservices—data is persisted as a flat JSON file.

##### README for additional insights
- Confirms hourly fetch of “hidden gems” on YouTube.
- No mention of a hosted backend server; implies a static-site deployment plus GitHub Actions for scheduling.

##### Main components
A. Scheduler Component
- GitHub Actions workflow (run_app.yaml) triggered via cron.
B. Data Ingestion Component
- app.py script.
- Connects to YouTube Data API over HTTPS.
- Parses and filters results by topic.
C. Data Storage
- videos.json local file (flat-file store).
D. Frontend Component
- index.html served by any static host (e.g., GitHub Pages).
- Client-side JS (if any) fetches videos.json and renders the list.

##### Relationships and data flow
1. Scheduler → invokes app.py hourly.
2. app.py → calls YouTube API → receives JSON response.
3. app.py → reads/writes videos.json (merges new entries).
4. User’s browser → requests index.html and videos.json from the web host.
5. index.html → displays aggregated video list.

##### Architectural patterns and design principles
- Batch ingestion via scheduled job.
- Flat-file data store (no RDBMS or NoSQL).
- Static front-end—no dynamic backend server at runtime.
- Separation of concerns: ingestion vs. presentation.

##### Key technologies/frameworks
- Python (app.py), requests or google-api-python client.
- GitHub Actions for scheduling.
- Static HTML/CSS/JS for frontend.
- YouTube Data API v3.

##### Final advice
- Four components and their interactions.
- Notes on timing (hourly) and technology (Python, GitHub Actions, static host).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Scheduler
    SCHED["GitHub Actions Scheduler\n(run_app.yaml)"]:::scheduler
    %% Data Ingestion
    ING["Data Ingestion\n(app.py)"]:::ingestion
    %% External API
    API["YouTube Data API v3"]:::external
    %% Data Storage
    STO["videos.json"]:::storage
    %% Frontend
    HOST["Static Frontend\n(index.html)"]:::frontend
    %% User Browser
    BROW["User Browser"]:::user

    %% Data Flows
    SCHED -->|"hourly cron"| ING
    ING -->|"fetch videos"| API
    API -->|"JSON response"| ING
    ING -->|"read/write"| STO
    BROW -->|"requests HTML"| HOST
    BROW -->|"requests JSON"| STO

    %% Click Events
    click SCHED "https://github.com/yusufmalikul/learn-from-youtube/blob/main/.github/workflows/run_app.yaml"
    click ING "https://github.com/yusufmalikul/learn-from-youtube/blob/main/app.py"
    click STO "https://github.com/yusufmalikul/learn-from-youtube/blob/main/videos.json"
    click HOST "https://github.com/yusufmalikul/learn-from-youtube/blob/main/index.html"

    %% Styles
    classDef scheduler fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef ingestion fill:#C6E2FF,stroke:#333,stroke-width:1px
    classDef storage fill:#FFD59E,stroke:#333,stroke-width:1px
    classDef frontend fill:#FEF9C3,stroke:#333,stroke-width:1px
    classDef external fill:#E0E0E0,stroke:#333,stroke-width:1px
    classDef user fill:#FFC0CB,stroke:#333,stroke-width:1px
```
