How raghavs16/movie_recommendation_system works
Purpose and Runtime Topology
FilmoBot is a React single-page movie chatbot backed by a Flask API. It converts conversational movie requests into structured search intents, retrieves and enriches movie data, and supports authenticated persistence for chats, profiles, and watchlists. The browser runs from client/src/index.js; Flask is started through server/app.py.
Frontend Application Shell
client/src/App.jsx owns React Router routing and application-level state across the chat and account-oriented screens. The primary user journey begins in client/src/ChatPage.jsx; onboarding and authentication are handled by client/src/Splash.jsx, client/src/Welcome.jsx, client/src/Login.jsx, and client/src/Signup.jsx. API targeting is centralized in client/src/config.js.
Chat and Recommendation Presentation
client/src/ChatPage.jsx sends user prompts to the backend, renders conversational results, and participates in chat-history behavior. client/src/MovieCard.jsx is the reusable movie-result boundary: it presents returned metadata and exposes trailer and watchlist actions. client/src/Sidebar.jsx provides navigation and access to persisted chat sessions.
User State and Persistence UX
The client stores JWT authentication and configurable preferences locally; settings include language, result count, notification choices, and chat-history behavior. client/src/SettingsPage.jsx owns this preference surface, while client/src/WatchlistPage.jsx and client/src/ProfilePage.jsx consume backend-backed user data. The backend SQLite database is represented by server/filmobot.db; API and database routes/models reside in server/app.py.
Backend API and Account Boundary
server/app.py is the Flask composition point: it exposes the API, performs JWT-based authentication, handles account/profile/watchlist/history operations, manages password-reset OTP email flow, and accepts profile image uploads. Uploaded images cross into server-local storage at server/static/uploads/. Authentication uses Flask-JWT-Extended, passwords use Flask-Bcrypt, and reset email uses Flask-Mail with Gmail SMTP.
AI Intent-to-Search Pipeline
Movie-query handling enters server/app.py and delegates intent extraction to server/ai_processor.py. That module calls Groq’s LLaMA 3.1 8B API for structured intent and supplies a rule-based fallback when the LLM is unavailable. The resulting intent selects discover, direct search, similar-movie, person-filmography, or song-to-movie paths; fuzzy and phonetic recovery for misspelled titles/names is implemented in server/movie_search.py.
External Movie Data Integration
server/tmdb_client.py is the main TMDB boundary for discovery, search, recommendations, language/genre/mood mapping, trailers, and streaming-oriented metadata. server/tmdb_retry.py wraps TMDB access with retry behavior. Backend responses are enriched with OMDb data such as IMDb ratings and cast, then ranked before returning to the client. Required external services are Groq, TMDB, OMDb, Gmail SMTP, and client-side EmailJS for client/src/ContactPage.jsx.
Main entry points: app.py Flask API · App.jsx App shell & routes · ai_processor.py Intent extraction · tmdb_client.py TMDB integration
Components 21
React client
- Browser entry
client/src/index.js - App shell & routes · Owns application-level state and screen routing.
client/src/App.jsx - Chat experience · Sends prompts and renders conversational results.
client/src/ChatPage.jsx - Movie results · Provides trailer and watchlist actions.
client/src/MovieCard.jsx - Chat navigation · Provides access to persisted chat sessions.
client/src/Sidebar.jsx - Account & onboarding · Splash, welcome, login, and signup flows.
client/src/Login.jsx - Profile, settings & watchlist · Manages preferences and displays user-backed data.
client/src/SettingsPage.jsx - API configuration
client/src/config.js - Contact form
client/src/ContactPage.jsx
Flask backend
- Flask API · Handles JWT accounts, profiles, watchlists, history, OTP reset, and uploads.
server/app.py - Intent extraction · Uses LLM intent parsing with a rule-based fallback.
server/ai_processor.py - Query recovery · Recovers misspelled movie titles and names.
server/movie_search.py - TMDB integration · Handles discovery, search, recommendations, trailers, and metadata.
server/tmdb_client.py - TMDB retry wrapper
server/tmdb_retry.py - Application database · Stores account, chat, profile, and watchlist data.
server/filmobot.db - Profile uploads
External services
- Groq LLaMA API
- TMDB API
- OMDb API · Supplies IMDb ratings and cast enrichment.
- Gmail SMTP · Delivers password-reset OTP email.
- EmailJS
Connections 23
- Browser entry → App shell & routes: mounts
- App shell & routes → Chat experience: routes to
- App shell & routes → Account & onboarding: routes to
- App shell & routes → Profile, settings & watchlist: routes to
- Chat experience → Movie results: renders
- Chat navigation → Flask API: loads chat history
- Chat experience → Flask API: submits prompts
- Movie results → Flask API: watchlist actions
- Account & onboarding → Flask API: auth requests
- Profile, settings & watchlist → Flask API: user data & preferences
- API configuration → Flask API: API target
- Contact form → EmailJS: sends contact email
- Flask API → Intent extraction: movie query intent
- Intent extraction → Groq LLaMA API: structured intent
- Intent extraction → Query recovery: recovery path
- Intent extraction → TMDB integration: selects search path
- Query recovery → TMDB integration: resolved query
- TMDB integration → TMDB retry wrapper: uses
- TMDB retry wrapper → TMDB API: retried requests
- TMDB integration → OMDb API: enriches results
- Flask API → Application database: persists user data
- Flask API → Profile uploads: stores images
- Flask API → Gmail SMTP: sends reset OTP