This project is a web application designed to help users discover movies and TV shows they might like. Users can vote on pairs of content items, and the application provides personalized recommendations based on their voting history and interactions. The platform uses the OMDB API to fetch detailed information about movies and TV series.
The application consists of two main parts:
- Backend: A Python-based FastAPI application that handles business logic, user authentication, database interactions (MongoDB), and communication with the OMDB API. It also includes a recommendation engine to generate personalized suggestions.
- Frontend: A React-based single-page application (SPA) that provides the user interface for browsing content, voting, viewing recommendations, and managing user profiles.
Follow these instructions to set up and run the project locally.
- Node.js and npm (or Yarn) for the frontend.
- Python 3.11 for the backend.
- MongoDB instance (local or cloud-hosted).
- An OMDB API Key (get one from omdbapi.com).
-
Navigate to the backend directory:
cd backend -
Create a virtual environment (recommended):
python -m venv venv source venv/bin/activate # On Windows: venv\\Scripts\\activate
-
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables: Ensure a
.envfile exists in thebackenddirectory. Ifbackend/.envis already present in your repository checkout, review its contents and update them with your specific configurations, especially theOMDB_API_KEYandJWT_SECRET_KEY. If you need to create it, here are the variables it should contain:MONGO_URL="mongodb://localhost:27017" DB_NAME="movie_preferences_db" OMDB_API_KEY="YOUR_OMDB_API_KEY" # Replace with your actual key JWT_SECRET_KEY="your-super-secret-jwt-key-change-in-production" # Replace with a strong, unique secret JWT_ALGORITHM="HS256" JWT_EXPIRATION_HOURS=72
Important: Replace placeholder values for
OMDB_API_KEYandJWT_SECRET_KEYwith your actual credentials and a secure secret. -
Run the backend server: The backend uses Uvicorn to run. From the
backenddirectory:uvicorn server:app --reload --port 8000
The backend API will be accessible at
http://localhost:8000.
-
Navigate to the frontend directory:
cd frontend -
Install dependencies: Using npm:
npm install
Or using Yarn:
yarn install
-
Set up environment variables: Ensure a
.envfile exists in thefrontenddirectory. Iffrontend/.envis present from your repository checkout, review its contents. If you need to create it, add the following environment variable, pointing to your running backend API:REACT_APP_BACKEND_URL=http://localhost:8000
Note: If your backend is running on a different port, update this URL accordingly.
-
Run the frontend development server: Using npm:
npm start
Or using Yarn:
yarn start
The frontend application will typically open automatically in your browser at
http://localhost:3000.
backend/: Contains the FastAPI application.server.py: The main application file with API endpoints.recommendation_engine.py: Houses the logic for generating content recommendations.requirements.txt: Python dependencies..env: Environment variables for the backend. (Ensure this contains your local configuration)
frontend/: Contains the React application (bootstrapped with Create React App).src/: Main source code for the React components and application logic.App.js: The main application component.index.js: The entry point for the React application.
public/: Static assets.package.json: Frontend dependencies and scripts..env: Environment variables for the frontend. (Ensure this contains your local configuration)
README.md: This file.
Contributions are welcome! Please feel free to submit a pull request or open an issue.
This project is licensed under the terms of the MIT license.