How ai-varun/crypto-tracking works
Project type and purpose
• This is a full-stack crypto-tracking application consisting of a Next.js/TypeScript frontend and an Express/Node.js backend.
• Purpose: fetch real-time crypto data from external APIs, store/manage it in MongoDB on the backend, and display live updates on the client, allowing users to switch symbols via a modal.
File structure
• Top-level separation into two folders: client/ and server/.
• Client side (client/):
• Next.js app in src/app and src/pages
• UI components in src/components (CryptoSelector, Modal, PriceTable)
• Redux state management in src/store
• Configuration: ESLint, Tailwind, PostCSS, TypeScript.
• Server side (server/):
• Express app entry src/index.ts
• Controllers in src/controllers (dataController.ts)
• Route definitions in src/routes
• Business logic in src/services (cryptoService.ts)
• Data schema in src/models (crypto.ts)
• Configuration via tsconfig.json, .gitignore, package.json.
Extract insights from README
• Backend features: real-time fetch, MongoDB storage, REST API (GET /api/data?symbol=).
• Frontend features: table of live prices, modal for symbol selection, state management via Redux, data fetch via Axios.
a. Main components
• Frontend (Next.js application)
• Backend (Express service)
• Database (MongoDB)
• External Crypto API(s)
• Redux store on the client
b. Component interactions
• Frontend → Axios HTTP calls → Backend REST API
• Backend → External Crypto API (periodic fetch or on-demand)
• Backend → MongoDB (read/write crypto data)
• Frontend UI dispatches Redux actions, updates store, re-renders PriceTable.
c. Architectural patterns and design principles
• Client: component-based UI, unidirectional data flow via Redux (actions → reducers → store → components).
• Server: MVC-like separation (routes → controllers → services → models).
• Clear separation of concerns: UI vs. business logic vs. data access.
d. Key technologies and frameworks
• Frontend: Next.js, React, TypeScript, Redux, Axios, Tailwind CSS
• Backend: Node.js, Express, TypeScript, Mongoose (or MongoDB driver)
• External service: public crypto pricing API
• Database: MongoDB