# sambhavnrana/juststream architecture

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

- Interactive diagram: https://gitdiagram.com/sambhavnrana/juststream
- Repository: https://github.com/sambhavnrana/juststream

## Overview

##### Project type and purpose
- This is a single-page application (SPA) built in React.js.
- Purpose: Allow users to search for movies/TV shows, view details (cast, trailer, ratings), powered by an external movie database API.

##### File structure
- public/ – static assets served at runtime (index.html, manifest, robots.txt)
- src/ – main application code
– Components/ – reusable UI widgets (CardMovies, Carousel, Header, Footer, Pagination, SearchBox, LeftListBar)
– Container/ – page-level components (Home, Movies, TVSeries, Details, About, Contact, Search)
– Hooks/ – custom React hooks (useGenres)
– Route/ – routing setup (React Router)
– Config.js – central configuration (API keys, base URLs)
– App.js, index.js – application entry points
- package.json – dependencies and build scripts

##### README for additional insights
- Technology stack: React.js + Bootstrap UI
- Core feature: search and display movie/TV show data
- Data source: likely an external REST API (e.g., TMDB)

##### Main components
a. Client Browser
– Static assets (index.html, CSS, JS bundles) served from a CDN or static host
b. React Application
– Entry Layer: index.js → App.js
– Router Layer: Route/index.js configures URL → Container mapping
– Container Layer: Page components in Container/ (Home, Movies, Details, etc.)
– Hooks & Services: useGenres hook and Config.js for API calls
c. External Movie Data API
– Hosted service (e.g., TMDB) — endpoints for search, details, genres, images, trailers

##### Relationships and interactions
- On load, Browser requests index.html → serves JS/CSS
- React Router reads URL → mounts appropriate Container
- Containers invoke hooks/services (useGenres, fetch via Config.js) to call External API
- API returns JSON → state updates → props passed down to Components
- Components render UI → user interactions trigger further API calls (pagination, search)

##### Architectural patterns / design principles
- Component-based architecture (separation of Concerns: Containers vs. Presentation Components)
- Unidirectional data flow (React state → props → UI)
- Single Responsibility (each component/hook has a clear role)
- Config-driven API access (all endpoints defined in Config.js)

