# khushalgrover/spotdifference-eklavya-assessment architecture

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

- Interactive diagram: https://gitdiagram.com/khushalgrover/spotdifference-eklavya-assessment
- Repository: https://github.com/khushalgrover/spotdifference-eklavya-assessment

## Overview

##### Project type and purpose
- This is a single-page application (SPA) built with React and Vite, meant to deliver a “Spot the Difference” assessment game.
- There is no separate backend: it’s a client-side app that loads static JSON configurations and image assets, handles all game logic in the browser, and is deployed as a static site (e.g., on Vercel).

##### File structure
- Top-level build & config:
- vite.config.js, tsconfig*.json, eslint.config.js, package.json, vercel.json
- Public assets:
- public/images/source.psd (and any derived image assets)
- Source code under src/:
- src/main.jsx + src/index.css – app entry point and global styles
- src/App.jsx + src/App.css – root component, global layout
- src/routes/ – React Router setup (AppRouter.jsx, index.jsx)
- src/pages/ – three main screens: HomeScreen, GameScreen, AdminScreen
- src/components/ – reusable or screen-specific React components (HowToPlay, game-loader, etc.)
- src/components/ui/ – atomic UI primitives (button, input, dialog, badge, card, tabs, label)
- src/config/screen-config.json & components.json – static game/config data
- src/lib/utils.ts & src/utils/gameConfigUtils.js – shared utility functions and game logic

##### README
- Confirms React + Vite with HMR, ESLint setup
- Mentions optional TS integration (this project uses JS/TS hybrid)
- Project name: SpotDifference-Eklavya-Assessment

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Build & Deploy"
        VITE["Vite Build Toolchain"]:::infra
        VERCELCFG["Static Hosting Configuration (vercel.json)"]:::infra
    end

    subgraph "Static Host"
        HOST["Static Asset Host"]:::infra
    end

    subgraph "Client Runtime"
        BUNDLE["React App Bundle (JS/CSS)"]:::infra
        ENTRY["Application Entry Point\n(src/main.jsx)"]:::runtime
        ROOT["Root Application Component\n(src/App.jsx)"]:::runtime
        ROUTER["Router Layer"]:::runtime
        subgraph "Pages"
            HOME["Home Screen"]:::runtime
            GAME["Game Screen"]:::runtime
            ADMIN["Admin Screen"]:::runtime
        end
        UI["UI Primitives Library\n(src/components/ui/)"]:::ui
        subgraph "Shared Components"
            HOW["HowToPlay Component"]:::runtime
            LOADER["Game Loader Component"]:::runtime
        end
        subgraph "Logic & Utilities"
            UTIL["Generic Utilities\n(src/lib/utils.ts)"]:::logic
            GCFG["Game Config Utilities\n(src/utils/gameConfigUtils.js)"]:::logic
        end
        subgraph "Configuration Data"
            SCRCFG["screen-config.json"]:::data
            COMPCFG["components.json"]:::data
        end
        ASSETS["Public Assets (images)\n(public/images/source.psd)"]:::data
    end

    VITE -->|"builds"| BUNDLE
    VERCELCFG -->|"configures"| HOST
    HOST -->|"serves bundle"| BUNDLE
    HOST -->|"serves assets"| ASSETS

    BUNDLE -->|"loads"| ENTRY
    ENTRY -->|"renders"| ROOT
    ROOT -->|"uses"| ROUTER
    ROUTER -->|"routes to"| HOME
    ROUTER -->|"routes to"| GAME
    ROUTER -->|"routes to"| ADMIN

    HOME -->|"renders"| UI
    GAME -->|"renders"| UI
    ADMIN -->|"renders"| UI

    HOME -->|"uses"| HOW
    GAME -->|"uses"| LOADER
    ADMIN -->|"uses"| HOW

    HOME -->|"calls"| UTIL
    GAME -->|"calls"| UTIL
    GAME -->|"calls"| GCFG
    ADMIN -->|"calls"| GCFG

    GAME -->|"fetches (HTTP GET)"| SCRCFG
    GAME -->|"fetches (HTTP GET)"| ASSETS
    ADMIN -->|"fetches (HTTP GET)"| SCRCFG
    ADMIN -->|"fetches (HTTP GET)"| COMPCFG

    click VITE "https://github.com/khushalgrover/spotdifference-eklavya-assessment/blob/main/vite.config.js"
    click VERCELCFG "https://github.com/khushalgrover/spotdifference-eklavya-assessment/blob/main/vercel.json"
    click ENTRY "https://github.com/khushalgrover/spotdifference-eklavya-assessment/blob/main/src/main.jsx"
    click ROOT "https://github.com/khushalgrover/spotdifference-eklavya-assessment/blob/main/src/App.jsx"
    click ROUTER "https://github.com/khushalgrover/spotdifference-eklavya-assessment/blob/main/src/routes/AppRouter.jsx"
    click HOME "https://github.com/khushalgrover/spotdifference-eklavya-assessment/blob/main/src/pages/HomeScreen.jsx"
    click GAME "https://github.com/khushalgrover/spotdifference-eklavya-assessment/blob/main/src/pages/GameScreen.jsx"
    click ADMIN "https://github.com/khushalgrover/spotdifference-eklavya-assessment/blob/main/src/pages/AdminScreen.jsx"
    click UI "https://github.com/khushalgrover/spotdifference-eklavya-assessment/tree/main/src/components/ui/"
    click HOW "https://github.com/khushalgrover/spotdifference-eklavya-assessment/blob/main/src/components/HowToPlay.jsx"
    click LOADER "https://github.com/khushalgrover/spotdifference-eklavya-assessment/blob/main/src/components/game-loader.jsx"
    click UTIL "https://github.com/khushalgrover/spotdifference-eklavya-assessment/blob/main/src/lib/utils.ts"
    click GCFG "https://github.com/khushalgrover/spotdifference-eklavya-assessment/blob/main/src/utils/gameConfigUtils.js"
    click SCRCFG "https://github.com/khushalgrover/spotdifference-eklavya-assessment/blob/main/src/config/screen-config.json"
    click COMPCFG "https://github.com/khushalgrover/spotdifference-eklavya-assessment/blob/main/components.json"
    click ASSETS "https://github.com/khushalgrover/spotdifference-eklavya-assessment/blob/main/public/images/source.psd"

    classDef infra fill:#D6EAF8,stroke:#3498DB,color:#154360;
    classDef runtime fill:#E8F8F5,stroke:#1ABC9C,color:#0E6251;
    classDef ui fill:#FEF9E7,stroke:#F1C40F,color:#B7950B;
    classDef logic fill:#F5EEF8,stroke:#9B59B6,color:#4A235A;
    classDef data fill:#FDEDEC,stroke:#E74C3C,color:#641E16;
```
