# devwithsmile/cillyscreen architecture

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

- Interactive diagram: https://gitdiagram.com/devwithsmile/cillyscreen
- Repository: https://github.com/devwithsmile/cillyscreen

## Overview

##### Project Type and Purpose
- Type: Front-end Single-Page Application (SPA)
- Purpose: Browse and search movies (now playing, popular, top-rated, upcoming) with trailer previews and dark mode.

##### Main Components
a. User & Browser
– End user interacts via a web browser.
b. Static Host / CDN
– Vercel (serves the built SPA assets).
c. Build Tooling
– Vite (bundles JS/CSS at build time).
– Tailwind CSS / PostCSS (utility CSS).
d. Application Shell
– index.html → main.jsx → App.jsx
e. UI Components
– Navbar (large/small breakpoints, search)
– Category Views: NowPlaying, Popular, TopRated, Upcoming
– Card & SkeletonCard (movie tile)
– Modal (trailer player)
– Logo
f. State Management
– Redux store (store.js)
– DarkMode slice (darkModeSlice.js)
g. Data Layer (Custom Hooks)
– useFetchMovies.js (fetch lists by category/search)
– useFetchTrailer.js (fetch trailer video)
h. External Service
– TMDB REST API (provides JSON data for movies & trailers)

##### Relationships and Data Flows
1. User clicks UI (e.g., “Popular” tab or search input).
2. UI Component dispatches Redux action or calls a custom hook.
3. Custom hook issues HTTP request to TMDB API.
4. API returns JSON, hook stores results in component state or dispatches Redux update.
5. Component re-renders with new movie list or trailer modal.
6. User toggles Dark Mode → dispatch Redux action → update global theme state → UI re-themes.

##### Architectural Patterns & Design Principles
- Component-based UI (React)
- Hook-based data fetching (separation of concerns)
- Single global store for cross-cutting concerns (dark mode)
- CSS-in-JS strategy via utility classes (Tailwind)
- Static hosting and client-side routing (SPA)

