# mushaf-khalil/100daysofml architecture

> Architecture diagram of the GitHub repository mushaf-khalil/100daysofml, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mushaf-khalil/100daysofml
- Repository: https://github.com/mushaf-khalil/100daysofml

## Overview

##### Project type and purpose
- This is a small full-stack web application—a content-based movie recommender.
- The “backend” directory implements the recommendation API and data access; the “frontend” directory implements a simple web UI.

##### File structure
- Top-level folder “Content Based Movie Recommender”
- backend/
– api.py (Flask or FastAPI endpoints exposing recommendation and health-check routes)
– database.py (module to initialize and query the SQLite database)
- frontend/
– app.py (simple Flask app serving HTML templates or UI components, calling backend API)
- movies.db (SQLite database containing movie metadata and precomputed features)
- tmdb_5000_movies.csv, tmdb_5000_credits.csv (raw data sources used to populate the database)
- requirements.txt (list of Python dependencies)
- No microservices—monolithic two-tier architecture (web server + database).

##### README for additional insights
- Although the top-level README covers the 100-Days-ML repository, the recommender subfolder likely contains its own README (not shown here) describing:
- loading CSVs into SQLite
- building TF-IDF or cosine-similarity feature matrix
- Flask route contracts (e.g., /recommend?movie_id=…)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        UI["User Interface (Browser)"]:::runtime
        Frontend["Frontend App\napp.py"]:::runtime
    end

    %% Application Layer
    subgraph "Application Layer"
        BackendAPI["Backend API\napi.py"]:::runtime
        RecEngine["Recommendation Engine\n(database.py)"]:::runtime
        BackendInit["Backend Init\n__init__.py"]:::runtime
    end

    %% Data Layer
    subgraph "Data Layer"
        DB["SQLite Database\nmovies.db"]:::runtime
    end

    %% Data Ingestion
    subgraph "Data Ingestion"
        CSV1["tmdb_5000_movies.csv"]:::ingestion
        CSV2["tmdb_5000_credits.csv"]:::ingestion
    end

    %% External
    External["TMDB External API"]:::external

    %% Documentation
    subgraph "Documentation & Config"
        Req["requirements.txt"]:::docs
        README["README.md"]:::docs
    end

    %% Interactions
    UI -->|"user request"| Frontend
    Frontend -->|"HTTP GET /recommend"| BackendAPI
    BackendAPI -->|"calls Recommendation Engine"| RecEngine
    RecEngine -->|"SQL query"| DB
    DB -->|"query result"| RecEngine
    RecEngine -->|"JSON response"| BackendAPI
    BackendAPI -->|"HTTP JSON"| Frontend
    Frontend -->|"render recommendations"| UI

    %% Optional external lookup
    RecEngine -->|"optional live lookup"| External

    %% Data Ingestion flow
    CSV1 -->|"load CSV"| DB
    CSV2 -->|"load CSV"| DB

    %% Click Events
    click Frontend "https://github.com/mushaf-khalil/100daysofml/blob/main/Content Based Movie Recommender/frontend/app.py"
    click BackendAPI "https://github.com/mushaf-khalil/100daysofml/blob/main/Content Based Movie Recommender/backend/api.py"
    click RecEngine "https://github.com/mushaf-khalil/100daysofml/blob/main/Content Based Movie Recommender/backend/database.py"
    click BackendInit "https://github.com/mushaf-khalil/100daysofml/blob/main/Content Based Movie Recommender/backend/__init__.py"
    click DB "https://github.com/mushaf-khalil/100daysofml/blob/main/Content Based Movie Recommender/movies.db"
    click CSV1 "https://github.com/mushaf-khalil/100daysofml/blob/main/Content Based Movie Recommender/tmdb_5000_movies.csv"
    click CSV2 "https://github.com/mushaf-khalil/100daysofml/blob/main/Content Based Movie Recommender/tmdb_5000_credits.csv"
    click Req "https://github.com/mushaf-khalil/100daysofml/blob/main/Content Based Movie Recommender/requirements.txt"
    click README "https://github.com/mushaf-khalil/100daysofml/blob/main/Content Based Movie Recommender/README.md"

    %% Styling
    classDef runtime fill:#cfe2f3,stroke:#0366d6,color:#000;
    classDef ingestion fill:#d9ead3,stroke:#6aa84f,color:#000;
    classDef external fill:#f9cb9c,stroke:#e69138,color:#000;
    classDef docs fill:#f4cccc,stroke:#cc0000,color:#000;
```
