A content-based movie recommendation system with a modern web interface. The backend is built with Python and Flask, using a pre-processed movie dataset and cosine similarity to recommend movies. The frontend is built with React, TypeScript, and Tailwind CSS. Movie posters and details are fetched live from the TMDB API.
- 🎯 Content-based movie recommendations (CountVectorizer + cosine similarity)
- 🎬 Movie posters, trailers, cast, and similar movies via the TMDB API
- 🎨 Modern, responsive UI with a dark theme
- 🚀 Fast search and real-time results
- 📱 Mobile-friendly design
- The backend loads
backend/data/processed_movies.csv, which contains pre-processed movie data with acombined_featurescolumn (genres, keywords, cast, etc.). - A
CountVectorizerconverts the combined features into a feature matrix and computes pairwise cosine similarity across all movies. - When a movie title is submitted, the backend returns the 5 most similar movies based on cosine similarity.
- For each recommended movie, the backend fetches the poster image from the TMDB API.
- The frontend (React + TypeScript) calls the Flask API at
http://localhost:5000/recommendand displays the results. Clicking a movie card fetches full details (overview, cast, trailer, similar movies) via the/api/movie/<id>endpoint.
.
├── backend/
│ ├── data/
│ │ └── processed_movies.csv # Pre-processed movie dataset
│ └── movie_recommender_api.py # Flask API server
├── frontend/
│ ├── src/
│ │ ├── components/ # React UI components
│ │ ├── hooks/ # Custom hooks (recommendations, movie details)
│ │ ├── types/ # TypeScript type definitions
│ │ └── App.tsx # Root component
│ ├── package.json
│ └── vite.config.ts
├── notebooks/
│ └── Project Movie Recommender(Rule-Based).ipynb # Jupyter notebook for exploration
└── requirements.txt # Python dependencies
Frontend
- React 18
- TypeScript
- Tailwind CSS
- Vite
- lucide-react (icons)
Backend
- Python 3.8+
- Flask
- Flask-CORS
- Pandas
- scikit-learn (CountVectorizer, cosine similarity)
- NumPy
- Requests (TMDB API calls)
- Python 3.8+
- Node.js and npm
- Git
git clone <repository-url>
cd Movie-Recommendation-SystemCreate and activate a virtual environment:
# Using venv
python -m venv venv
# On Windows
.\venv\Scripts\activate
# On macOS/Linux
source venv/bin/activateInstall Python dependencies:
pip install -r requirements.txtStart the Flask server:
cd backend
python movie_recommender_api.pyThe backend will start at: http://localhost:5000
Open a new terminal, then:
cd frontend
npm install
npm run devThe frontend will start at: http://localhost:5173
- Open your browser and go to http://localhost:5173
- Type a movie title in the search bar and press Get Recommendations
- The system returns 5 similar movies with posters fetched from TMDB
- Click the info button on any movie card to see overview, cast, trailer, and similar movies
| Method | Endpoint | Description |
|---|---|---|
POST |
/recommend |
Returns 5 recommended movies + poster URLs for a given movie_title |
GET |
/api/movie/<id> |
Returns full movie details (overview, cast, genres, trailer, similar movies) from TMDB |
Example request to /recommend:
POST http://localhost:5000/recommend
Content-Type: application/json
{ "movie_title": "The Dark Knight" }- Port conflicts: Make sure ports
5000(Flask) and5173(Vite) are free - Movie not found: The movie title must exactly match a title in
processed_movies.csv - Missing packages: Re-run
pip install -r requirements.txt(backend) ornpm install(frontend) - Python version: Python 3.8 or higher is required
- The Flask backend runs in debug mode by default (
app.run(debug=True)) - The Vite dev server supports hot module replacement
- Use
Ctrl+Cto stop either server
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Open a Pull Request
MIT License
Copyright (c) 2025 Adnan
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
This is a development setup. For production deployment, additional configuration and security measures are required (e.g., move the TMDB API key to an environment variable, disable Flask debug mode, add HTTPS).