# madhusudhangupta/imdb-clone architecture

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

- Interactive diagram: https://gitdiagram.com/madhusudhangupta/imdb-clone
- Repository: https://github.com/madhusudhangupta/imdb-clone

## Overview

##### Project type and purpose
- This is a Next.js–based, React-powered web application generated via `create-next-app`. It’s essentially a front-end (SSR/SSG) IMDb-clone that fetches movie data from an external API at runtime. There is no custom backend service—the Next.js server handles routing, rendering, and data fetching.

##### File structure
- Top-level config & metadata:
- `.eslintrc.json`, `jsconfig.json`, `next.config.js`, `postcss.config.js`, `tailwind.config.js`
- `package.json` / `package-lock.json`
- Public assets:
- Application code:
- `/src/app` – Next.js App Router structure
– `page.js` (home), `about/page.js`, `movie/[id]/page.js`, `search/[searchTerm]/page.js`, plus layout, loading, error UI
- `/src/components` – reusable UI pieces (Card, Navbar, SearchBox, etc.)
- Deployment: implicitly on Vercel (per README)

##### README for additional insights
- Project is live on Vercel; uses Next.js’s automatic font optimization; no mention of custom microservices or databases—external API (OMDb or IMDb) is the data source.

##### Final advice
- Every piece: routing layer, data-fetching logic, UI component hierarchy, and deployment infrastructure.
- Don’t over-simplify—show the division between static assets and dynamic rendering, and where API calls happen.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client (Browser)" 
        Browser["User's Browser"]:::frontend
    end

    %% CDN Layer
    subgraph "CDN / Static Assets (Vercel Edge)" 
        PublicAssets["public/ (Static Assets)"]:::cdn
        PublicAssets -->|serves assets| Browser
    end

    %% Server Layer
    subgraph "Next.js Server (Node.js)" 
        NextServer["Next.js Server\n(Routing & Rendering)"]:::server

        subgraph "App Router (src/app)"
            Layout["layout.js"]:::server
            Providers["Providers.js"]:::server
            ErrorUI["error.js"]:::server
            LoadingUI["loading.js"]:::server
            HomePage["page.js (Home)"]:::server
            AboutPage["about/page.js"]:::server
            MoviePage["movie/[id]/page.js"]:::server
            SearchPage["search/[searchTerm]/page.js"]:::server
        end

        subgraph "UI Components (src/components)"
            Card["Card.js"]:::frontend
            Result["Result.js"]:::frontend
            SearchBox["SearchBox.js"]:::frontend
            Navbar["Navbar.js"]:::frontend
            NavbarItem["NavbarItem.js"]:::frontend
            MenuItem["MenuItem.js"]:::frontend
            Header["Header.js"]:::frontend
            DarkMode["DarkModeSwitch.js"]:::frontend
        end

        subgraph "Global Styles & Config"
            GlobalsCSS["globals.css"]:::server
            TailwindConfig["tailwind.config.js"]:::server
            PostCSS["postcss.config.js"]:::server
        end

        ProjectConfig["Project Config & Metadata"]:::server
    end

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

    %% Relationships
    Browser -->|requests pages| NextServer
    NextServer -->|fetches data| ExternalAPI
    NextServer -->|caches pages/assets| PublicAssets
    Browser -->|loads static pages/assets| PublicAssets

    %% Click Events for App Router
    click Layout "https://github.com/madhusudhangupta/imdb-clone/blob/main/src/app/layout.js"
    click Providers "https://github.com/madhusudhangupta/imdb-clone/blob/main/src/app/Providers.js"
    click ErrorUI "https://github.com/madhusudhangupta/imdb-clone/blob/main/src/app/error.js"
    click LoadingUI "https://github.com/madhusudhangupta/imdb-clone/blob/main/src/app/loading.js"
    click HomePage "https://github.com/madhusudhangupta/imdb-clone/blob/main/src/app/page.js"
    click AboutPage "https://github.com/madhusudhangupta/imdb-clone/blob/main/src/app/about/page.js"
    click MoviePage "https://github.com/madhusudhangupta/imdb-clone/blob/main/src/app/movie/[id]/page.js"
    click SearchPage "https://github.com/madhusudhangupta/imdb-clone/blob/main/src/app/search/[searchTerm]/page.js"

    %% Click Events for UI Components
    click Card "https://github.com/madhusudhangupta/imdb-clone/blob/main/src/components/Card.js"
    click Result "https://github.com/madhusudhangupta/imdb-clone/blob/main/src/components/Result.js"
    click SearchBox "https://github.com/madhusudhangupta/imdb-clone/blob/main/src/components/SearchBox.js"
    click Navbar "https://github.com/madhusudhangupta/imdb-clone/blob/main/src/components/Navbar.js"
    click NavbarItem "https://github.com/madhusudhangupta/imdb-clone/blob/main/src/components/NavbarItem.js"
    click MenuItem "https://github.com/madhusudhangupta/imdb-clone/blob/main/src/components/MenuItem.js"
    click Header "https://github.com/madhusudhangupta/imdb-clone/blob/main/src/components/Header.js"
    click DarkMode "https://github.com/madhusudhangupta/imdb-clone/blob/main/src/components/DarkModeSwitch.js"

    %% Click Events for Styles & Config
    click GlobalsCSS "https://github.com/madhusudhangupta/imdb-clone/blob/main/src/app/globals.css"
    click TailwindConfig "https://github.com/madhusudhangupta/imdb-clone/blob/main/tailwind.config.js"
    click PostCSS "https://github.com/madhusudhangupta/imdb-clone/blob/main/postcss.config.js"

    %% Click Events for Public Assets
    click PublicAssets "https://github.com/madhusudhangupta/imdb-clone/tree/main/public/"

    %% Click Events for Project Config
    click ProjectConfig "https://github.com/madhusudhangupta/imdb-clone/blob/main/package.json"

    %% Styles
    classDef frontend fill:#E0F7FA,stroke:#00838F,color:#004D40
    classDef server fill:#E8F5E9,stroke:#2E7D32,color:#1B5E20
    classDef external fill:#FFF3E0,stroke:#EF6C00,color:#E65100
    classDef cdn fill:#EDE7F6,stroke:#6A1B9A,color:#4A148C
```
