# venu1011/cinevault architecture

> Architecture diagram of the GitHub repository venu1011/cinevault, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/venu1011/cinevault
- Repository: https://github.com/venu1011/cinevault

## Overview

1. **What this repo is**
   CineVault is a client-side React SPA for movie discovery and personal collection tracking. There is no custom backend in the repository; the app talks directly to external movie services and persists user-specific data in browser storage.

2. **Application shell**
   `src/main.jsx` boots the app, `src/App.jsx` defines the top-level layout and routing, and `index.html` is the Vite entry document. Global styling lives in `src/index.css` and the visual system is driven by Tailwind config.

3. **Route-level architecture**
   The main navigable screens are in `src/pages`:
   - `Home.jsx` for discovery and featured content
   - `SearchResults.jsx` for filtered/search-driven browsing
   - `MovieDetails.jsx` for the full movie view
   - `Watchlist.jsx` for the user’s saved collection  
   These pages are the primary boundaries for data loading and UI state.

4. **Reusable UI layer**
   `src/components` contains the shared presentational and interaction pieces used across pages:
   - navigation and layout: `Navbar`, `Footer`, `HeroSection`
   - browsing controls: `FilterPanel`, `Pagination`, `MovieCard`
   - feedback states: `LoadingSkeleton`, `EmptyState`, `ErrorBoundary`
   - transitions and overlays: `PageTransition`, `TrailerModal`, `BackToTop`  
   This layer keeps page components focused on orchestration rather than markup.

5. **State management boundary**
   The app uses Zustand stores in `src/store`:
   - `themeStore.js` controls dark/light theme and persistence
   - `watchlistStore.js` owns the user’s saved movies, watched status, ratings, and related collection state  
   These stores are the main client-side source of truth for user preferences and collection data.

6. **Data access and external API boundary**
   Movie data is fetched through utilities in `src/utils`:
   - `api.js` centralizes TMDb API configuration
   - `api-tmdb-proxy.js` wraps TMDb requests through a proxy to avoid CORS issues
   - `helpers.js` likely contains normalization/formatting helpers used by UI and data transforms  
   The external dependency is The Movie Database (TMDb) API, which provides movie metadata, images, trailers, genres, and watch-provider data.

7. **Recommendation flow**
   `src/utils/recommendations.js` implements the app’s “AI-powered” recommendation behavior. In practice, this is a client-side recommendation engine that uses the watchlist and ratings to infer genre and preference patterns, then returns suggested movies for the Home page “For You” section.

8. **Core user flows**
   The major runtime flows are:
   - search input in `Navbar` or `HeroSection` → TMDb search/autocomplete → `SearchResults`
   - selecting a movie card → `MovieDetails` → fetch details, cast, trailers, providers
   - adding/removing items from watchlist → Zustand store → persistent localStorage
   - changing theme → theme store → persisted preference
   - viewing recommendations → watchlist store + recommendation utility → Home page suggestions

9. **Movie detail boundary**
   `MovieDetails.jsx` is the densest integration point. It aggregates multiple TMDb data types into one view: movie metadata, cast/crew, ratings, runtime, trailer playback via `TrailerModal`, and streaming/provider links. This page is the main hub where external movie data is combined with local watchlist actions.

10. **Persistence model**
   User-specific state is browser-local, not server-side. The repo emphasizes persistence through localStorage via Zustand, so watchlist and theme survive refreshes and sessions. The app also uses browser-based UX state like modals, skeletons, and navigation transitions rather than backend session state.

11. **UX and resilience layers**
   Several components act as cross-cutting infrastructure:
   - `ErrorBoundary` prevents the entire SPA from crashing on render errors
   - `LoadingSkeleton` and `EmptyState` define async and no-data states
   - `PageTransition` and Framer Motion provide animated navigation
   - `react-hot-toast` is used for non-blocking feedback
   - `BackToTop` and keyboard shortcuts improve navigation ergonomics

12. **Build and deployment shape**
   This is a Vite-built static frontend with Tailwind CSS and React 18. Deployment files (`netlify.toml`, `vercel.json`, `public/_redirects`) show SPA rewrite handling for client-side routing on static hosts. `public/manifest.json` indicates PWA support, but there is still no backend service in-repo.

