# hmzask/recommendation-system architecture

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

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

## Overview

This is a Streamlit movie-recommendation app with account registration and login, role-based admin and user views, and content-based movie recommendations. Users enter through the app, authenticate against SQLite, then either view the admin dashboard or choose a movie and request recommendations. The recommender builds TF-IDF vectors from movie genres and descriptions and ranks titles by cosine similarity. The source excerpts show the app’s calls and local data reads; no README is available, and the graph does not infer additional behavior beyond those excerpts.

Main entry points: [`app.py`](https://github.com/hmzask/recommendation-system/blob/main/app.py) (Streamlit app and routing), [`database.py`](https://github.com/hmzask/recommendation-system/blob/main/database.py) (Account and user queries), [`recommender.py`](https://github.com/hmzask/recommendation-system/blob/main/recommender.py) (Cosine similarity ranking), [`movies.csv`](https://github.com/hmzask/recommendation-system/blob/main/movies.csv) (Movie catalog)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["App interface"]
  node_app["Streamlit app and routing<br/>[app.py]"]
  node_login_register["Login and registration views<br/>[app.py]"]
  node_admin_view["Admin dashboard<br/>[app.py]"]
  node_user_view["User dashboard and selection<br/>[app.py]"]
  node_recommendation_results["Recommended titles<br/>[app.py]"]
end

subgraph group_identity["Identity and admin"]
  node_auth["Session and role checks<br/>[auth.py]"]
  node_account_ops["Account and user queries<br/>[database.py]"]
end

subgraph group_recommendation["Movie recommendations"]
  node_movie_data["Movie catalog<br/>[movies.csv]"]
  node_text_features["TF-IDF movie features<br/>[recommender.py]"]
  node_similarity["Cosine similarity ranking<br/>[recommender.py]"]
end

subgraph group_persistence["Storage and security"]
  node_password_hash["Password hashing<br/>[utils.py]"]
  node_user_store[("SQLite user database<br/>[recommendation.db]")]
end

node_visitor(("Visitor"))

node_visitor -->|"uses"| node_app
node_app -->|"initializes database"| node_account_ops
node_app -->|"renders"| node_login_register
node_app -->|"routes admins"| node_admin_view
node_app -->|"routes users"| node_user_view
node_login_register -->|"calls account operations"| node_account_ops
node_admin_view -->|"requests user data"| node_account_ops
node_app -->|"checks role and logs out"| node_auth
node_account_ops -->|"hashes passwords"| node_password_hash
node_account_ops -->|"reads and writes"| node_user_store
node_user_view -->|"loads titles"| node_movie_data
node_text_features -->|"loads catalog text"| node_movie_data
node_text_features -->|"provides vectors"| node_similarity
node_user_view -->|"requests recommendations"| node_similarity
node_similarity -->|"returns ranked titles"| node_recommendation_results
node_user_view -->|"displays titles"| node_recommendation_results

click node_app "https://github.com/hmzask/recommendation-system/blob/main/app.py"
click node_login_register "https://github.com/hmzask/recommendation-system/blob/main/app.py"
click node_admin_view "https://github.com/hmzask/recommendation-system/blob/main/app.py"
click node_user_view "https://github.com/hmzask/recommendation-system/blob/main/app.py"
click node_auth "https://github.com/hmzask/recommendation-system/blob/main/auth.py"
click node_account_ops "https://github.com/hmzask/recommendation-system/blob/main/database.py"
click node_password_hash "https://github.com/hmzask/recommendation-system/blob/main/utils.py"
click node_user_store "https://github.com/hmzask/recommendation-system/blob/main/recommendation.db"
click node_movie_data "https://github.com/hmzask/recommendation-system/blob/main/movies.csv"
click node_text_features "https://github.com/hmzask/recommendation-system/blob/main/recommender.py"
click node_similarity "https://github.com/hmzask/recommendation-system/blob/main/recommender.py"
click node_recommendation_results "https://github.com/hmzask/recommendation-system/blob/main/app.py"

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_login_register,node_admin_view,node_user_view,node_recommendation_results toneBlue
class node_auth,node_account_ops toneAmber
class node_movie_data,node_text_features,node_similarity toneMint
class node_password_hash,node_user_store toneRose
class node_visitor toneIndigo
```

## Components

### App interface

- [Streamlit app and routing](https://github.com/hmzask/recommendation-system/blob/main/app.py): `app.py`
- [Login and registration views](https://github.com/hmzask/recommendation-system/blob/main/app.py): `app.py`
- [Admin dashboard](https://github.com/hmzask/recommendation-system/blob/main/app.py): `app.py`
- [User dashboard and selection](https://github.com/hmzask/recommendation-system/blob/main/app.py): `app.py`
- [Recommended titles](https://github.com/hmzask/recommendation-system/blob/main/app.py): `app.py`

### Identity and admin

- [Session and role checks](https://github.com/hmzask/recommendation-system/blob/main/auth.py): `auth.py`
- [Account and user queries](https://github.com/hmzask/recommendation-system/blob/main/database.py): `database.py`

### Movie recommendations

- [Movie catalog](https://github.com/hmzask/recommendation-system/blob/main/movies.csv): `movies.csv`
- [TF-IDF movie features](https://github.com/hmzask/recommendation-system/blob/main/recommender.py): `recommender.py`
- [Cosine similarity ranking](https://github.com/hmzask/recommendation-system/blob/main/recommender.py): `recommender.py`

### Storage and security

- [Password hashing](https://github.com/hmzask/recommendation-system/blob/main/utils.py): `utils.py`
- [SQLite user database](https://github.com/hmzask/recommendation-system/blob/main/recommendation.db): `recommendation.db`

### Other components

- **Visitor**

## Connections

- Visitor → Streamlit app and routing: uses (evidence: `app.py`)
- Streamlit app and routing → Account and user queries: initializes database (evidence: `app.py`)
- Streamlit app and routing → Login and registration views: renders (evidence: `app.py`)
- Streamlit app and routing → Admin dashboard: routes admins (evidence: `app.py`)
- Streamlit app and routing → User dashboard and selection: routes users (evidence: `app.py`)
- Login and registration views → Account and user queries: calls account operations (evidence: `app.py`)
- Admin dashboard → Account and user queries: requests user data (evidence: `app.py`)
- Streamlit app and routing → Session and role checks: checks role and logs out (evidence: `app.py`)
- Account and user queries → Password hashing: hashes passwords (evidence: `database.py`)
- Account and user queries → SQLite user database: reads and writes (evidence: `database.py`)
- User dashboard and selection → Movie catalog: loads titles (evidence: `app.py`)
- TF-IDF movie features → Movie catalog: loads catalog text (evidence: `recommender.py`)
- TF-IDF movie features → Cosine similarity ranking: provides vectors (evidence: `recommender.py`)
- User dashboard and selection → Cosine similarity ranking: requests recommendations (evidence: `app.py`)
- Cosine similarity ranking → Recommended titles: returns ranked titles (evidence: `recommender.py`)
- User dashboard and selection → Recommended titles: displays titles (evidence: `app.py`)
