# sreenidhihayagreevan/movie-recomendation architecture

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

- Interactive diagram: https://gitdiagram.com/sreenidhihayagreevan/movie-recomendation
- Repository: https://github.com/sreenidhihayagreevan/movie-recomendation

## Overview

##### Project type and purpose
- This is a single-page React application (built with Vite and TypeScript) that provides movie listings and personalized recommendations. It lives entirely in the browser, fetching data either from a local CSV or from external HTTP APIs (authentication and movie data).

##### File structure
Top-level directories and files:
- public/ – static assets (videos, media, shell scripts)
- src/ – all application code
- components/ – reusable UI pieces (layout, auth, movies, recommendations)
- pages/ – route-level components (Home, Login, AllMovies, MovieDetail, Recommendations, Admin, NotFound)
- contexts/ – React Context providers (AuthContext)
- services/ – API abstraction layers (authService.ts, movieService.ts)
- data/ – local data source (merged_movie_data.csv)
- utils/ – helpers and validators
- types/ – shared TypeScript definitions
- index.html, App.tsx, main.tsx – application entrypoint
- config files – Vite, ESLint, Tailwind, tsconfig

##### Final advice
- Every “lane” in the data flow: user input, UI rendering, service calls, data retrieval, and error handling (ErrorBoundary).
- Don’t forget static assets served from public/.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client and Hosting
    subgraph "Client & Hosting" 
        direction TB
        Browser["Browser / Client"]:::external
        Host["Vite Dev Server / CDN"]:::infra
    end

    Browser -->|"requests index.html"| Host
    Host -->|"serves bundled App"| AppShell

    %% App Shell
    subgraph "App Shell" 
        direction TB
        AppShell["React App Shell\n(index.html + bundled JS/CSS)"]:::ui
    end

    click AppShell "https://github.com/sreenidhihayagreevan/movie-recomendation/blob/main/index.html"
    click AppShell "https://github.com/sreenidhihayagreevan/movie-recomendation/blob/main/src/main.tsx"
    click AppShell "https://github.com/sreenidhihayagreevan/movie-recomendation/blob/main/src/App.tsx"

    AppShell -->|"mounts <App/>"| Router

    %% Routing & Context
    subgraph "Routing & Auth" 
        direction TB
        Router["React Router"]:::service
        AuthCtx["AuthContext Provider"]:::service
        ProtectedRoute["ProtectedRoute Wrapper"]:::service
    end

    Router --> Pages
    Router --> ProtectedRoute
    AuthCtx --> ProtectedRoute

    click AuthCtx "https://github.com/sreenidhihayagreevan/movie-recomendation/blob/main/src/contexts/AuthContext.tsx"
    click ProtectedRoute "https://github.com/sreenidhihayagreevan/movie-recomendation/blob/main/src/components/auth/ProtectedRoute.tsx"

    %% UI Layer
    subgraph "Pages" 
        direction TB
        Home["Home Page"]:::ui
        Login["Login Page"]:::ui
        AllMovies["All Movies Page"]:::ui
        MovieDetail["Movie Detail Page"]:::ui
        Recommendations["Recommendations Page"]:::ui
        Admin["Admin Page"]:::ui
        NotFound["Not Found Page"]:::ui
    end

    click Home "https://github.com/sreenidhihayagreevan/movie-recomendation/blob/main/src/pages/HomePage.tsx"
    click Login "https://github.com/sreenidhihayagreevan/movie-recomendation/blob/main/src/pages/LoginPage.tsx"
    click AllMovies "https://github.com/sreenidhihayagreevan/movie-recomendation/blob/main/src/pages/AllMoviesPage.tsx"
    click MovieDetail "https://github.com/sreenidhihayagreevan/movie-recomendation/blob/main/src/pages/MovieDetailPage.tsx"
    click Recommendations "https://github.com/sreenidhihayagreevan/movie-recomendation/blob/main/src/pages/RecommendationsPage.tsx"
    click Admin "https://github.com/sreenidhihayagreevan/movie-recomendation/blob/main/src/pages/AdminPage.tsx"
    click NotFound "https://github.com/sreenidhihayagreevan/movie-recomendation/blob/main/src/pages/NotFoundPage.tsx"

    subgraph "Reusable Components" 
        direction TB
        subgraph "Layout Components"
            Navbar["Navbar"]:::ui
            Footer["Footer"]:::ui
        end
        subgraph "Movie Components"
            MovieCard["MovieCard"]:::ui
            MovieCardSkeleton["MovieCardSkeleton"]:::ui
            MovieGrid["MovieGrid"]:::ui
            MovieFilter["MovieFilter"]:::ui
            StarRating["StarRating"]:::ui
        end
        subgraph "Recommendation Components"
            RecommendationCard["RecommendationCard"]:::ui
            MoviePoster["MoviePoster"]:::ui
        end
        ErrorBoundary["ErrorBoundary"]:::ui
    end

    click Navbar "https://github.com/sreenidhihayagreevan/movie-recomendation/blob/main/src/components/layout/Navbar.tsx"
    click Footer "https://github.com/sreenidhihayagreevan/movie-recomendation/blob/main/src/components/layout/Footer.tsx"
    click MovieCard "https://github.com/sreenidhihayagreevan/movie-recomendation/blob/main/src/components/movies/MovieCard.tsx"
    click MovieCardSkeleton "https://github.com/sreenidhihayagreevan/movie-recomendation/blob/main/src/components/movies/MovieCardSkeleton.tsx"
    click MovieGrid "https://github.com/sreenidhihayagreevan/movie-recomendation/blob/main/src/components/movies/MovieGrid.tsx"
    click MovieFilter "https://github.com/sreenidhihayagreevan/movie-recomendation/blob/main/src/components/movies/MovieFilter.tsx"
    click StarRating "https://github.com/sreenidhihayagreevan/movie-recomendation/blob/main/src/components/movies/StarRating.tsx"
    click RecommendationCard "https://github.com/sreenidhihayagreevan/movie-recomendation/blob/main/src/components/recommendations/RecommendationCard.tsx"
    click MoviePoster "https://github.com/sreenidhihayagreevan/movie-recomendation/blob/main/src/components/recommendations/MoviePoster.tsx"
    click ErrorBoundary "https://github.com/sreenidhihayagreevan/movie-recomendation/blob/main/src/components/ErrorBoundary.tsx"

    Pages -->|"renders components"| Navbar
    Pages --> MovieComponents
    Pages --> RecommendationComponents
    Pages --> Footer
    Pages --> ErrorBoundary

    %% Service Layer
    subgraph "Service Layer & Utils" 
        direction TB
        AuthService["authService"]:::service
        MovieService["movieService"]:::service
        Helpers["helpers"]:::service
        Validators["validateMovies"]:::service
        Types["movie.ts Types"]:::data
    end

    click AuthService "https://github.com/sreenidhihayagreevan/movie-recomendation/blob/main/src/services/authService.ts"
    click MovieService "https://github.com/sreenidhihayagreevan/movie-recomendation/blob/main/src/services/movieService.ts"
    click Helpers "https://github.com/sreenidhihayagreevan/movie-recomendation/blob/main/src/utils/helpers.ts"
    click Validators "https://github.com/sreenidhihayagreevan/movie-recomendation/blob/main/src/utils/validateMovies.ts"
    click Types "https://github.com/sreenidhihayagreevan/movie-recomendation/blob/main/src/types/movie.ts"

    ProtectedRoute --> AuthService
    AuthService --> ExternalAuthAPI

    MovieComponents --> MovieService
    RecommendationComponents --> MovieService
    MovieService --> ExternalMovieAPI
    MovieService --> LocalCSV

    %% Data Sources
    subgraph "Data Sources & Assets"
        direction TB
        LocalCSV["merged_movie_data.csv"]:::data
        PublicAssets["public/media/\npublic/videos/"]:::infra
    end

    click LocalCSV "https://github.com/sreenidhihayagreevan/movie-recomendation/blob/main/src/data/merged_movie_data.csv"

    %% External APIs
    subgraph "External Systems"
        direction TB
        ExternalAuthAPI["Auth API"]:::external
        ExternalMovieAPI["Movie Database API"]:::external
    end

    %% Connections
    AuthService -->|"HTTP token calls"| ExternalAuthAPI
    MovieService -->|"HTTP movie calls"| ExternalMovieAPI
    MovieService -->|"import & parse"| LocalCSV

    %% Legend
    subgraph "Legend"
        direction LR
        U["UI Layers"]:::ui
        S["Services & Context"]:::service
        I["Infrastructure"]:::infra
        E["External Systems"]:::external
        D["Data & Types"]:::data
    end

    classDef ui fill:#D0E8FF,stroke:#005B9F,color:#005B9F
    classDef service fill:#E2F7D4,stroke:#237D28,color:#237D28
    classDef infra fill:#F0F0F0,stroke:#666666,color:#333333
    classDef external fill:#FFE4C4,stroke:#D2691E,color:#D2691E
    classDef data fill:#FDEBD0,stroke:#BA5F00,color:#BA5F00
```