##### Technologies & frameworks
- React.js with React Router
- Bootstrap (CSS framework)
- Custom hooks for data fetching
- Fetch or Axios (implicit in hooks/config)
- Static hosting / CDN for production

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Infrastructure Layer
    subgraph "Infrastructure" 
        direction TB
        Browser["Client Browser"]:::infra
    end

    %% React Application
    subgraph "React Application"
        direction TB

        subgraph "Entry Layer"
            direction TB
            EntryIndex["src/index.js"]:::infra
            EntryApp["src/App.js"]:::infra
        end

        subgraph "Routing Layer"
            direction TB
            Router["src/Route/index.js"]:::infra
        end

        subgraph "Container Layer" 
            direction TB
            HomePage["Home Page\nsrc/Container/Home/index.js"]:::ui
            MoviesPage["Movies Page\nsrc/Container/Movies/index.js"]:::ui
            TVSeriesPage["TV Series Page\nsrc/Container/TVSeries/index.js"]:::ui
            DetailsPage["Details Page\nsrc/Container/Details/index.js"]:::ui
            SearchPage["Search Page\nsrc/Container/Search/index.js"]:::ui
            AboutPage["About Page\nsrc/Container/About/index.js"]:::ui
            ContactPage["Contact Page\nsrc/Container/Contact/index.js"]:::ui
        end

        subgraph "UI Components" 
            direction TB
            CardMovies["CardMovies\nsrc/Components/CardMovies/index.js"]:::ui
            CarouselComp["Carousel\nsrc/Components/Carousel/index.js"]:::ui
            HeaderComp["Header\nsrc/Components/Header/index.js"]:::ui
            FooterComp["Footer\nsrc/Components/Footer/index.js"]:::ui
            PaginationComp["Pagination\nsrc/Components/Pagination/index.js"]:::ui
            SearchBoxComp["SearchBox\nsrc/Components/SearchBox/index.js"]:::ui
            LeftListBarComp["LeftListBar\nsrc/Components/LeftListBar/index.js"]:::ui
        end

        subgraph "Hooks & Services" 
            direction TB
            UseGenres["useGenres Hook\nsrc/Hooks/useGenres.js"]:::business
            Config["API Config\nsrc/Config.js"]:::business
        end

        subgraph "Assets & Styles"
            direction TB
            Images["Images\nsrc/Assets/images"]:::infra
            GlobalCSS["Global CSS\nsrc/index.css\nsrc/App.css"]:::infra
            DetailsCSS["Details Styles\nsrc/Container/Details/details.css\nsrc/Container/Details/style.css"]:::infra
            CarouselCSS["Carousel Styles\nsrc/Components/Carousel/style.css"]:::infra
            FooterCSS["Footer Styles\nsrc/Components/Footer/style.css"]:::infra
            PaginationCSS["Pagination Styles\nsrc/Components/Pagination/style.css"]:::infra
            SearchBoxCSS["SearchBox Styles\nsrc/Components/SearchBox/style.css"]:::infra
            LeftListBarCSS["LeftListBar Styles\nsrc/Components/LeftListBar/style.css"]:::infra
        end

        subgraph "Tests & Utilities"
            direction TB
            AppTest["App Tests\nsrc/App.test.js"]:::infra
            ReportWebVitals["reportWebVitals\nsrc/reportWebVitals.js"]:::infra
            SetupTests["setupTests\nsrc/setupTests.js"]:::infra
        end
    end

    %% External Service
    ExternalAPI["External Movie Data API"]:::infra

    %% Connections
    Browser -->|"GET index.html, JS, CSS"| EntryIndex
    EntryIndex -->|"renders"| EntryApp
    EntryApp -->|"initializes Router"| Router
    Router -->|"routes to"| HomePage
    Router -->|"routes to"| MoviesPage
    Router -->|"routes to"| TVSeriesPage
    Router -->|"routes to"| DetailsPage
    Router -->|"routes to"| SearchPage
    Router -->|"routes to"| AboutPage
    Router -->|"routes to"| ContactPage

    HomePage -->|"uses UI components"| CardMovies
    HomePage -->|"uses UI components"| PaginationComp
    MoviesPage -->|"uses Hook & Config"| UseGenres
    MoviesPage -->|"uses UI components"| CardMovies
    TVSeriesPage -->|"uses Hook & Config"| UseGenres
    TVSeriesPage -->|"uses UI components"| CardMovies
    DetailsPage -->|"uses Hook & Config"| Config
    DetailsPage -->|"renders components"| CarouselComp
    DetailsPage -->|"renders components"| HeaderComp
    DetailsPage -->|"renders components"| FooterComp

    SearchPage -->|"uses Hook & Config"| Config
    SearchPage -->|"renders components"| SearchBoxComp
    SearchPage -->|"renders components"| CardMovies

    UseGenres -->|"GET /genre/list"| ExternalAPI
    Config -->|"GET /search, /movie/{id}, etc."| ExternalAPI
    ExternalAPI -->|"JSON responses"| UseGenres
    ExternalAPI -->|"JSON responses"| Config

    %% Click Events
    click Browser "https://github.com/sambhavnrana/juststream/blob/main/public/index.html"
    click EntryIndex "https://github.com/sambhavnrana/juststream/blob/main/src/index.js"
    click EntryApp "https://github.com/sambhavnrana/juststream/blob/main/src/App.js"
    click Router "https://github.com/sambhavnrana/juststream/blob/main/src/Route/index.js"
    click HomePage "https://github.com/sambhavnrana/juststream/blob/main/src/Container/Home/index.js"
    click MoviesPage "https://github.com/sambhavnrana/juststream/blob/main/src/Container/Movies/index.js"
    click TVSeriesPage "https://github.com/sambhavnrana/juststream/blob/main/src/Container/TVSeries/index.js"
    click DetailsPage "https://github.com/sambhavnrana/juststream/blob/main/src/Container/Details/index.js"
    click SearchPage "https://github.com/sambhavnrana/juststream/blob/main/src/Container/Search/index.js"
    click AboutPage "https://github.com/sambhavnrana/juststream/blob/main/src/Container/About/index.js"
    click ContactPage "https://github.com/sambhavnrana/juststream/blob/main/src/Container/Contact/index.js"
    click CardMovies "https://github.com/sambhavnrana/juststream/blob/main/src/Components/CardMovies/index.js"
    click CarouselComp "https://github.com/sambhavnrana/juststream/blob/main/src/Components/Carousel/index.js"
    click HeaderComp "https://github.com/sambhavnrana/juststream/blob/main/src/Components/Header/index.js"
    click FooterComp "https://github.com/sambhavnrana/juststream/blob/main/src/Components/Footer/index.js"
    click PaginationComp "https://github.com/sambhavnrana/juststream/blob/main/src/Components/Pagination/index.js"
    click SearchBoxComp "https://github.com/sambhavnrana/juststream/blob/main/src/Components/SearchBox/index.js"
    click LeftListBarComp "https://github.com/sambhavnrana/juststream/blob/main/src/Components/LeftListBar/index.js"
    click UseGenres "https://github.com/sambhavnrana/juststream/blob/main/src/Hooks/useGenres.js"
    click Config "https://github.com/sambhavnrana/juststream/blob/main/src/Config.js"

    %% Styles Classes
    classDef infra fill:#dddddd,stroke:#888,stroke-width:1px
    classDef ui fill:#cce5ff,stroke:#339,stroke-width:1px
    classDef business fill:#d4edda,stroke:#27632a,stroke-width:1px

    %% Legend
    subgraph Legend
        direction TB
        A["Infrastructure (Gray)"]:::infra
        B["UI Layers (Blue)"]:::ui
        C["Business Logic (Green)"]:::business
    end
```
