Skip to content

devpatel516/movie-recommendation-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Movie Recommendation System

Project

  • Description: A full-stack movie recommendation system that provides movie search and recommendations. The repository contains a React client, an Express server, and a small Python FastAPI service that serves TF-IDF based recommendations using precomputed pickled models.

Features

  • Search movies: Query movie details via the OMDb API (server uses OMDB_API_KEY).
  • Content-based recommendations: A Python FastAPI service returns TF-IDF recommendations from precomputed data by natural language processing.
  • Simple REST API: The server exposes endpoints used by the React client.

Tech Stack

  • Frontend: React (create-react-app)
  • Backend: Node.js + Express
  • ML service: Python + FastAPI (served by uvicorn)

Repository Structure (important files)

  • client/ — React app (run with npm start)
  • server/ — Node/Express API (run with npm start)
  • server/python-ml/ — FastAPI TF-IDF recommender (main.py and pickled model files)

Prerequisites

  • Node.js (16+) and npm
  • Python 3.8+ and pip
  • An OMDb API key (set as OMDB_API_KEY in server .env)

Setup & Run (Windows)

  1. Clone the repo
git clone <repo-url>
cd movie-recommendation-system
  1. Server (Node/Express)
  • Install dependencies and set environment variables:
cd server
npm install
# create a .env file with at least:
# OMDB_API_KEY=your_key_here
  • Start the server:
npm start

The server uses server.js and exposes the API used by the client. The OMDB_API_KEY environment variable is read as process.env.OMDB_API_KEY.

  1. Python ML service (TF-IDF recommender)
  • Create and activate a virtual environment, then install the minimal packages:
cd server/python-ml
python -m venv venv
venv\Scripts\activate
pip install fastapi uvicorn pandas numpy
  • Start the FastAPI service (binds to port 8001 by default):
uvicorn main:app --host 0.0.0.0 --port 8001

Notes:

  • The python-ml folder already contains df.pkl, indices.pkl, and tfidf_matrix.pkl used by main.py.
  • The server calls the recommender at http://localhost:8001/recommend/tfidf (see server/utils/pythonML.js).
  1. Client (React)
cd ../../client
npm install
npm start

The React app will open in the browser (usually at http://localhost:3000) and talk to the Express server for search and recommendations.

Environment variables

  • Create server/.env with:
OMDB_API_KEY=your_omdb_key
# (other env vars if added later)

Run order

  • Start the Python ML service (uvicorn) first (so recommender endpoint is available).
  • Start the Node server next (npm start).
  • Start the React client last (npm start in client/).

Testing

  • Use the browser UI to search for titles and request recommendations.
  • You can call recommender directly:
curl "http://localhost:8001/recommend/tfidf?title=The%20Matrix&top_n=5"

Troubleshooting

  • If the client cannot fetch data, confirm the Express server is running and that CORS is enabled.
  • If the recommender returns 404 for a title, the title may not exist in the pickled dataset (ensure titles are normalized and present in indices.pkl).
  • If Python packages fail to install, confirm pip and Python versions; use python -m pip install --upgrade pip.

About

This project is a full-stack movie recommendation system that suggests similar movies based on content similarity and enriches the results with real-time movie data.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors