# sivakrishna916/cinexa architecture

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

- Interactive diagram: https://gitdiagram.com/sivakrishna916/cinexa
- Repository: https://github.com/sivakrishna916/cinexa

## Overview

Cinexa takes users from account registration or login into a movie-browsing and rating experience, then returns personalized recommendations and taste insights. The React client uses the Node/Express service for JWT-backed account operations and the FastAPI service for movie, rating, recommendation, and profile operations. The ML service combines collaborative and content-based recommendation logic over PostgreSQL data. The README documents the major product capabilities; unsampled routes and page implementations are represented at their known paths, with relationships included only where the excerpts, source index, or README support them.

Main entry points: [`frontend/src/api/axios.js`](https://github.com/sivakrishna916/cinexa/blob/master/frontend/src/api/axios.js) (API client), [`frontend/src/App.jsx`](https://github.com/sivakrishna916/cinexa/blob/master/frontend/src/App.jsx) (App navigation), [`ml_engine/app/db/postgres.py`](https://github.com/sivakrishna916/cinexa/blob/master/ml_engine/app/db/postgres.py) (PostgreSQL access), [`backend/models/User.js`](https://github.com/sivakrishna916/cinexa/blob/master/backend/models/User.js) (User model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["React client"]
  node_app["App navigation<br/>[App.jsx]"]
  node_authcontext["Auth state<br/>[AuthContext.jsx]"]
  node_api["API client<br/>[axios.js]"]
  node_login["Login and register<br/>[Login.jsx]"]
  node_dashboard["Recommendations view<br/>[Dashboard.jsx]"]
  node_movies["Movie browser<br/>[Movies.jsx]"]
  node_profile["Taste profile<br/>[Profile.jsx]"]
end

subgraph group_accounts["Account service"]
  node_nodeapp["Express API<br/>[app.js]"]
  node_authroutes["Auth routes<br/>[auth.js]"]
  node_authcontroller["Auth operations<br/>[authController.js]"]
  node_authmiddleware["JWT protection<br/>[authMiddleware.js]"]
  node_userroutes["User routes<br/>[user.js]"]
  node_user["User model<br/>[User.js]"]
  node_mongodb[("MongoDB")]
end

subgraph group_recommendation["ML recommendation service"]
  node_fastapi["ML API<br/>[main.py]"]
  node_movieroutes["Movie endpoints<br/>[movies.py]"]
  node_recroutes["Recommendation endpoints<br/>[recommend.py]"]
  node_hybrid["Hybrid recommender<br/>[hybrid.py]"]
  node_collaborative["Collaborative filtering<br/>[collaborative.py]"]
  node_content["Content filtering<br/>[content_based.py]"]
end

subgraph group_data["Movie data"]
  node_postgresio["PostgreSQL access<br/>[postgres.py]"]
  node_postgres[("PostgreSQL")]
  node_preprocess["Dataset loader<br/>[preprocess.py]"]
  node_csvdata["MovieLens data<br/>[movies.csv]"]
  node_ratingsdata["Rating dataset<br/>[ratings.csv]"]
end

node_viewer(("Movie viewer"))

node_viewer -->|"uses"| node_app
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_movies
node_app -->|"routes to"| node_profile
node_app -->|"checks state"| node_authcontext
node_login -->|"calls"| node_api
node_dashboard -->|"calls"| node_api
node_movies -->|"calls"| node_api
node_profile -->|"calls"| node_api
node_authcontext -->|"restores session"| node_api
node_api -->|"auth requests"| node_nodeapp
node_api -->|"movie and taste requests"| node_fastapi
node_nodeapp -->|"mounts"| node_authroutes
node_nodeapp -->|"mounts"| node_userroutes
node_authroutes -->|"dispatches"| node_authcontroller
node_authroutes -->|"protects session route"| node_authmiddleware
node_authmiddleware -->|"loads account"| node_user
node_userroutes -->|"uses protection"| node_authmiddleware
node_userroutes -->|"uses model"| node_user
node_authcontroller -->|"reads and saves"| node_user
node_user -->|"persists account"| node_mongodb
node_authcontroller -->|"creates linked user"| node_postgres
node_fastapi -->|"mounts"| node_movieroutes
node_fastapi -->|"mounts"| node_recroutes
node_movieroutes -->|"queries movies"| node_postgresio
node_recroutes -->|"reads and saves ratings"| node_postgresio
node_recroutes -->|"requests recommendations"| node_hybrid
node_hybrid -->|"combines results"| node_collaborative
node_hybrid -->|"combines results"| node_content
node_collaborative -->|"loads ratings"| node_postgresio
node_content -->|"loads movie data"| node_postgresio
node_postgresio -->|"queries and updates"| node_postgres
node_preprocess -->|"loads dataset"| node_csvdata
node_preprocess -->|"loads dataset"| node_ratingsdata
node_preprocess -->|"loads data"| node_postgres

click node_app "https://github.com/sivakrishna916/cinexa/blob/master/frontend/src/App.jsx"
click node_authcontext "https://github.com/sivakrishna916/cinexa/blob/master/frontend/src/context/AuthContext.jsx"
click node_api "https://github.com/sivakrishna916/cinexa/blob/master/frontend/src/api/axios.js"
click node_login "https://github.com/sivakrishna916/cinexa/blob/master/frontend/src/pages/Login.jsx"
click node_dashboard "https://github.com/sivakrishna916/cinexa/blob/master/frontend/src/pages/Dashboard.jsx"
click node_movies "https://github.com/sivakrishna916/cinexa/blob/master/frontend/src/pages/Movies.jsx"
click node_profile "https://github.com/sivakrishna916/cinexa/blob/master/frontend/src/pages/Profile.jsx"
click node_nodeapp "https://github.com/sivakrishna916/cinexa/blob/master/backend/app.js"
click node_authroutes "https://github.com/sivakrishna916/cinexa/blob/master/backend/routes/auth.js"
click node_authcontroller "https://github.com/sivakrishna916/cinexa/blob/master/backend/controllers/authController.js"
click node_authmiddleware "https://github.com/sivakrishna916/cinexa/blob/master/backend/middleware/authMiddleware.js"
click node_userroutes "https://github.com/sivakrishna916/cinexa/blob/master/backend/routes/user.js"
click node_user "https://github.com/sivakrishna916/cinexa/blob/master/backend/models/User.js"
click node_fastapi "https://github.com/sivakrishna916/cinexa/blob/master/ml_engine/app/main.py"
click node_movieroutes "https://github.com/sivakrishna916/cinexa/blob/master/ml_engine/app/routes/movies.py"
click node_recroutes "https://github.com/sivakrishna916/cinexa/blob/master/ml_engine/app/routes/recommend.py"
click node_hybrid "https://github.com/sivakrishna916/cinexa/blob/master/ml_engine/app/services/hybrid.py"
click node_collaborative "https://github.com/sivakrishna916/cinexa/blob/master/ml_engine/app/services/collaborative.py"
click node_content "https://github.com/sivakrishna916/cinexa/blob/master/ml_engine/app/services/content_based.py"
click node_postgresio "https://github.com/sivakrishna916/cinexa/blob/master/ml_engine/app/db/postgres.py"
click node_preprocess "https://github.com/sivakrishna916/cinexa/blob/master/ml_engine/data/preprocess.py"
click node_csvdata "https://github.com/sivakrishna916/cinexa/blob/master/ml_engine/data/movies.csv"
click node_ratingsdata "https://github.com/sivakrishna916/cinexa/blob/master/ml_engine/data/ratings.csv"

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_authcontext,node_api,node_login,node_dashboard,node_movies,node_profile,node_viewer toneBlue
class node_nodeapp,node_authroutes,node_authcontroller,node_authmiddleware,node_userroutes,node_user,node_mongodb toneAmber
class node_fastapi,node_movieroutes,node_recroutes,node_hybrid,node_collaborative,node_content toneMint
class node_postgresio,node_postgres,node_preprocess,node_csvdata,node_ratingsdata toneRose
```

## Components

### React client

- [App navigation](https://github.com/sivakrishna916/cinexa/blob/master/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Auth state](https://github.com/sivakrishna916/cinexa/blob/master/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [API client](https://github.com/sivakrishna916/cinexa/blob/master/frontend/src/api/axios.js): `frontend/src/api/axios.js`
- [Login and register](https://github.com/sivakrishna916/cinexa/blob/master/frontend/src/pages/Login.jsx): `frontend/src/pages/Login.jsx`
- [Recommendations view](https://github.com/sivakrishna916/cinexa/blob/master/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [Movie browser](https://github.com/sivakrishna916/cinexa/blob/master/frontend/src/pages/Movies.jsx): `frontend/src/pages/Movies.jsx`
- [Taste profile](https://github.com/sivakrishna916/cinexa/blob/master/frontend/src/pages/Profile.jsx): `frontend/src/pages/Profile.jsx`

### Account service

- [Express API](https://github.com/sivakrishna916/cinexa/blob/master/backend/app.js): `backend/app.js`
- [Auth routes](https://github.com/sivakrishna916/cinexa/blob/master/backend/routes/auth.js): `backend/routes/auth.js`
- [Auth operations](https://github.com/sivakrishna916/cinexa/blob/master/backend/controllers/authController.js): `backend/controllers/authController.js`
- [JWT protection](https://github.com/sivakrishna916/cinexa/blob/master/backend/middleware/authMiddleware.js): `backend/middleware/authMiddleware.js`
- [User routes](https://github.com/sivakrishna916/cinexa/blob/master/backend/routes/user.js): `backend/routes/user.js`
- [User model](https://github.com/sivakrishna916/cinexa/blob/master/backend/models/User.js): `backend/models/User.js`
- **MongoDB**

### ML recommendation service

- [ML API](https://github.com/sivakrishna916/cinexa/blob/master/ml_engine/app/main.py): `ml_engine/app/main.py`
- [Movie endpoints](https://github.com/sivakrishna916/cinexa/blob/master/ml_engine/app/routes/movies.py): `ml_engine/app/routes/movies.py`
- [Recommendation endpoints](https://github.com/sivakrishna916/cinexa/blob/master/ml_engine/app/routes/recommend.py): `ml_engine/app/routes/recommend.py`
- [Hybrid recommender](https://github.com/sivakrishna916/cinexa/blob/master/ml_engine/app/services/hybrid.py): `ml_engine/app/services/hybrid.py`
- [Collaborative filtering](https://github.com/sivakrishna916/cinexa/blob/master/ml_engine/app/services/collaborative.py): `ml_engine/app/services/collaborative.py`
- [Content filtering](https://github.com/sivakrishna916/cinexa/blob/master/ml_engine/app/services/content_based.py): `ml_engine/app/services/content_based.py`

### Movie data

- [PostgreSQL access](https://github.com/sivakrishna916/cinexa/blob/master/ml_engine/app/db/postgres.py): `ml_engine/app/db/postgres.py`
- **PostgreSQL**
- [Dataset loader](https://github.com/sivakrishna916/cinexa/blob/master/ml_engine/data/preprocess.py): `ml_engine/data/preprocess.py`
- [MovieLens data](https://github.com/sivakrishna916/cinexa/blob/master/ml_engine/data/movies.csv): `ml_engine/data/movies.csv`
- [Rating dataset](https://github.com/sivakrishna916/cinexa/blob/master/ml_engine/data/ratings.csv): `ml_engine/data/ratings.csv`

### Other components

- **Movie viewer**

## Connections

- Movie viewer → App navigation: uses (evidence: `frontend/src/App.jsx`)
- App navigation → Login and register: routes to (evidence: `frontend/src/App.jsx`)
- App navigation → Recommendations view: routes to (evidence: `frontend/src/App.jsx`)
- App navigation → Movie browser: routes to (evidence: `frontend/src/App.jsx`)
- App navigation → Taste profile: routes to (evidence: `frontend/src/App.jsx`)
- App navigation → Auth state: checks state (evidence: `frontend/src/App.jsx`)
- Login and register → API client: calls (evidence: `frontend/src/pages/Login.jsx`)
- Recommendations view → API client: calls (evidence: `frontend/src/pages/Dashboard.jsx`)
- Movie browser → API client: calls (evidence: `frontend/src/pages/Movies.jsx`)
- Taste profile → API client: calls (evidence: `frontend/src/pages/Profile.jsx`)
- Auth state → API client: restores session (evidence: `frontend/src/context/AuthContext.jsx`)
- API client → Express API: auth requests (evidence: `frontend/src/api/axios.js`)
- API client → ML API: movie and taste requests (evidence: `frontend/src/api/axios.js`)
- Express API → Auth routes: mounts (evidence: `backend/app.js`)
- Express API → User routes: mounts (evidence: `backend/app.js`)
- Auth routes → Auth operations: dispatches (evidence: `backend/routes/auth.js`)
- Auth routes → JWT protection: protects session route (evidence: `backend/routes/auth.js`)
- JWT protection → User model: loads account (evidence: `backend/middleware/authMiddleware.js`)
- User routes → JWT protection: uses protection (evidence: `backend/routes/user.js`)
- User routes → User model: uses model (evidence: `backend/routes/user.js`)
- Auth operations → User model: reads and saves (evidence: `backend/controllers/authController.js`)
- User model → MongoDB: persists account (evidence: `README.md`)
- Auth operations → PostgreSQL: creates linked user (evidence: `backend/controllers/authController.js`)
- ML API → Movie endpoints: mounts (evidence: `ml_engine/app/main.py`)
- ML API → Recommendation endpoints: mounts (evidence: `ml_engine/app/main.py`)
- Movie endpoints → PostgreSQL access: queries movies (evidence: `ml_engine/app/routes/movies.py`)
- Recommendation endpoints → PostgreSQL access: reads and saves ratings (evidence: `ml_engine/app/routes/recommend.py`)
- Recommendation endpoints → Hybrid recommender: requests recommendations (evidence: `ml_engine/app/routes/recommend.py`)
- Hybrid recommender → Collaborative filtering: combines results (evidence: `ml_engine/app/services/hybrid.py`)
- Hybrid recommender → Content filtering: combines results (evidence: `ml_engine/app/services/hybrid.py`)
- Collaborative filtering → PostgreSQL access: loads ratings (evidence: `ml_engine/app/services/collaborative.py`)
- Content filtering → PostgreSQL access: loads movie data (evidence: `ml_engine/app/services/content_based.py`)
- PostgreSQL access → PostgreSQL: queries and updates (evidence: `ml_engine/app/db/postgres.py`)
- Dataset loader → MovieLens data: loads dataset (evidence: `README.md`)
- Dataset loader → Rating dataset: loads dataset (evidence: `README.md`)
- Dataset loader → PostgreSQL: loads data (evidence: `README.md`)
