# ahmedelawady8/netflix_movies_recommendation_system architecture

> Architecture diagram of the GitHub repository ahmedelawady8/netflix_movies_recommendation_system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ahmedelawady8/netflix_movies_recommendation_system
- Repository: https://github.com/ahmedelawady8/netflix_movies_recommendation_system

## Overview

This is a Streamlit movie-recommendation app. Users choose a title, request recommendations, and see five similar movies with TMDB posters and details; an optional homepage carousel provides clickable images. The notebook is the documented model-building workflow, while app.py loads cached pickle data for runtime recommendations. Frontend Streamlit protocol components are represented as internal layers. Edges reflect calls or exchanges visible in the sampled files or README; the README’s feature description supports the model workflow, but exact notebook implementation details were not inspected.

Main entry points: [`app.py`](https://github.com/ahmedelawady8/netflix_movies_recommendation_system/blob/main/app.py) (Streamlit UI), [`frontend/src/streamlit/streamlit.ts`](https://github.com/ahmedelawady8/netflix_movies_recommendation_system/blob/main/frontend/src/streamlit/streamlit.ts) (Streamlit message API), [`main.py`](https://github.com/ahmedelawady8/netflix_movies_recommendation_system/blob/main/main.py) (Feature and similarity model), [`frontend/src/ImageGallery.svelte`](https://github.com/ahmedelawady8/netflix_movies_recommendation_system/blob/main/frontend/src/ImageGallery.svelte) (Image gallery)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_product["Recommendation app"]
  node_app["Streamlit UI<br/>[app.py]"]
  node_selection["Title selection<br/>[app.py]"]
  node_recommend["Top-five results<br/>[app.py]"]
  node_movie_details["Movie details<br/>[app.py]"]
  node_carousel["Homepage carousel<br/>[app.py]"]
end

subgraph group_model["Recommendation model"]
  node_dataset[("TMDB movie dataset")]
  node_feature_model["Feature and similarity model<br/>[main.py]"]
  node_cached_movies[("Cached movie data<br/>[movies_list.pkl]")]
  node_cached_similarity[("Cached similarity matrix")]
end

subgraph group_integrations["External services"]
  node_tmdb["TMDB API"]
  node_poster_images["TMDB image service"]
end

subgraph group_frontend["Carousel frontend"]
  node_gallery["Image gallery"]
  node_frontend_entry["Gallery bootstrap<br/>[main.ts]"]
end

subgraph group_protocol["Streamlit component protocol"]
  node_connection["Streamlit connection wrapper"]
  node_streamlit_api["Streamlit message API<br/>[streamlit.ts]"]
  node_lifecycle["Frame lifecycle"]
  node_arrow["Arrow dataframe adapter<br/>[ArrowTable.ts]"]
end

node_user(("Movie viewer"))

node_user -->|"uses"| node_app
node_app -->|"renders"| node_selection
node_selection -->|"selects title"| node_recommend
node_app -->|"invokes on click"| node_recommend
node_recommend -->|"reads titles and IDs"| node_cached_movies
node_recommend -->|"reads scores"| node_cached_similarity
node_recommend -->|"fetches posters"| node_poster_images
node_recommend -->|"renders results"| node_movie_details
node_movie_details -->|"fetches details"| node_tmdb
node_app -->|"fetches carousel posters"| node_tmdb
node_tmdb -->|"returns poster path"| node_poster_images
node_dataset -->|"provides source data"| node_feature_model
node_feature_model -->|"saves cleaned data"| node_cached_movies
node_feature_model -->|"saves similarity matrix"| node_cached_similarity
node_app -->|"loads pickle"| node_cached_movies
node_app -->|"loads or rebuilds"| node_cached_similarity
node_app -->|"declares component"| node_carousel
node_carousel -.->|"loads frontend"| node_frontend_entry
node_frontend_entry -->|"wraps gallery"| node_connection
node_frontend_entry -->|"mounts component"| node_gallery
node_connection -->|"receives render events"| node_streamlit_api
node_gallery -->|"sets selected value"| node_streamlit_api
node_gallery -->|"sets frame lifecycle"| node_lifecycle
node_lifecycle -->|"reports frame height"| node_streamlit_api
node_streamlit_api -->|"converts dataframe args"| node_arrow

click node_app "https://github.com/ahmedelawady8/netflix_movies_recommendation_system/blob/main/app.py"
click node_selection "https://github.com/ahmedelawady8/netflix_movies_recommendation_system/blob/main/app.py"
click node_recommend "https://github.com/ahmedelawady8/netflix_movies_recommendation_system/blob/main/app.py"
click node_movie_details "https://github.com/ahmedelawady8/netflix_movies_recommendation_system/blob/main/app.py"
click node_carousel "https://github.com/ahmedelawady8/netflix_movies_recommendation_system/blob/main/app.py"
click node_dataset "https://github.com/ahmedelawady8/netflix_movies_recommendation_system/blob/main/Data/top10K-TMDB-movies.csv"
click node_feature_model "https://github.com/ahmedelawady8/netflix_movies_recommendation_system/blob/main/main.py"
click node_cached_movies "https://github.com/ahmedelawady8/netflix_movies_recommendation_system/blob/main/movies_list.pkl"
click node_gallery "https://github.com/ahmedelawady8/netflix_movies_recommendation_system/blob/main/frontend/src/ImageGallery.svelte"
click node_frontend_entry "https://github.com/ahmedelawady8/netflix_movies_recommendation_system/blob/main/frontend/src/main.ts"
click node_connection "https://github.com/ahmedelawady8/netflix_movies_recommendation_system/blob/main/frontend/src/streamlit/WithStreamlitConnection.svelte"
click node_streamlit_api "https://github.com/ahmedelawady8/netflix_movies_recommendation_system/blob/main/frontend/src/streamlit/streamlit.ts"
click node_lifecycle "https://github.com/ahmedelawady8/netflix_movies_recommendation_system/blob/main/frontend/src/streamlit/setStreamlitLifecycle.ts"
click node_arrow "https://github.com/ahmedelawady8/netflix_movies_recommendation_system/blob/main/frontend/src/streamlit/ArrowTable.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_selection,node_recommend,node_movie_details,node_carousel,node_user toneBlue
class node_dataset,node_feature_model,node_cached_movies,node_cached_similarity toneAmber
class node_tmdb,node_poster_images toneMint
class node_gallery,node_frontend_entry toneRose
class node_connection,node_streamlit_api,node_lifecycle,node_arrow toneIndigo
```

## Components

### Recommendation app

- [Streamlit UI](https://github.com/ahmedelawady8/netflix_movies_recommendation_system/blob/main/app.py): `app.py`
- [Title selection](https://github.com/ahmedelawady8/netflix_movies_recommendation_system/blob/main/app.py): `app.py`
- [Top-five results](https://github.com/ahmedelawady8/netflix_movies_recommendation_system/blob/main/app.py): `app.py`
- [Movie details](https://github.com/ahmedelawady8/netflix_movies_recommendation_system/blob/main/app.py): `app.py`
- [Homepage carousel](https://github.com/ahmedelawady8/netflix_movies_recommendation_system/blob/main/app.py): `app.py`

### Recommendation model

- [TMDB movie dataset](https://github.com/ahmedelawady8/netflix_movies_recommendation_system/blob/main/Data/top10K-TMDB-movies.csv): `Data/top10K-TMDB-movies.csv`
- [Feature and similarity model](https://github.com/ahmedelawady8/netflix_movies_recommendation_system/blob/main/main.py): `main.py`
- [Cached movie data](https://github.com/ahmedelawady8/netflix_movies_recommendation_system/blob/main/movies_list.pkl): `movies_list.pkl`
- **Cached similarity matrix**

### External services

- **TMDB API**
- **TMDB image service**

### Carousel frontend

- [Image gallery](https://github.com/ahmedelawady8/netflix_movies_recommendation_system/blob/main/frontend/src/ImageGallery.svelte): `frontend/src/ImageGallery.svelte`
- [Gallery bootstrap](https://github.com/ahmedelawady8/netflix_movies_recommendation_system/blob/main/frontend/src/main.ts): `frontend/src/main.ts`

### Streamlit component protocol

- [Streamlit connection wrapper](https://github.com/ahmedelawady8/netflix_movies_recommendation_system/blob/main/frontend/src/streamlit/WithStreamlitConnection.svelte): `frontend/src/streamlit/WithStreamlitConnection.svelte`
- [Streamlit message API](https://github.com/ahmedelawady8/netflix_movies_recommendation_system/blob/main/frontend/src/streamlit/streamlit.ts): `frontend/src/streamlit/streamlit.ts`
- [Frame lifecycle](https://github.com/ahmedelawady8/netflix_movies_recommendation_system/blob/main/frontend/src/streamlit/setStreamlitLifecycle.ts): `frontend/src/streamlit/setStreamlitLifecycle.ts`
- [Arrow dataframe adapter](https://github.com/ahmedelawady8/netflix_movies_recommendation_system/blob/main/frontend/src/streamlit/ArrowTable.ts): `frontend/src/streamlit/ArrowTable.ts`

### Other components

- **Movie viewer**

## Connections

- Movie viewer → Streamlit UI: uses (evidence: `README.md`)
- Streamlit UI → Title selection: renders (evidence: `app.py`)
- Title selection → Top-five results: selects title (evidence: `app.py`)
- Streamlit UI → Top-five results: invokes on click (evidence: `app.py`)
- Top-five results → Cached movie data: reads titles and IDs (evidence: `app.py`)
- Top-five results → Cached similarity matrix: reads scores (evidence: `app.py`)
- Top-five results → TMDB image service: fetches posters (evidence: `app.py`)
- Top-five results → Movie details: renders results (evidence: `app.py`)
- Movie details → TMDB API: fetches details (evidence: `app.py`)
- Streamlit UI → TMDB API: fetches carousel posters (evidence: `app.py`)
- TMDB API → TMDB image service: returns poster path
- TMDB movie dataset → Feature and similarity model: provides source data (evidence: `README.md`)
- Feature and similarity model → Cached movie data: saves cleaned data (evidence: `main.py`)
- Feature and similarity model → Cached similarity matrix: saves similarity matrix (evidence: `main.py`)
- Streamlit UI → Cached movie data: loads pickle (evidence: `app.py`)
- Streamlit UI → Cached similarity matrix: loads or rebuilds (evidence: `app.py`)
- Streamlit UI → Homepage carousel: declares component (evidence: `app.py`)
- Homepage carousel → Gallery bootstrap: loads frontend
- Gallery bootstrap → Streamlit connection wrapper: wraps gallery (evidence: `frontend/src/main.ts`)
- Gallery bootstrap → Image gallery: mounts component (evidence: `frontend/src/main.ts`)
- Streamlit connection wrapper → Streamlit message API: receives render events (evidence: `frontend/src/streamlit/WithStreamlitConnection.svelte`)
- Image gallery → Streamlit message API: sets selected value (evidence: `frontend/src/ImageGallery.svelte`)
- Image gallery → Frame lifecycle: sets frame lifecycle (evidence: `frontend/src/ImageGallery.svelte`)
- Frame lifecycle → Streamlit message API: reports frame height (evidence: `frontend/src/streamlit/setStreamlitLifecycle.ts`)
- Streamlit message API → Arrow dataframe adapter: converts dataframe args (evidence: `frontend/src/streamlit/streamlit.ts`)
