# devabisheik/movie-recommendation-system architecture

> Architecture diagram of the GitHub repository devabisheik/movie-recommendation-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/devabisheik/movie-recommendation-system
- Repository: https://github.com/devabisheik/movie-recommendation-system

## Overview

#### Purpose and entry points
This repository is a content-based movie recommender with a Streamlit UI. `app.py` is the runtime entry point (`streamlit run app.py`); `create_pickle.py` is the offline/on-demand artifact-generation entry point. The source catalog is `movies.csv`.

#### Application runtime
`app.py` owns the interactive recommendation flow: load persisted movie and similarity data, let a user select a movie, find its nearest neighbors, and render the top 10 results. It also fetches poster imagery from TMDB, making the UI dependent on external network/API availability.

Grounding: `app.py`, `requirements.txt`

#### Dataset and feature source
`movies.csv` is the local movie catalog used for recommendation training and lookup. Its movie metadata is the boundary between raw source data and the derived model artifacts consumed by the UI.

Grounding: `movies.csv`, `create_pickle.py`

#### Recommendation artifact pipeline
`create_pickle.py` transforms the CSV catalog into reusable serialized artifacts. The documented stages are preprocessing, feature combination, TF-IDF vectorization, and cosine-similarity calculation. This separates comparatively expensive model construction from interactive recommendation serving.

Grounding: `create_pickle.py`, `movies.csv`

#### Persistence and startup behavior
The application uses Pickle to persist a movie table/index and the similarity matrix as `movies.pkl` and `similarity.pkl`. These generated files are not present in the supplied tree, so they are runtime-derived state. Per the README, the application creates them on first run if absent.

Grounding: `app.py`, `create_pickle.py`

#### Recommendation control flow
A user selection in Streamlit maps to a movie record/index in the persisted movie dataset. `app.py` uses that index to read similarity scores from the cosine-similarity matrix, ranks candidate movies, selects the top 10, and presents them with TMDB poster data.

Grounding: `app.py`

#### Dependencies and external boundary
The material runtime is Python with Streamlit, Pandas, scikit-learn, Requests, and Pickle, declared in `requirements.txt`. Scikit-learn provides TF-IDF and cosine similarity; Requests crosses the application boundary to TMDB for poster retrieval. Development can optionally run in the provided container environment.

Grounding: `requirements.txt`, `.devcontainer/devcontainer.json`, `app.py`

