How chiefbibek/movie-recommendation-system works
Project type and purpose
• This is a full-stack web application with a data-science component.
• Frontend: a React/Vite single-page app for collecting user input and displaying movie recommendations.
• Backend: a Node.js/Express API that exposes recommendation endpoints.
• Machine-learning service: Python scripts and pickled models (TF-IDF matrix and model) served by a Flask microservice (movie_api.py).
• No persistent database; the “data layer” consists of precomputed pickles and in-memory data structures.
File structure
• Top-level folders & files:
• “Frontend And Backend/app”: React application (Vite config, package.json, src/Components, Context)
• “Frontend And Backend/server”: Node/Express service (index.js, routes/routes.js, controller/appController.js)
• Root: Python files (movie_api.py, movie_recommender.py), Jupyter notebook, TF-IDF artifacts (.pkl), requirements.txt
• Key patterns:
• Frontend/Backend separation under a monorepo.
• Microservice pattern: Express app and Flask app co-exist.
• Data-science artifacts stored as pickles to decouple model training from inference.
README for additional insights
• The README:
• Emphasizes running a Jupyter notebook to prep data.
• Lists Python and Node/JS prerequisites.
• Instructs starting both the React frontend and the Node backend; although Flask prerequisites are listed, the Node app likely proxies to or invokes the Python microservice.
Main components & interactions
a. Components
1. Client Browser (React SPA)
2. React Frontend (Vite dev server)
3. Node.js/Express Backend
4. Python/Flask Recommendation Service
5. TF-IDF Model & Matrix (Pickle files)
6. Jupyter Notebook (development artifact)
b. Relationships & data flow
• The browser issues HTTP requests to the React dev server (port e.g. 3000).
• React sends REST calls (fetch/Axios) to Node/Express (e.g. GET /api/recommendations).
• Express controller (appController.js) forwards requests (via HTTP) to the Flask service (movie_api.py) or spawns a child‐process to run movie_recommender.py.
• Flask service loads TF-IDF artifacts from disk, constructs recommendations, and returns JSON.
• Express relays JSON to the React client.
• The client updates its GlobalState context and renders results.
c. Architectural patterns & design principles
• Separation of concerns: UI vs API vs ML logic
• Microservices: independent Flask service for ML inference
• Context API in React for state management
• Pickle serialization to decouple training from serving
d. Key technologies & frameworks
• Frontend: React, Vite, Tailwind CSS, Context API
• Backend: Node.js, Express, CORS
• ML Service: Python 3.x, Flask, scikit-learn, pandas, NumPy, pickle
• Dev/test: Jupyter Notebook, ESLint, PostCSS