##### Final Checklist
– All front-end layers (UI, data, state, build, host) are represented.
– Grouping of components (e.g., Components/, hooks/, redux/) matches file structure.
– Technology labels (React, Tailwind CSS, Redux, TMDB API, Vite, Vercel).
– Emphasize separation of concerns and core functionality: browsing categories, search, dark mode, trailers.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User and Browser
    User["User"]:::external
    Browser["Browser"]:::external

    User -->|"interacts with"| Browser

    %% Application Shell
    subgraph "Application Shell"
        direction TB
        Index["index.html"]:::shell
        Main["main.jsx"]:::shell
        App["App.jsx"]:::shell
    end

    Browser -->|loads| Index -->|boots| Main -->|renders| App

    %% React Components
    subgraph "UI Components" 
        direction TB
        subgraph "Navbar (Large Screen)"
            LNav["Navbar"]:::component
            AllNavLinks["AllNavLinks"]:::component
            SearchBox["SearchBox"]:::component
        end
        subgraph "Navbar (Small Screen)"
            LNavS["NavbarSmall"]:::component
            AllNavLinksS["AllNavLinksSmall"]:::component
            SearchBoxS["SearchBoxSmall"]:::component
        end
        subgraph "Category Views"
            NowPlaying["NowPlaying"]:::component
            Popular["Popular"]:::component
            TopRated["TopRated"]:::component
            Upcoming["Upcoming"]:::component
        end
        Card["Card"]:::component
        SkeletonCard["SkeletonCard"]:::component
        Modal["Modal"]:::component
        Logo["Logo"]:::component
    end

    App -->|"renders"| LNav
    App --> LNavS
    App --> Popular
    App --> NowPlaying
    App --> TopRated
    App --> Upcoming
    App --> Card
    App --> SkeletonCard
    App --> Modal
    App --> Logo

    %% State Management
    subgraph "State Management"
        direction TB
        Store["Redux Store"]:::state
        DarkModeSlice["DarkModeSlice"]:::state
    end

    App -->|"dispatches/actions"| Store
    LNav -->|toggles dark mode| DarkModeSlice
    DarkModeSlice -->|updates state| Store
    Store -->|provides theme| App

    %% Data Layer
    subgraph "Data Layer (Hooks)"
        direction TB
        FetchMovies["useFetchMovies"]:::data
        FetchTrailer["useFetchTrailer"]:::data
    end

    Popular -->|calls| FetchMovies
    NowPlaying -->|calls| FetchMovies
    TopRated -->|calls| FetchMovies
    Upcoming -->|calls| FetchMovies
    SearchBox -->|calls| FetchMovies
    SearchBoxS -->|calls| FetchMovies
    Modal -->|calls| FetchTrailer

    FetchMovies -->|HTTP request| TMDB
    FetchTrailer -->|HTTP request| TMDB

    %% External Service
    TMDB["TMDB API\n/movie/popular\n/movie/now_playing\n/movie/top_rated\n/movie/upcoming\n/search/movie\n/movie/{movie_id}/videos"]:::external

    %% Build Tooling & Styling
    subgraph "Build & Styling"
        direction TB
        Vite["Vite"]:::tooling
        Tailwind["tailwind.config.js"]:::tooling
        PostCSS["postcss.config.js"]:::tooling
        GlobalCSS1["index.css"]:::tooling
        GlobalCSS2["App.css"]:::tooling
    end

    Vite -->|bundles| Index
    Vite --> Main
    Tailwind --> GlobalCSS1
    Tailwind --> GlobalCSS2
    PostCSS --> GlobalCSS1
    PostCSS --> GlobalCSS2

    %% Hosting / Deployment
    subgraph "Hosting"
        Vercel["Vercel"]:::tooling
    end

    Vercel -->|serves assets| Index

    %% Click Events
    click Index "https://github.com/devwithsmile/cillyscreen/blob/main/index.html"
    click Main "https://github.com/devwithsmile/cillyscreen/blob/main/src/main.jsx"
    click App "https://github.com/devwithsmile/cillyscreen/blob/main/src/App.jsx"
    click LNav "https://github.com/devwithsmile/cillyscreen/blob/main/src/Components/navbar/largeScreen/Navbar.jsx"
    click AllNavLinks "https://github.com/devwithsmile/cillyscreen/blob/main/src/Components/navbar/largeScreen/AllNavLinks.jsx"
    click SearchBox "https://github.com/devwithsmile/cillyscreen/blob/main/src/Components/navbar/largeScreen/SearchBox.jsx"
    click LNavS "https://github.com/devwithsmile/cillyscreen/blob/main/src/Components/navbar/smallScreen/NavbarSmall.jsx"
    click AllNavLinksS "https://github.com/devwithsmile/cillyscreen/blob/main/src/Components/navbar/smallScreen/AllNavLinksSmall.jsx"
    click SearchBoxS "https://github.com/devwithsmile/cillyscreen/blob/main/src/Components/navbar/smallScreen/SearchBoxSmall.jsx"
    click NowPlaying "https://github.com/devwithsmile/cillyscreen/blob/main/src/Components/Now_playing.jsx"
    click Popular "https://github.com/devwithsmile/cillyscreen/blob/main/src/Components/Popular.jsx"
    click TopRated "https://github.com/devwithsmile/cillyscreen/blob/main/src/Components/TopRated.jsx"
    click Upcoming "https://github.com/devwithsmile/cillyscreen/blob/main/src/Components/Upcoming.jsx"
    click Card "https://github.com/devwithsmile/cillyscreen/blob/main/src/Components/Card.jsx"
    click SkeletonCard "https://github.com/devwithsmile/cillyscreen/blob/main/src/Components/SkeletonCard.jsx"
    click Modal "https://github.com/devwithsmile/cillyscreen/blob/main/src/Components/Modal.jsx"
    click Logo "https://github.com/devwithsmile/cillyscreen/blob/main/src/Components/Logo.jsx"
    click Store "https://github.com/devwithsmile/cillyscreen/blob/main/src/redux/store.js"
    click DarkModeSlice "https://github.com/devwithsmile/cillyscreen/blob/main/src/slices/DarkMode/darkModeSlice.js"
    click FetchMovies "https://github.com/devwithsmile/cillyscreen/blob/main/src/customeHooks/useFetchMovies.js"
    click FetchTrailer "https://github.com/devwithsmile/cillyscreen/blob/main/src/customeHooks/useFetchTrailer.js"
    click Vite "https://github.com/devwithsmile/cillyscreen/blob/main/vite.config.js"
    click Tailwind "https://github.com/devwithsmile/cillyscreen/blob/main/tailwind.config.js"
    click PostCSS "https://github.com/devwithsmile/cillyscreen/blob/main/postcss.config.js"
    click GlobalCSS1 "https://github.com/devwithsmile/cillyscreen/blob/main/src/index.css"
    click GlobalCSS2 "https://github.com/devwithsmile/cillyscreen/blob/main/src/App.css"
    click Vercel "https://github.com/devwithsmile/cillyscreen/blob/main/vercel.json"

    %% Styles
    classDef component fill:#D8B4FE,stroke:#7C3AED,color:#fff
    classDef data fill:#3B82F6,stroke:#1E40AF,color:#fff
    classDef state fill:#10B981,stroke:#047857,color:#fff
    classDef tooling fill:#9CA3AF,stroke:#4B5563,color:#000
    classDef external fill:#FBBF24,stroke:#B45309,color:#000
    classDef shell fill:#E5E7EB,stroke:#6B7280,color:#000
```
