Skip to content

This repository implements a full-stack movie recommendation system that uses semantic text embeddings to compute movie similarity. Text embeddings are generated with Hugging Face’s all-MiniLM-L6-v2 model (lightweight, fast, high-quality for semantic search), enabling efficient similarity search and recommendations in the Node.js backend.

Notifications You must be signed in to change notification settings

Akashgite1/Movies-Recommendation-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🎬 Movies Recommendation System

alt text

📌 Overview The Movies Recommendation System is an AI-powered platform designed to recommend movies based on semantic similarity between their descriptions, titles, and genres. It leverages vector embeddings generated from Hugging Face and OpenAI models to enable fast, accurate similarity searches in MongoDB.

This project is intended for:

• Developers exploring AI-powered recommendation engines.
• Data engineers learning vector search in MongoDB.
• AI/ML practitioners experimenting with semantic embeddings.
• Full-stack developers integrating AI models with React + Node.js.

🧠 What Are Vector Embeddings in AI? Vector embeddings are numerical representations of data (e.g., text, images) in a high-dimensional space. For example, the sentence "A superhero movie with time travel" is converted into a 384-dimensional vector like:

Semantically similar items will have embeddings that are close in this vector space.

  [0.1232, 0.345, 0.456, ...]

🔍 What Is Vector Similarity Search? Vector similarity search finds items in a database whose embeddings are most similar to a given query vector. Common metrics include cosine similarity and dot product. In this project, similarity search is performed using MongoDB's Vector Search index. alt text

🤖 Hugging Face Model We use Hugging Face's all-MiniLM-L6-v2 model from the Sentence Transformers library.

► Embedding size: 384 dimensions
► Optimized for semantic similarity and search
► Lightweight and fast
► API Access: Requires a Hugging Face API token (HUGGINGFACE_API_KEY) for hosted inference.

📥 Data Ingestion Process (Sample Data – 250 Movies) Create MongoDB Collection – Store movie metadata.

1. Generate Vector Embeddings – For each movie, convert title, plot, and genre into embeddings.
2. Insert Into MongoDB – Store embeddings as arrays in a field (e.g., embedding).
3. Create MongoDB Vector Search Index – Enable fast similarity queries.
4. Run Aggregation Pipeline in MongoDB Compass – Test vector search manually.

🖥 API Server Setup Backend is built with Node.js + Express.js.

Endpoints:
GET /movies → Returns all movies.
GET /movies/recommend/:id → Returns similar movies for a given movie ID.
GET /movies/search?query="avengers" → Returns movies matching a text query.

📂 Project Structure

├── backend/                
│   ├── index.js/           
│   ├── createEmbeddings.js/          
│   ├── db.js            
│   └── getHuggingFaceEmbeddings.js/        
├── frontend/                
│   ├── components/        
│   ├── pages/            
│   └── services/          

High-Level Design (HLD)

 Data Ingestion Flow
 Recommendation by Target Movie ID
 Recommendation by Search Term

alt text

Data-Flow Diagram

img/Data-Flow.png

🔘Installation

Instructions on how to set up the project locally.

  1. Clone the repository

    git clone https://github.com/your-username/movies-recommendation-system.git
    cd movies-recommendation-system
    
  2. Install backend dependencies

     cd backend   
     npm install
    
  3. Create environment variables

     cp .env.example .env  
     Edit .env with your MongoDB URI, Hugging Face API key, and other settings
    
  4. Install frontend dependencies

     cd ../frontend   
     npm install
    
  5. Set up MongoDB

     Start local MongoDB server OR
     Use MongoDB Atlas and paste connection string in backend .env
    
  6. Run the backend server

     cd ../backend   
     npm run dev
    
  7. Run the frontend application

     cd ../frontend  
     npm run dev
    

Technologies

React – UI framework (Vite + Tailwind)
Node.js + Express – Backend API
MongoDB – Database with vector search
Hugging Face – all-MiniLM-L6-v2 model for text embeddings
Redis – Caching layer (optional)

Acknowledgments

About

This repository implements a full-stack movie recommendation system that uses semantic text embeddings to compute movie similarity. Text embeddings are generated with Hugging Face’s all-MiniLM-L6-v2 model (lightweight, fast, high-quality for semantic search), enabling efficient similarity search and recommendations in the Node.js backend.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published