13. **Where architecture boundaries matter**
   For a diagram, the important separations are:
   - UI shell and routing
   - page-level orchestration
   - reusable component layer
   - Zustand client state
   - TMDb/proxy data access
   - browser persistence
   - deployment/static hosting rewrites  
   The system is essentially a layered frontend that composes external movie data with local user collection state.

Main entry points: [`src/pages/SearchResults.jsx`](https://github.com/venu1011/cinevault/blob/main/src/pages/SearchResults.jsx) (Search), [`src/App.jsx`](https://github.com/venu1011/cinevault/blob/main/src/App.jsx) (App shell), [`src/pages/Home.jsx`](https://github.com/venu1011/cinevault/blob/main/src/pages/Home.jsx) (Home), [`src/pages/MovieDetails.jsx`](https://github.com/venu1011/cinevault/blob/main/src/pages/MovieDetails.jsx) (Details)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_shell["App shell"]
  node_node_main(("Entry<br/>Vite boot<br/>[main.jsx]"))
  node_node_app["App shell<br/>Layout/router<br/>[App.jsx]"]
end

subgraph group_group_pages["Pages"]
  node_node_home["Home<br/>Discovery page<br/>[Home.jsx]"]
  node_node_search["Search<br/>Results page<br/>[SearchResults.jsx]"]
  node_node_details["Details<br/>Movie page<br/>[MovieDetails.jsx]"]
  node_node_watchlist["Watchlist<br/>Collection page<br/>[Watchlist.jsx]"]
end

subgraph group_group_ui["Shared UI"]
  node_node_nav["Navbar<br/>Navigation UI<br/>[Navbar.jsx]"]
  node_node_hero["Hero<br/>Landing UI<br/>[HeroSection.jsx]"]
  node_node_cards["Movie card<br/>Browse UI<br/>[MovieCard.jsx]"]
  node_node_filters["Filters<br/>Browse controls<br/>[FilterPanel.jsx]"]
  node_node_modal["Trailer modal<br/>Overlay<br/>[TrailerModal.jsx]"]
  node_node_feedback["UX states<br/>Feedback layer"]
end

subgraph group_group_state["Client state"]
  node_node_theme[("Theme store<br/>Zustand store<br/>[themeStore.js]")]
  node_node_watchstore[("Watchlist store<br/>Zustand store<br/>[watchlistStore.js]")]
end

subgraph group_group_data["Data layer"]
  node_node_api["TMDb API<br/>Data config<br/>[api.js]"]
  node_node_proxy["Proxy client<br/>API adapter<br/>[api-tmdb-proxy.js]"]
  node_node_reco["Recommendations<br/>Client engine<br/>[recommendations.js]"]
end

subgraph group_group_deploy["Static deploy"]
  node_node_deploy["SPA hosting<br/>Deploy config<br/>[netlify.toml]"]
end

node_node_main -->|"boots"| node_node_app
node_node_app -->|"routes to"| node_node_home
node_node_app -->|"routes to"| node_node_search
node_node_app -->|"routes to"| node_node_details
node_node_app -->|"routes to"| node_node_watchlist
node_node_home -->|"uses"| node_node_hero
node_node_home -->|"uses"| node_node_cards
node_node_search -->|"uses"| node_node_filters
node_node_search -->|"uses"| node_node_cards
node_node_details -->|"uses"| node_node_modal
node_node_details -->|"reads/writes"| node_node_watchstore
node_node_watchlist -->|"reads/writes"| node_node_watchstore
node_node_nav -->|"initiates"| node_node_search
node_node_hero -->|"initiates"| node_node_search
node_node_watchstore -->|"feeds"| node_node_reco
node_node_reco -->|"drives"| node_node_home
node_node_watchstore -->|"persists"| node_node_theme
node_node_api -->|"wrapped by"| node_node_proxy
node_node_proxy -->|"supplies"| node_node_details
node_node_proxy -->|"supplies"| node_node_search
node_node_proxy -->|"supplies"| node_node_home
node_node_feedback -->|"supports"| node_node_home
node_node_feedback -->|"supports"| node_node_search
node_node_feedback -->|"supports"| node_node_details
node_node_deploy -->|"enables"| node_node_app

click node_node_main "https://github.com/venu1011/cinevault/blob/main/src/main.jsx"
click node_node_app "https://github.com/venu1011/cinevault/blob/main/src/App.jsx"
click node_node_home "https://github.com/venu1011/cinevault/blob/main/src/pages/Home.jsx"
click node_node_search "https://github.com/venu1011/cinevault/blob/main/src/pages/SearchResults.jsx"
click node_node_details "https://github.com/venu1011/cinevault/blob/main/src/pages/MovieDetails.jsx"
click node_node_watchlist "https://github.com/venu1011/cinevault/blob/main/src/pages/Watchlist.jsx"
click node_node_nav "https://github.com/venu1011/cinevault/blob/main/src/components/Navbar.jsx"
click node_node_hero "https://github.com/venu1011/cinevault/blob/main/src/components/HeroSection.jsx"
click node_node_cards "https://github.com/venu1011/cinevault/blob/main/src/components/MovieCard.jsx"
click node_node_filters "https://github.com/venu1011/cinevault/blob/main/src/components/FilterPanel.jsx"
click node_node_modal "https://github.com/venu1011/cinevault/blob/main/src/components/TrailerModal.jsx"
click node_node_theme "https://github.com/venu1011/cinevault/blob/main/src/store/themeStore.js"
click node_node_watchstore "https://github.com/venu1011/cinevault/blob/main/src/store/watchlistStore.js"
click node_node_api "https://github.com/venu1011/cinevault/blob/main/src/utils/api.js"
click node_node_proxy "https://github.com/venu1011/cinevault/blob/main/src/utils/api-tmdb-proxy.js"
click node_node_reco "https://github.com/venu1011/cinevault/blob/main/src/utils/recommendations.js"
click node_node_deploy "https://github.com/venu1011/cinevault/blob/main/netlify.toml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_node_main,node_node_app toneBlue
class node_node_home,node_node_search,node_node_details,node_node_watchlist toneAmber
class node_node_nav,node_node_hero,node_node_cards,node_node_filters,node_node_modal,node_node_feedback toneMint
class node_node_theme,node_node_watchstore toneRose
class node_node_api,node_node_proxy,node_node_reco toneIndigo
class node_node_deploy toneTeal
```

## Components

### App shell

Vite entry, top-level layout, and routing boundary.

- [Entry](https://github.com/venu1011/cinevault/blob/main/src/main.jsx): Vite boot · Bootstraps the React app into the browser. · `src/main.jsx`
- [App shell](https://github.com/venu1011/cinevault/blob/main/src/App.jsx): Layout/router · Defines the top-level layout and application routing. · `src/App.jsx`

### Pages

Route-level screens that orchestrate major user flows.

- [Home](https://github.com/venu1011/cinevault/blob/main/src/pages/Home.jsx): Discovery page · Featured content and recommendation landing screen. · `src/pages/Home.jsx`
- [Search](https://github.com/venu1011/cinevault/blob/main/src/pages/SearchResults.jsx): Results page · Filtered browsing and search-driven movie discovery. · `src/pages/SearchResults.jsx`
- [Details](https://github.com/venu1011/cinevault/blob/main/src/pages/MovieDetails.jsx): Movie page · Full movie view with metadata, cast, trailers, and providers. · `src/pages/MovieDetails.jsx`
- [Watchlist](https://github.com/venu1011/cinevault/blob/main/src/pages/Watchlist.jsx): Collection page · User saved movies, watched status, and ratings. · `src/pages/Watchlist.jsx`

### Shared UI

Reusable components and cross-cutting UX infrastructure.

- [Navbar](https://github.com/venu1011/cinevault/blob/main/src/components/Navbar.jsx): Navigation UI · Primary navigation, search entry, and top-level actions. · `src/components/Navbar.jsx`
- [Hero](https://github.com/venu1011/cinevault/blob/main/src/components/HeroSection.jsx): Landing UI · Featured discovery area on the home screen. · `src/components/HeroSection.jsx`
- [Movie card](https://github.com/venu1011/cinevault/blob/main/src/components/MovieCard.jsx): Browse UI · Reusable movie preview tile for lists and grids. · `src/components/MovieCard.jsx`
- [Filters](https://github.com/venu1011/cinevault/blob/main/src/components/FilterPanel.jsx): Browse controls · Filtering controls for search and discovery views. · `src/components/FilterPanel.jsx`
- [Trailer modal](https://github.com/venu1011/cinevault/blob/main/src/components/TrailerModal.jsx): Overlay · Trailer playback overlay used from movie detail flows. · `src/components/TrailerModal.jsx`
- **UX states**: Feedback layer · Loading, empty, error, transition, and scroll-to-top behaviors.

### Client state

Zustand stores and browser-persisted user state.

- [Theme store](https://github.com/venu1011/cinevault/blob/main/src/store/themeStore.js): Zustand store · Persists dark/light theme preference in the browser. · `src/store/themeStore.js`
- [Watchlist store](https://github.com/venu1011/cinevault/blob/main/src/store/watchlistStore.js): Zustand store · Holds saved movies, watched status, ratings, and collection state. · `src/store/watchlistStore.js`

### Data layer

External API access and client-side recommendation logic.

- [TMDb API](https://github.com/venu1011/cinevault/blob/main/src/utils/api.js): Data config · Central TMDb configuration and request setup. · `src/utils/api.js`
- [Proxy client](https://github.com/venu1011/cinevault/blob/main/src/utils/api-tmdb-proxy.js): API adapter · Wraps TMDb requests through a proxy to avoid CORS issues. · `src/utils/api-tmdb-proxy.js`
- [Recommendations](https://github.com/venu1011/cinevault/blob/main/src/utils/recommendations.js): Client engine · Derives suggested movies from watchlist patterns and ratings. · `src/utils/recommendations.js`

### Static deploy

SPA hosting and routing rewrite configuration.

- [SPA hosting](https://github.com/venu1011/cinevault/blob/main/netlify.toml): Deploy config · Static hosting rewrites and deployment settings for client-side routing. · `netlify.toml`

## Connections

- Entry → App shell: boots · Entry point renders the application shell.
- App shell → Home: routes to · Shell dispatches to the home discovery screen.
- App shell → Search: routes to · Shell dispatches to search results.
- App shell → Details: routes to · Shell dispatches to movie detail view.
- App shell → Watchlist: routes to · Shell dispatches to the user collection screen.
- Home → Hero: uses · Home composes the featured landing section.
- Home → Movie card: uses · Home renders movie previews in discovery lists.
- Search → Filters: uses · Search page exposes filtering and browse controls.
- Search → Movie card: uses · Search results are rendered as movie cards.
- Details → Trailer modal: uses · Detail page opens trailers in an overlay.
- Details → Watchlist store: reads/writes · Detail view updates saved movies and ratings.
- Watchlist → Watchlist store: reads/writes · Watchlist page is backed by the collection store.
- Navbar → Search: initiates · Navbar provides the main search entry flow.
- Hero → Search: initiates · Hero content can drive discovery searches.
- Watchlist store → Recommendations: feeds · Collection data powers personalized suggestions.
- Recommendations → Home: drives · Recommendation output populates the home for-you area.
- Watchlist store → Theme store: persists · Stores user preferences alongside collection state.
- TMDb API → Proxy client: wrapped by · Proxy layer is used to reach TMDb endpoints safely.
- Proxy client → Details: supplies · Movie details page consumes external metadata and media.
- Proxy client → Search: supplies · Search page consumes movie browse and query data.
- Proxy client → Home: supplies · Home page consumes featured and discovery data.
- UX states → Home: supports · Async and empty states are shared across screens.
- UX states → Search: supports · Async and empty states are shared across screens.
- UX states → Details: supports · Async and empty states are shared across screens.
- SPA hosting → App shell: enables · Static host rewrites support client-side routing.
