How svadhis/404wheel works
Project Type and Purpose
• This is a front-end single-page application built with React, TypeScript, and Vite.
• Its purpose is to render a dynamic UI (components like Wheel, Control, Advert, Register, Result) in the browser, with hot module replacement in development.
Key Components
a. Development & Build Environment
• Node.js & npm/Yarn – manages dependencies (package.json, package-lock.json)
• Vite Dev Server – serves index.html, provides HMR via @vitejs/plugin-react or plugin-react-swc
• ESLint & TypeScript Compiler – linting (eslint.config.js) and type-checking (tsconfig.*.json)
b. Static Assets
• public/assets – images, fonts, static JSON
• src/assets – module-imported assets
c. Core Application (Client)
• index.html → entry point
• src/main.tsx → bootstraps React into root element
• src/App.tsx + App.css → top-level layout & global styles
• React Components:
– Advert.tsx
– Control.tsx
– Register.tsx
– Wheel.tsx
– Result.tsx
• Utility Modules: constants.ts, utils.ts
d. Output
• dist/ (after build) – production bundle, static files
Relationships & Data Flow
• Browser loads index.html, requests the JS bundle from the Vite dev server (or static host in prod).
• main.tsx mounts the App component into the DOM.
• App renders child components and passes state/handlers via props.
• Components import constants and utils for business logic.
• User actions in Control/Register/Wheel flow up via callbacks to App, which updates state and triggers re-render.
• Result component displays outcomes; Advert may fetch or display static promotions.
Architectural Patterns & Design Principles
• Single-Page Application (SPA) pattern
• Unidirectional data flow (React props/state)
• Modular component structure (one file per component)
• Separation of concerns:
• Presentation (components + CSS)
• Logic (utils, constants)
• Build config (Vite, ESLint, TS config)
6. Assets (public/assets, src/assets) as resources loaded by components.
7. Data flow: User → Control/ Register → App state → Wheel → Result → UI.