Main entry points: [`app.py`](https://github.com/devabisheik/movie-recommendation-system/blob/main/app.py) (Streamlit app), [`create_pickle.py`](https://github.com/devabisheik/movie-recommendation-system/blob/main/create_pickle.py) (Artifact generator), [`requirements.txt`](https://github.com/devabisheik/movie-recommendation-system/blob/main/requirements.txt) (Python dependencies), [`movies.csv`](https://github.com/devabisheik/movie-recommendation-system/blob/main/movies.csv) (Movie catalog)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_offline["Artifact pipeline"]
  node_catalog[("Movie catalog<br/>CSV dataset<br/>[movies.csv]")]
  node_generator["Artifact generator<br/>Python entry point<br/>[create_pickle.py]"]
  node_preprocessing["Preprocessing<br/>pipeline stage<br/>[create_pickle.py]"]
  node_features["Combined features<br/>pipeline stage<br/>[create_pickle.py]"]
  node_tfidf["TF-IDF vectors<br/>model representation<br/>[create_pickle.py]"]
  node_similarity_build["Cosine similarity<br/>pipeline stage<br/>[create_pickle.py]"]
  node_movies_artifact[("Movie table/index<br/>Pickle artifact")]
  node_similarity_artifact[("Similarity matrix<br/>Pickle artifact")]
end

subgraph group_runtime["Streamlit serving"]
  node_app["Streamlit app<br/>Python entry point<br/>[app.py]"]
  node_selection(("Movie selection<br/>UI interaction<br/>[app.py]"))
  node_ranking["Top-10 ranking<br/>recommendation logic<br/>[app.py]"]
  node_results["Recommendation results<br/>UI output<br/>[app.py]"]
end

node_tmdb{{"TMDB<br/>external poster API"}}
node_dependencies["Python dependencies<br/>runtime dependencies<br/>[requirements.txt]"]
node_container["Dev container<br/>development environment<br/>[devcontainer.json]"]

node_catalog -->|"input"| node_generator
node_generator -->|"runs"| node_preprocessing
node_preprocessing -->|"cleans metadata"| node_features
node_features -->|"vectorizes"| node_tfidf
node_tfidf -->|"compares"| node_similarity_build
node_generator -->|"serializes"| node_movies_artifact
node_similarity_build -->|"serializes"| node_similarity_artifact
node_movies_artifact -->|"loads at startup"| node_app
node_similarity_artifact -->|"loads at startup"| node_app
node_app -->|"accepts"| node_selection
node_selection -->|"movie index"| node_ranking
node_movies_artifact -->|"lookup"| node_ranking
node_similarity_artifact -->|"scores"| node_ranking
node_ranking -->|"top 10"| node_results
node_tmdb -->|"poster data"| node_results
node_dependencies -.->|"provides runtime libraries"| node_app
node_dependencies -.->|"provides ML libraries"| node_generator
node_container -.->|"optional development runtime"| node_app

click node_catalog "https://github.com/devabisheik/movie-recommendation-system/blob/main/movies.csv"
click node_generator "https://github.com/devabisheik/movie-recommendation-system/blob/main/create_pickle.py"
click node_preprocessing "https://github.com/devabisheik/movie-recommendation-system/blob/main/create_pickle.py"
click node_features "https://github.com/devabisheik/movie-recommendation-system/blob/main/create_pickle.py"
click node_tfidf "https://github.com/devabisheik/movie-recommendation-system/blob/main/create_pickle.py"
click node_similarity_build "https://github.com/devabisheik/movie-recommendation-system/blob/main/create_pickle.py"
click node_app "https://github.com/devabisheik/movie-recommendation-system/blob/main/app.py"
click node_selection "https://github.com/devabisheik/movie-recommendation-system/blob/main/app.py"
click node_ranking "https://github.com/devabisheik/movie-recommendation-system/blob/main/app.py"
click node_results "https://github.com/devabisheik/movie-recommendation-system/blob/main/app.py"
click node_dependencies "https://github.com/devabisheik/movie-recommendation-system/blob/main/requirements.txt"
click node_container "https://github.com/devabisheik/movie-recommendation-system/blob/main/.devcontainer/devcontainer.json"

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_catalog,node_generator,node_preprocessing,node_features,node_tfidf,node_similarity_build,node_movies_artifact,node_similarity_artifact toneBlue
class node_app,node_selection,node_ranking,node_results toneAmber
class node_tmdb,node_dependencies,node_container toneNeutral
```

## Components

### Artifact pipeline

Builds reusable recommendation data.

- [Movie catalog](https://github.com/devabisheik/movie-recommendation-system/blob/main/movies.csv): CSV dataset · Raw movie metadata used for training and lookup. · `movies.csv`
- [Artifact generator](https://github.com/devabisheik/movie-recommendation-system/blob/main/create_pickle.py): Python entry point · Prepares and serializes recommendation artifacts. · `create_pickle.py`
- [Preprocessing](https://github.com/devabisheik/movie-recommendation-system/blob/main/create_pickle.py): pipeline stage · `create_pickle.py`
- [Combined features](https://github.com/devabisheik/movie-recommendation-system/blob/main/create_pickle.py): pipeline stage · `create_pickle.py`
- [TF-IDF vectors](https://github.com/devabisheik/movie-recommendation-system/blob/main/create_pickle.py): model representation · `create_pickle.py`
- [Cosine similarity](https://github.com/devabisheik/movie-recommendation-system/blob/main/create_pickle.py): pipeline stage · `create_pickle.py`
- **Movie table/index**: Pickle artifact · Runtime-derived movie lookup data.
- **Similarity matrix**: Pickle artifact · Runtime-derived nearest-neighbor scores.

### Streamlit serving

Interactive recommendation flow.

- [Streamlit app](https://github.com/devabisheik/movie-recommendation-system/blob/main/app.py): Python entry point · Interactive runtime and recommendation orchestrator. · `app.py`
- [Movie selection](https://github.com/devabisheik/movie-recommendation-system/blob/main/app.py): UI interaction · `app.py`
- [Top-10 ranking](https://github.com/devabisheik/movie-recommendation-system/blob/main/app.py): recommendation logic · Ranks candidates using similarity scores. · `app.py`
- [Recommendation results](https://github.com/devabisheik/movie-recommendation-system/blob/main/app.py): UI output · `app.py`

### Other components

- **TMDB**: external poster API · Supplies poster imagery over the network.
- [Python dependencies](https://github.com/devabisheik/movie-recommendation-system/blob/main/requirements.txt): runtime dependencies · Streamlit, Pandas, scikit-learn, Requests, and Pickle. · `requirements.txt`
- [Dev container](https://github.com/devabisheik/movie-recommendation-system/blob/main/.devcontainer/devcontainer.json): development environment · `.devcontainer/devcontainer.json`

## Connections

- Movie catalog → Artifact generator: input
- Artifact generator → Preprocessing: runs
- Preprocessing → Combined features: cleans metadata
- Combined features → TF-IDF vectors: vectorizes
- TF-IDF vectors → Cosine similarity: compares
- Artifact generator → Movie table/index: serializes
- Cosine similarity → Similarity matrix: serializes
- Movie table/index → Streamlit app: loads at startup
- Similarity matrix → Streamlit app: loads at startup
- Streamlit app → Movie selection: accepts
- Movie selection → Top-10 ranking: movie index
- Movie table/index → Top-10 ranking: lookup
- Similarity matrix → Top-10 ranking: scores
- Top-10 ranking → Recommendation results: top 10
- TMDB → Recommendation results: poster data
- Python dependencies → Streamlit app: provides runtime libraries
- Python dependencies → Artifact generator: provides ML libraries
- Dev container → Streamlit app: optional development runtime
