# ck20831/product-display architecture

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

- Interactive diagram: https://gitdiagram.com/ck20831/product-display
- Repository: https://github.com/ck20831/product-display

## Overview

##### Project type and purpose
- This is a single-page React + TypeScript application built with Vite that delivers an immersive 3D product showcase in the browser.
- There is no separate backend or database; all code lives in `src/`, and assets (3D models, fonts, images) are served statically from `public/`.

##### File structure
- Top-level files:
- `index.html` – host page
- `vite.config.ts`, `tsconfig.json` – build and type configurations
- `package.json`, `.eslintrc.cjs` – dependencies, scripts, and lint rules
- `src/` contains the React application:
- `main.tsx` – application entry point (mounts `<App />`)
- `App.tsx` – root component orchestrating subcomponents
- `components/ImmersiveSession.tsx` – likely wraps WebGL/three.js canvas
- `components/html/` – UI overlays
- `components/product-display/` – group of components handling product listing, grid, sidebar, intro, team info
- `components/ui/` – reusable UI pieces (Glass, IconButton)
- `public/` holds static assets: 3D GLB models, skybox HDR, fonts, images.

##### README
- It’s the standard Vite + React + TS template README.
- Confirms use of `@vitejs/plugin-react` for fast refresh and ESLint recommendations.

##### Main components
a. Client Browser (User Interface)
b. Static Asset Server (Vite dev server or deployed static host)
c. React Application
- App Root (`App.tsx`)
- ImmersiveSession (WebGL canvas layer)
- Product Display Module (Intro, Grid, Card, Sidebar, Team)
- HTML Overlay Components (enter, info)
- UI Library Components (Glass effect, IconButton)
d. Public Assets Storage
- 3D Models folder
- Skybox images
- Fonts & JSON
e. Build & Tooling
- Vite + plugins (React, SWC/Babel)
- TypeScript compiler
- ESLint

##### Relationships and data flows
- Browser requests `index.html` from Static Server → loads JS bundle
- React App bootstraps in Browser memory
- ImmersiveSession fetches 3D assets (GLB, HDR) from Static Server → renders via WebGL
- Product-Display components may fetch or import JSON/metadata from `public/` or `/src/resources`
- UI components get props from parent components; all state lives in React memory
- Build system (Vite) transforms TSX → JS, applies HMR in dev, bundles for production

##### Architectural patterns & design principles
- Component-based UI (React) with clear separation:
- Presentation (UI) vs Feature (Product-Display, ImmersiveSession)
- Static assets separated under `public/`
- Single Page Application (SPA) served statically
- Development pipeline: Vite dev server + fast refresh plugin
- Type safety via TypeScript; linting via ESLint plugin

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Developer Machine
    subgraph "Developer Machine"
        direction TB
        VITE["Vite Configuration"]:::tool
        TS["TypeScript Configuration"]:::tool
        ESLINT["ESLint Configuration"]:::tool
        PKG["Package Definitions & Scripts"]:::tool
        Build["Build Pipeline"]:::tool
        VITE --> Build
        TS --> Build
        ESLINT --> Build
        PKG --> Build
    end

    %% Production Host
    subgraph "Production Host"
        direction TB
        Server["Static Asset Server"]:::runtime
        subgraph "Public Assets Storage"
            direction TB
            Models["3D Models"]:::asset
            Skybox["Skybox HDR Images"]:::asset
            Fonts["Font Files & JSON"]:::asset
            Images["Static Images"]:::asset
            Models --> Server
            Skybox --> Server
            Fonts --> Server
            Images --> Server
        end
        Build --> Server
    end

    %% User Browser
    subgraph "User Browser"
        direction TB
        Browser["Client Browser (User Interface)"]:::runtime
        Browser -->|GET index.html| Server

        subgraph "React Application"
            direction TB
            Entry["main.tsx"]:::runtime
            Root["App.tsx"]:::runtime
            Entry --> Root

            subgraph "Immersive Session"
                Immersive["ImmersiveSession"]:::runtime
            end

            subgraph "HTML Overlays"
                Enter["Enter Overlay"]:::runtime
                Info["Info Overlay"]:::runtime
            end

            subgraph "Product Display Module"
                PD["ProductDisplay Module"]:::runtime
                Intro["Intro Screen"]:::runtime
                Grid["Product Grid"]:::runtime
                Card["Product Card"]:::runtime
                Loader["Products Data Loader"]:::runtime
                Sidebar["Sidebar Panel"]:::runtime
                Team["Team Section"]:::runtime
                PD --> Intro
                PD --> Grid
                PD --> Card
                PD --> Loader
                PD --> Sidebar
                PD --> Team
            end

            subgraph "UI Library Components"
                Glass["Glass Effect"]:::runtime
                IconBtn["IconButton"]:::runtime
            end

            Root --> Immersive
            Root --> Enter
            Root --> Info
            Root --> PD
            Root --> Glass
            Root --> IconBtn

            Immersive -->|GET GLB/HDR| Server
            Loader -->|GET metadata.json| Server
        end

        Browser --> ReactApp["React Application"]
    end

    %% Click Events
    click Browser "https://github.com/ck20831/product-display/blob/main/index.html"
    click Server "https://github.com/ck20831/product-display/tree/main/public/"
    click Entry "https://github.com/ck20831/product-display/blob/main/src/main.tsx"
    click Root "https://github.com/ck20831/product-display/blob/main/src/App.tsx"
    click Immersive "https://github.com/ck20831/product-display/blob/main/src/components/ImmersiveSession.tsx"
    click Enter "https://github.com/ck20831/product-display/blob/main/src/components/html/enter.tsx"
    click Info "https://github.com/ck20831/product-display/blob/main/src/components/html/info.tsx"
    click PD "https://github.com/ck20831/product-display/blob/main/src/components/product-display/ProductDisplay.tsx"
    click Intro "https://github.com/ck20831/product-display/blob/main/src/components/product-display/Intro.tsx"
    click Grid "https://github.com/ck20831/product-display/blob/main/src/components/product-display/ProductGrid.tsx"
    click Card "https://github.com/ck20831/product-display/blob/main/src/components/product-display/ProductCard.tsx"
    click Loader "https://github.com/ck20831/product-display/blob/main/src/components/product-display/Products.tsx"
    click Sidebar "https://github.com/ck20831/product-display/blob/main/src/components/product-display/Sidebar.tsx"
    click Team "https://github.com/ck20831/product-display/blob/main/src/components/product-display/Team.tsx"
    click Glass "https://github.com/ck20831/product-display/blob/main/src/components/ui/Glass.tsx"
    click IconBtn "https://github.com/ck20831/product-display/blob/main/src/components/ui/IconButton.tsx"
    click VITE "https://github.com/ck20831/product-display/blob/main/vite.config.ts"
    click TS "https://github.com/ck20831/product-display/blob/main/tsconfig.json"
    click ESLINT "https://github.com/ck20831/product-display/blob/main/.eslintrc.cjs"
    click PKG "https://github.com/ck20831/product-display/blob/main/package.json"

    %% Styles
    classDef runtime fill:#DDEBF7,stroke:#4F81BD,color:#0F243E
    classDef asset fill:#E2EFDA,stroke:#76923C,color:#274E13
    classDef tool fill:#FCE4D6,stroke:#C0504D,color:#632423
```
