RecoStream is a fullโstack, Netflixโstyle recommendation system that provides personalized movie suggestions based on a userโs preferences, behaviors, and the semantic meaning of their inputs.
It combines SentenceโBERT semantic search with Collaborative Filtering (Surprise) and a feedback loop (like/dislike/click). The project exposes a FastAPI backend and a modern React frontend.
| Module | Description |
|---|---|
| ๐ค User Auth | Secure login/signup using hashed passwords and JWT tokens |
| ๐ฝ Movie Recommender | Semantic similarity via Sentence-BERT + genre filtering |
| ๐ Collaborative Filtering | Learns from user likes/dislikes/clicks using Surprise KNN |
| ๐ง Emotion Awareness | Recommends based on user tone: e.g., "I want a feel-good sci-fi movie" |
| ๐ Feedback Loop | Logs "like", "dislike", and "click" feedback for model improvement |
| ๐ Scalable Backend | FastAPI backend with modular architecture |
| ๐ฌ Explainability | "Because you liked Interstellar and it had a sci-fi genre..." |
| Layer | Tools |
|---|---|
| Frontend | React (Vite, Tailwind, Framer Motion, Axios) |
| Backend | FastAPI, SQLAlchemy, JWT, Pydantic |
| Recommender | Sentence-BERT, Surprise (Collaborative Filtering), Vowpal Wabbit (RL) |
| Storage | Local files (JSON/NumPy/FAISS index) |
RecoStream/
โโโ backend/
โ โโโ app/
โ โโโ main.py # FastAPI entrypoint
โ โโโ database.py # DB connection
โ โโโ models.py # ORM models (User, Feedback)
โ โโโ schemas.py # Pydantic schemas
โ โโโ recommender.py # BERT/FAISS, incremental index update
โ โโโ hybrid.py # (Optional) hybrid logic
โ โโโ routers/
โ โโโ user.py # Signup API
โ โโโ auth.py # Login/auth API
โ โโโ recommendation.py # Recommendation API (single endpoint)
โ โโโ feedback.py # Like/Dislike/Click endpoints
โโโ frontend/
โ โโโ index.html
โ โโโ src/
โ โโโ main.jsx
โ โโโ utils/api.js # Axios, endpoints, poster helpers
โ โโโ contexts/ # Auth, Toast, Profile contexts
โ โโโ components/ # MovieCard, MovieModal, MovieGrid, Layout
โ โโโ pages/ # Home, Search, Genre, Profile, Login, Signup
โโโ requirements.txt # Python dependencies (install with conda)
โโโ .env # Backend environment variables
โโโ DockerFile
โโโ docker-compose.yml
โโโ build-and-deploy.sh
โโโ init.sql
โโโ .env.docker
โโโ README.md
The commands below assume you are in the project root: RecoStream/.
- Anaconda/Miniconda installed (for the
recostreamenvironment) - Node.js 18+
conda create -n recostream python=3.10 -y
conda activate recostreamUse conda to install dependencies from requirements.txt.
conda activate recostream
conda install --file requirements.txt -c conda-forge -y
# If any packages are missing on conda, you can fallback to pip:
# pip install -r requirements.txtSECRET_KEY=your_secret_key
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=60
# Add any other keys required by your appCreate this .env file at backend/app/.env or load using your preferred config strategy.
conda activate recostream
uvicorn backend.app.main:app --reloadThe API will be available at: http://127.0.0.1:8000
Interactive docs: http://127.0.0.1:8000/docs
conda activate recostream
cd frontend
npm install
npm run devBy default Vite will start on: http://localhost:5173
For quick setup using Docker and Docker Compose:
# Build and start all services
docker-compose up --build
# Access the app
# - Frontend: http://localhost:5173
# - API docs: http://localhost:8000/docs
To Stop Services:
docker-compose downuse the optional deployment script for advanced management:
./build-and-deploy.sh build
./build-and-deploy.sh prod
- โ User Signup/Login (JWT)
- โ BERT-based recommendations
- โ Feedback logging (like/dislike/click)
- โ Collaborative Filtering with Surprise
- โ Feedback-based learning
- โ Modular FastAPI backend
{
"user_input": "I like sci-fi space movies"
}[
{"title": "Interstellar", "score": 0.401},
{"title": "Spaceman", "score": 0.323},
{"title": "Shutter Island", "score": 0.182}
]| Feature | Status |
|---|---|
| ๐ค Reinforcement Learning (VW) | ๐ง In Progress |
| ๐ Dynamic CF Retraining | โ Done |
| ๐งพ Movie-to-ID Mapping | โ Done |
| ๐ฏ Learnable Ranking (BERT + CF) | โ Hybrid done |
| ๐ง User Clustering | ๐ Planned |
| ๐ฑ Frontend UI (React) | โ Implemented |
| ๐ก๏ธ OAuth + Refresh Tokens | ๐ Planned |
- โ
Integrate Vowpal Wabbit into
/bandit_recommendroute - โ Track real-time feedback for Bandit reward learning
- โณ Retrain VW model incrementally on new interactions
- ๐ฎ Add visual analytics (feedback trends, popular genres)
- ๐ฒ Build mobile-ready frontend with personalized dashboards
Pull requests are welcome! For major changes, please open an issue first to discuss your ideas.
This project is open-source under the MIT License.
-
CORS errors during local dev
- Ensure the FastAPI CORS middleware allows
http://localhost:5173.
- Ensure the FastAPI CORS middleware allows
-
Missing posters
- The frontend uses
poster_pathreturned by the backend. If a movie has no poster, a placeholder is shown.
- The frontend uses
-
Profile shows movie ID instead of title
- Ensure the backend feedback stats endpoint returns
movie_titleandmovie_yearfor each feedback entry (join with your movie dataset or store these values at feedback time).
- Ensure the backend feedback stats endpoint returns
-
FAISS index updates
- Add new movies to the source JSON used by
recommender.pyand call the update function (e.g., expose an admin route that callsupdate_faiss_index()to append to the index without full rebuild).
- Add new movies to the source JSON used by
Inspired by Netflix, Spotify, and real-world hybrid recommender systems with:
- NLP + emotion modeling
- Collaborative filtering
- Online learning (bandits)
๐ฌ Built with passion for learning how recommendation systems like Netflix actually work โ
blending machine learning, software engineering, and personalization.
