How iriamraj/movie-hub works
1. Project shape
- This is a Vite + React single-page application focused on browsing movie metadata.
- The app is organized around page-level screens and shared UI/state layers, which is a good fit for an architecture diagram with clear presentation, state, and data boundaries.
2. Primary user flows
- The core flow is: land on Home → browse featured movies → search/filter/explore more → open MovieDetails → optionally mark favorites.
- A separate NotFound page handles invalid navigation.
3. Page boundaries
- src/pages/Home contains the landing experience.
- src/pages/ExploreMovies is the discovery/browse screen.
- src/pages/MovieDetails is the per-movie detail view.
- src/pages/NotFound is the fallback/error surface.
- These page modules are the main top-level architectural boundaries.
4. Global state and shared app context
- The app uses React context for cross-cutting state:
- SearchContext for the current search term
- FilterContext for active movie filters
- FavoriteListContext for the user’s saved/favorited movies
- This indicates a design where search, filters, and favorites are shared across multiple pages/components, rather than kept local to one page.
5. Data access and persistence
- useFetchMovies is the main movie-data hook, likely responsible for loading the movie catalog used across the app.
- useFetchLocalStorage suggests favorites or user-specific state are persisted client-side in localStorage, making favorites survive refreshes without a backend.
- So the architecture has two data sources:
- movie content data via fetching
- user preference data via local storage
6. Home page composition
- The Home screen is built from smaller sections:
- SectionHero for the introductory/banner area
- SectionMovies and MovieContainer for movie listings
- ShowMore for expanding the visible list
- Footer for the page end
- This implies the home page is a composition shell that orchestrates reusable sections rather than containing the full UI inline.
7. Explore/browse experience
- ExploreMovies plus FilterButton indicates a dedicated browsing surface where users can refine the movie set.
- This page likely consumes the shared search/filter contexts and the fetched movie list to present a more query-driven experience than Home.
8. Movie detail view
- MovieDetails is split into MovieDetails.jsx and RatingCard.jsx, suggesting a detail page with a primary information panel plus a ratings/score subcomponent.
- Given the README, this page is where movie attributes such as name, type, duration, box office, and rating are surfaced in a structured way.
9. Shared UI components
- Header, SearchBar, MovieCard, and NotFoundError are reusable components used across pages.
- This shared layer is where the app standardizes navigation, search entry, movie tiles, and error messaging.
10. Favorites UX
- FavoriteOn.jsx and FavoriteOff.jsx in src/assets/icons indicate a toggleable favorite state in the UI.
- Combined with FavoriteListContext, favorites are a first-class user feature, not just a visual decoration.
11. Styling and assets
- src/index.css is the global stylesheet entry, while src/assets/icons holds the icon components used throughout the interface.
- public/robots.txt and index.html are standard Vite/public assets and do not appear to drive business logic.
12. Likely architecture diagram boundaries
- A useful diagram would show:
- App shell / routing layer
- Page layer: Home, ExploreMovies, MovieDetails, NotFound
- Shared component layer: Header, SearchBar, MovieCard, etc.
- Context/state layer: search, filter, favorites
- Data layer: movie fetch hook + localStorage persistence
- The main external boundary is likely the movie data source consumed by useFetchMovies, while favorites stay entirely in the browser.
Main entry points: App.jsx App · Home.jsx Home · ExploreMovies.jsx Explore · useFetchMovies.jsx Fetch Movies
Components 22
App shell
Top-level composition and routing entrypoints.
Pages
Route-level screens and their internal composition.
- Home · Landing page that introduces and showcases movies.
src/pages/Home/Home.jsx - Explore · Browse and filter the movie catalog.
src/pages/ExploreMovies/ExploreMovies.jsx - Details · Per-movie detail view with rating summary.
src/pages/MovieDetails/MovieDetails.jsx - Not Found · Fallback screen for invalid routes.
src/pages/NotFound/NotFound.jsx - Hero · Intro/banner area on the home page.
src/pages/Home/components/section/hero/SectionHero.jsx - Movies Section · Home page movie listing composition.
src/pages/Home/components/section/movies/SectionMovies.jsx - Movie Grid · Wraps movie cards and list layout on Home.
src/pages/Home/components/section/movies/MovieContainer.jsx - Show More · Expands the visible movie set on Home.
src/pages/Home/components/section/movies/ShowMore.jsx - Footer · Home page footer area.
src/pages/Home/components/footer/Footer.jsx - Rating Card · Secondary rating and score panel for movie details.
src/pages/MovieDetails/RatingCard.jsx
Shared UI
Reusable components and icons used across screens.
- Header · Reusable top navigation/header.
src/components/header/Header.jsx - Search Bar · Global search entry used across browsing screens.
src/components/common/SearchBar.jsx - Movie Card · Reusable movie summary card.
src/components/common/MovieCard.jsx - Error View · Reusable not-found/error presentation.
src/components/common/NotFoundError.jsx - Filter Button · Filter action used in the explore screen.
src/pages/ExploreMovies/FilterButton.jsx
State
Cross-cutting React context providers for search, filters, and favorites.
- Search Context · Shared search term state.
src/context/SearchContext.js - Filter Context · Shared active-filter state.
src/context/FilterContext.js - Favorites Context · Shared favorite-movie state across the app.
src/context/FavoriteListContext.js
Data
Movie fetching and browser persistence hooks.
- Fetch Movies · Loads the movie catalog for the app.
src/hooks/useFetchMovies.jsx - Local Storage · Persists browser-side user state such as favorites.
src/hooks/useFetchLocalStorage.jsx
Connections 25
- Entry → App: mounts · Bootstraps the root application.
- App → Header: renders · Provides consistent navigation around routes.
- App → Home: routes to · Primary landing route.
- App → Explore: routes to · Discovery and filtering route.
- App → Details: routes to · Single-movie details route.
- App → Not Found: fallback · Handles invalid navigation.
- Home → Hero: composes · Builds the landing hero area.
- Home → Movies Section: composes · Builds the movie showcase section.
- Home → Footer: composes · Adds the page footer.
- Movies Section → Movie Grid: uses · Delegates list layout to the container.
- Movies Section → Show More: uses · Supports incremental reveal of items.
- Movie Grid → Movie Card: renders · Displays movie cards in the listing.
- Explore → Search Bar: uses · Enables text-based discovery.
- Explore → Filter Button: uses · Provides filtering controls.
- Explore → Movie Card: renders · Shows browse results as cards.
- Details → Rating Card: includes · Shows structured rating information.
- Not Found → Error View: renders · Uses the shared error surface.
- Search Bar → Search Context: reads/writes · Updates and consumes the global search term.
- Filter Button → Filter Context: reads/writes · Updates and consumes the active filter state.
- Movie Card → Favorites Context: uses · Reflects and toggles favorite state.
- Favorites Context → Local Storage: persists via · Keeps favorites across refreshes in the browser.
- Home → Fetch Movies: loads · Consumes the shared movie catalog.
- Explore → Fetch Movies: loads · Consumes the shared movie catalog.
- Details → Fetch Movies: loads · Looks up movie data for the selected item.
- Favorites Context → Fetch Movies: enriches · Can relate saved movies to fetched catalog data.