How himasnhu-at/crypto-tracker works
Main Components
a) External Components:
• CoinGecko API (implied from cryptocurrency data fetching)
• MongoDB Database
• Client Applications (API consumers)
b) Internal Components:
• NestJS Application Server
• Crypto Module
• Background Service
• Database Schema Layer
Client Layer
API Layer (NestJS)
Data Layer (MongoDB)
Detailed Component Breakdown
a) API Layer (Main Focus):
• Main Application Module (AppModule)
• Crypto Module (CryptoModule)
• Controllers (CryptoController)
• Services (CryptoService)
b) Data Flow Paths:
1. Client requests to API endpoints (/crypto/stats, /crypto/deviation, /crypto/fetch-prices)
2. Service communication with external CoinGecko API
3. Data persistence flow to MongoDB
4. Background service data polling path
Specific Implementation Details
┌─────────────────────────────────────────────────────┐
• Client Applications │
• ┘
• ↓ HTTP
┌─────────────────────────────────────────────────────┐
• NestJS Application │
• ┌─────────────┐ ┌───────────────────────┐ │
• AppModule │ │ CryptoModule │ │
• ┘ │ ┌─────────────────┐ │ │
• CryptoController │ │ │
• /stats │ │ │
• /deviation │ │ │
• /fetch-prices │ │ │
• ┘ │ │
• ┌─────────────────┐ │ │
• CryptoService │ │ │
• ┘ │ │
• ┘ │
• ┘
• ↙ ↘
┌─────────────────┐ ┌─────────────────┐
• CoinGecko API │ │ MongoDB │
• ┘ │ (CryptoPrice │
• Schema) │
• ┘
Key Elements to Highlight
a) API Endpoints:
• GET /crypto/stats
• GET /crypto/deviation
• GET /crypto/fetch-prices
• GET / (health check)
b) Data Models:
• CryptoPriceSchema (showing fields: price, marketCap, 24hChange)
c) Background Services:
• Price fetching service
• Data aggregation for deviation calculation
Additional Notes
• A note about Docker containerization
• Test coverage points (controller, service, and e2e tests)
• Environment configuration requirements
• Scaling possibilities with Docker Compose