How anishkmbtech/internship-project works
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