How tushar-81/xivtech-assignment works
Project type and purpose
• This is a single-page web application (SPA) for real-time cryptocurrency price tracking.
• It uses React + TypeScript on the front end, Redux Toolkit for state management, Tailwind CSS for styling, and Framer Motion for animations. There is no back-end server—price data is simulated client-side via ConnectionSimulator.
File structure
• Top-level “public/” holds your static entry point (index.html), manifest and robots settings.
• “src/” contains all front-end code:
• src/index.tsx bootstraps the React App.
• src/app/store.ts configures the Redux store.
• src/features/cryptoSlice.ts defines state, reducers, and actions for crypto data.
• src/components/ houses reusable UI pieces (Header, CryptoTable, ConnectionSimulator).
• src/utils/ contains test helpers and other utilities.
• src/types/ defines shared TypeScript types.
• Config files (tsconfig.json, tailwind.config.js, postcss.config.js) and build scripts (package.json) underlie the toolchain (CRA, PostCSS, Tailwind).
Review README insights
• Real-time simulation every 1.5s driven by ConnectionSimulator.
• Responsive layout with table/card toggles, sorting/filtering, UI state persists in localStorage.
• Built/tested via Create React App’s Webpack pipeline, unit tests in src/*.test.tsx.
a. Main components to represent:
• Browser / User Device
• Static Asset Host (e.g. CDN or Web Server serving index.html + JS bundle + CSS)
• React Application
• Redux Store (configured in store.ts)
• ConnectionSimulator (simulated data producer)
• UI Components (Header, CryptoTable, etc.)
• Persistence Layer (localStorage)
• Utility Modules (e.g. test utils, TypeScript types—not critical to data flow but can be shown as ancillary)
b. Relationships & interactions:
• Browser requests static assets from host → loads React bundle.
• React init calls store.ts, loads persisted preferences from localStorage.
• ConnectionSimulator emits “priceUpdate” events every 1.5s → dispatches actions to cryptoSlice.
• Redux store updates state → subscribed UI components re-render via React.
• User sorting/filtering interactions dispatch actions → updates store → new UI state → preferences saved back to localStorage.
c. Architectural patterns / design principles:
• Flux / unidirectional data flow (React + Redux).
• Separation of concerns: Simulation & state logic in slices, presentation in components.
• Immutable state updates via Redux Toolkit.
d. Key technologies:
• React + React-DOM (JSX rendering)
• Redux Toolkit (store, slices, middleware)
• TypeScript (static typing)
• Tailwind CSS & PostCSS (utility-first styling)
• Framer Motion (animations)
• Create React App (build tooling, Webpack, Babel)