How yashu1113/bingwatch works
Project type and purpose
• This is a single-page web application (SPA) built with React + TypeScript, Vite, and Tailwind CSS.
• It provides a movie/TV show discovery UI: genres, trending, search, details, and a locally stored watchlist.
• It integrates with the external TMDB REST API.
File structure
• src/pages: top-level “views” served by your router (Index, GenrePage, MovieDetails, TVShowDetails, etc.).
• src/components: reusable UI and layout pieces (HeroSlider, MediaCard, Carousels, UI primitives).
• src/contexts & src/hooks: global state via React Context (WatchlistContext) and custom hooks for debounce, local-storage, network quality, etc.
• src/services/tmdb.ts: network layer encapsulating calls to the TMDB API.
• static config & build files: Vite, Tailwind, PostCSS, Vercel redirects.
README (empty here)
• No explicit architectural notes; we derive architecture from code structure.
Main components & interactions
a. Browser (User Agent)
b. React SPA
• Router → pages (src/pages)
• Components → presentational & layout (src/components)
• UI primitives (src/components/ui)
c. State Management
• WatchlistContext (persisted via use-local-storage hook)
• Other hooks (use-network-quality, use-debounce)
d. Network Layer
• tmdb service (src/services/tmdb.ts)
e. Data Persistence
• localStorage (via use-local-storage hook)
f. External Service
• TMDB REST API
g. Build & Deployment
• Vite (vite.config.ts)
• Tailwind (tailwind.config.ts)
• Vercel (vercel.json, public/_redirects)
Relationships:
• Pages and components call custom hooks or directly invoke tmdb service.
• tmdb service does HTTP requests, returns JSON to components.
• WatchlistContext wraps application, exposing get/set in localStorage.
• State flows downward via props/context; user actions trigger hooks and service calls.
Architectural patterns & principles
• Component-based UI
• Container (page) vs. Presentational (component) separation
• Single Context for global state (watchlist)
• Custom hooks for cross-cutting concerns
• Service layer isolating network calls
Detailing labels & flows
• UI Components: src/components, src/pages
• Service: src/services/tmdb.ts
• Context: src/contexts/WatchlistContext.tsx
• Hooks: src/hooks/use-*.ts(x)