How karlhadwen/netflix works
Project type and purpose
• This is a full‑stack style single‑page application (SPA) that clones Netflix’s core UI/UX.
• The front‑end is built in React using Custom Hooks and the Context API; styling is via styled‑components.
• The back‑end services are serverless Firebase (Authentication + Firestore).
File structure
Top‑level directories and files:
• public/ – static assets (index.html, images, videos) served to the browser
• src/ – application source
• components/ – dumb (presentational) UI pieces (accordion, card, footer, etc.)
• containers/ – “smart” wrapper components connecting to hooks/context
• pages/ – route targets (signin, signup, browse, home)
• context/firebase.js – React context provider for Firebase services
• hooks/ – custom hooks (useAuthListener.js, useContent.js)
• lib/firebase.prod.js – Firebase SDK configuration for production
• utils/ – pure functions (selection‑filter, routes helper)
• seed.js – script to bootstrap Firestore with fixtures (faqs.json, jumbo.json)
• Configuration & tooling: .env, ESLint, Prettier, package.json
Extract additional insights from README
• Core functionality: sign‑in/sign‑up flows with protected routes, content browsing and rendering driven by Firestore data via custom hooks.
• Architectural patterns: Compound UI components, Context for global state, Hooks for side‑effects/data fetching, Styled‑Components for CSS‑in‑JS.
Main components & their interactions
a. User’s Browser (React SPA)
b. Static Hosting/CDN (serves public/index.html + JS & CSS bundles)
c. React Application Layers
• Presentation Layer: components/ + styled‑components
• Container Layer: containers/ orchestrating props + hooks
• Hook/Context Layer:
• useAuthListener (subscribes to Firebase Auth state)
• useContent (fetches Firestore collections)
• FirebaseContext (provides auth + db references across the tree)
d. Firebase Services
• Authentication Service (Auth)
• NoSQL Database (Firestore)
• Optional: Firebase Hosting (if used in deployment)
e. Seed & Fixtures – one‑time data loader that writes JSON to Firestore
Architectural patterns & design principles
• Single Page Application (SPA) architecture
• Compound Components pattern for rich, flexible UI pieces
• Context + Custom Hooks to decouple data fetching & global state from presentation
• Serverless backend (Firebase) removing need for own API servers