How ashishyadav85270/netflix-gpt works
Project type and purpose
• This is a single‐page application (SPA) built with React (Create React App) and Tailwind CSS.
• It uses Firebase for user authentication and hosting, Redux (via Redux Toolkit slices) for state management, and external APIs (TMDB for movie data and an OpenAI/GPT endpoint for “Netflix GPT” movie suggestions).
• The end goal is a Netflix‐style browsing interface where users log in, browse trailers and movie cards, and use a GPT‐powered search page.
File structure
• Top‐level files:
• package.json / package-lock.json → dependencies & scripts
• firebase.json / .firebaserc → Firebase hosting & config
• tailwind.config.js → Tailwind CSS setup
• public/ → static assets & index.html
• src/
• App.js, index.js, App.css → entry points
• components/ → UI components (Header, Body, Browse, MovieCard, VideoBackground, GptSearchBar, etc.)
• hooks/ → custom React hooks to fetch TMDB data (now playing, trending, etc.)
• utils/ → Redux slices (moviesSlice, userSlice, gptSlice, configSlice), Firebase wrapper (firebase.js), common constants, language files, store setup
README
• Confirms React + Tailwind + Firebase Auth + Redux + Formik
• Describes core features: login/signup → Browse page with trailers, movie lists → GPT‐powered search/suggestions
• Notes use of TMDB API and custom hooks; multi‐language support on GPT search
Main components
a. Client (Browser)
• React SPA runs in user’s browser after being served as static files (via Firebase Hosting).
• UI components (Header, Browse page, GptSearch page)
• State management: Redux store with slices (userSlice, moviesSlice, gptSlice, configSlice)
• Custom hooks connect UI to external APIs.
b. Firebase Hosting & Auth
• Hosts the static React build
• Provides Authentication (onAuthStateChanged)
c. External APIs
• TMDB API → movie data (now playing, trending, top rated, etc.)
• OpenAI/GPT API → dynamic suggestions based on user query
d. (Optional) Cloud Functions / Proxy
Relationships and data flow
1. User → Browser loads index.html from Firebase Hosting
2. React SPA initializes → Redux store bootstraps
3. User attempts SignUp / Login → Firebase Auth SDK call → Firebase Auth service → SDK callback updates userSlice
4. Authenticated user redirected to Browse route → React triggers custom hooks → fetch calls to TMDB API → responses stored in moviesSlice
5. Browse page components read from Redux store → display video background, movie cards, lists
6. On GPT Search page: user enters query → dispatch action in gptSlice → fetch to OpenAI/GPT endpoint → response stored in gptSlice → UI renders suggestions
Architectural patterns & design principles
• Component‐based UI (React)
• Unidirectional data flow (Redux)
• Separation of concerns:
• UI in components/
• Data fetching in hooks/
• State logic in utils/*.slice.js
• Configuration in constants.js & configSlice
• Static hosting + client‐side rendering with third‐party API calls
Elements
• Clear, descriptive labels (component names, file paths, service names)
• A note on hosting: “Firebase Hosting serves the React build from public/”