# anishkmbtech/internship-project architecture

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

- Interactive diagram: https://gitdiagram.com/anishkmbtech/internship-project
- Repository: https://github.com/anishkmbtech/internship-project

## Overview

##### Project type and purpose
- Type: Front-end Single-Page Application (SPA)
- Purpose: A quiz platform (pages for Categories, Active Quiz, Quiz Details, Results, Leaderboard, Profile, NotFound) with an embedded ChatBot feature.
- Tech stack (inferred from files):
– React + TypeScript (src/**/*.tsx)
– Vite bundler (vite.config.ts, main.tsx, index.html)
– Tailwind CSS (tailwind.config.ts, index.css, postcss.config.js)
– Custom UI components library under src/components/ui
– API client in src/api (e.g. chat.js)

##### File structure
- Public/static assets: public/ and index.html
- Entry point: src/main.tsx ➔ App.tsx
- Layout/composition: src/components/Layout.tsx, Navigation.tsx
- Page routes: src/pages/*.tsx
- Feature UI library: src/components/ui/**/*
- Business logic/API layer: src/api/chat.js
- Shared hooks & utils: src/hooks/*, src/lib/utils.ts
- Configuration: package.json, tsconfig*.json, vite.config.ts, tailwind.config.ts

##### Key external dependencies (from package.json)
- React Router (for pages navigation)
- Tailwind & PostCSS (styling)
- Radix/Headless UI or custom primitives (src/components/ui)
- Possibly OpenAI or own quiz service via chat.js

##### Main components and their relationships
A. Browser / User Agent
– Loads index.html from static host (Netlify)
– Runs the Vite-bundled JS/CSS
B. SPA Shell
– main.tsx ➔ App.tsx
– Provides global context (e.g. Theme, Toast)
– Renders Layout + Navigation + ChatBot sidebar
C. Router & Pages
– Routes to Index, Categories, ActiveQuiz, QuizDetails, Results, Leaderboard, Profile, NotFound
– Each page uses shared UI components and hooks
D. UI Component Library
– Primitive and composite components (Button, Card, Table, Dialog, etc.)
E. API Layer
– src/api/chat.js: exposes methods to call external services
– Pages and ChatBot import these functions to fetch quizzes or chat responses
F. External Services
– Quiz backend (REST/GraphQL endpoints)
– Chat API (e.g. OpenAI or custom chat service)
– Authentication/Storage (if any – not in this repo)

##### Architectural patterns & design principles
- Component-based architecture (UI primitives ➔ composite components ➔ pages)
- Unidirectional data flow (API ➔ state/hooks ➔ UI)
- Separation of concerns:
– Presentation (components/ui)
– Routing (pages + React Router)
– Data (api/*, hooks)
- Theming & global state via context/hooks

##### Putting it all together
1. User’s Browser
2. Static Host (Netlify) ─ index.html, assets
3. Vite-built SPA
├─ main.tsx → App.tsx
├─ Layout & Navigation
├─ Router → Pages
├─ ChatBot
├─ UI Library
└─ Hooks & Utils
4. API Client (chat.js)
5. External Services (Quiz API, Chat API)
6. (Optional) Persistence/DB behind those services

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% User and Hosting
    Browser["User's Browser"]:::client
    StaticHost["Static Host\n(public/, index.html)"]:::host
    Browser -->|HTTP GET index.html| StaticHost

    %% Build & Dev Pipeline
    subgraph "Build & Dev Pipeline" 
        direction TB
        ViteConfig["vite.config.ts"]:::config
        TailwindConfig["tailwind.config.ts"]:::config
        PostCSSConfig["postcss.config.js"]:::config
        EndPipeline["Vite Dev Server\n(HMR & Build)"]:::process
        ViteConfig --> EndPipeline
        TailwindConfig --> EndPipeline
        PostCSSConfig --> EndPipeline
        StaticHost -->|Serves assets to| EndPipeline
    end

    %% SPA Application Layer
    subgraph "SPA (Vite-built React App)" 
        direction TB
        Entry["src/main.tsx"]:::entry
        App["src/App.tsx"]:::entry
        Entry -->|Renders| App

        subgraph "Layout & Navigation" 
            direction TB
            Layout["Layout Component"]:::component
            Navigation["Navigation Component"]:::component
            App --> Layout
            App --> Navigation
        end

        ChatBotUI["ChatBot Component"]:::component
        App --> ChatBotUI

        subgraph "Routing & Pages" 
            direction TB
            Router["React Router"]:::component
            IndexP["Index Page"]:::page
            CategoriesP["Categories Page"]:::page
            ActiveP["ActiveQuiz Page"]:::page
            DetailsP["QuizDetails Page"]:::page
            ResultsP["Results Page"]:::page
            LeaderboardP["Leaderboard Page"]:::page
            ProfileP["Profile Page"]:::page
            NotFoundP["NotFound Page"]:::page
            App --> Router
            Router --> IndexP
            Router --> CategoriesP
            Router --> ActiveP
            Router --> DetailsP
            Router --> ResultsP
            Router --> LeaderboardP
            Router --> ProfileP
            Router --> NotFoundP
        end

        subgraph "UI Library & Utilities"
            direction TB
            UILib["UI Component Library\n(src/components/ui/)"]:::component
            Hooks["Custom Hooks\n(src/hooks/)"]:::component
            Utils["Utilities\n(src/lib/utils.ts)"]:::component
            App --> UILib
            App --> Hooks
            App --> Utils
        end

        subgraph "Global Styles"
            direction TB
            GlobalCSS["src/index.css,\nsrc/App.css"]:::config
            App --> GlobalCSS
        end
    end

    %% API Layer and External Services
    API["src/api/chat.js"]:::api
    ActiveP -->|REST/HTTP| API
    DetailsP -->|REST/HTTP| API
    ResultsP -->|REST/HTTP| API
    ChatBotUI -->|REST/HTTP| API

    subgraph "External Services"
        direction TB
        QuizAPI["Quiz Backend API"]:::external
        ChatAPI["Chat Service API"]:::external
        API -->|REST/HTTPS| QuizAPI
        API -->|REST/HTTPS| ChatAPI
    end

    %% Project Manifest & Lockfiles
    Manifest["package.json,\npackage-lock.json,\nbun.lockb"]:::config

    %% Click Events
    click ViteConfig "https://github.com/anishkmbtech/internship-project/blob/main/vite.config.ts"
    click TailwindConfig "https://github.com/anishkmbtech/internship-project/blob/main/tailwind.config.ts"
    click PostCSSConfig "https://github.com/anishkmbtech/internship-project/blob/main/postcss.config.js"
    click StaticHost "https://github.com/anishkmbtech/internship-project/tree/main/public/"
    click StaticHost "https://github.com/anishkmbtech/internship-project/blob/main/index.html"
    click Entry "https://github.com/anishkmbtech/internship-project/blob/main/src/main.tsx"
    click App "https://github.com/anishkmbtech/internship-project/blob/main/src/App.tsx"
    click Layout "https://github.com/anishkmbtech/internship-project/blob/main/src/components/Layout.tsx"
    click Navigation "https://github.com/anishkmbtech/internship-project/blob/main/src/components/Navigation.tsx"
    click ChatBotUI "https://github.com/anishkmbtech/internship-project/blob/main/src/components/ChatBot.tsx"
    click API "https://github.com/anishkmbtech/internship-project/blob/main/src/api/chat.js"
    click IndexP "https://github.com/anishkmbtech/internship-project/blob/main/src/pages/Index.tsx"
    click CategoriesP "https://github.com/anishkmbtech/internship-project/blob/main/src/pages/Categories.tsx"
    click ActiveP "https://github.com/anishkmbtech/internship-project/blob/main/src/pages/ActiveQuiz.tsx"
    click DetailsP "https://github.com/anishkmbtech/internship-project/blob/main/src/pages/QuizDetails.tsx"
    click ResultsP "https://github.com/anishkmbtech/internship-project/blob/main/src/pages/Results.tsx"
    click LeaderboardP "https://github.com/anishkmbtech/internship-project/blob/main/src/pages/Leaderboard.tsx"
    click ProfileP "https://github.com/anishkmbtech/internship-project/blob/main/src/pages/Profile.tsx"
    click NotFoundP "https://github.com/anishkmbtech/internship-project/blob/main/src/pages/NotFound.tsx"
    click UILib "https://github.com/anishkmbtech/internship-project/tree/main/src/components/ui/"
    click Hooks "https://github.com/anishkmbtech/internship-project/tree/main/src/hooks/"
    click Utils "https://github.com/anishkmbtech/internship-project/blob/main/src/lib/utils.ts"
    click GlobalCSS "https://github.com/anishkmbtech/internship-project/blob/main/src/index.css"
    click GlobalCSS "https://github.com/anishkmbtech/internship-project/blob/main/src/App.css"
    click Manifest "https://github.com/anishkmbtech/internship-project/blob/main/package.json"
    click Manifest "https://github.com/anishkmbtech/internship-project/blob/main/package-lock.json"
    click Manifest "https://github.com/anishkmbtech/internship-project/blob/main/bun.lockb"

    %% Styles
    classDef client fill:#D6E4FF,stroke:#1E40AF,color:#1E3A8A
    classDef host fill:#F3F4F6,stroke:#9CA3AF,color:#374151
    classDef config fill:#EDE9FE,stroke:#7C3AED,color:#5B21B6
    classDef process fill:#FEF3C7,stroke:#D97706,color:#92400E
    classDef entry fill:#DBEAFE,stroke:#2563EB,color:#1E40AF
    classDef component fill:#EFF6FF,stroke:#3B82F6,color:#1E3A8A
    classDef page fill:#FFFFFF,stroke:#6B7280,color:#374151
    classDef api fill:#D1FAE5,stroke:#10B981,color:#065F46
    classDef external fill:#F3F4F6,stroke:#9CA3AF,color:#374151
```
