Welcome to CryptoPulse
CryptoPulse is a production-ready NestJS service that provides cryptocurrency price lookups with intelligent request batching, persistence, and enterprise-grade authentication.What is CryptoPulse?
CryptoPulse is designed to efficiently handle high-volume cryptocurrency price queries while minimizing external API calls. When multiple requests ask for the same coin’s price around the same time, the service intelligently batches them together and serves all requests from a single upstream call to CoinGecko.Key Features
Intelligent Request Batching
Automatically groups same-coin requests to reduce API calls. Batches wait up to 5 seconds but flush immediately when 3 requests accumulate.
PostgreSQL Persistence
Every successful price fetch is stored in PostgreSQL with full historical data available via paginated endpoints.
Multi-Instance Ready
Uses Redis for coordination, allowing horizontal scaling with multiple API instances working in sync.
JWT Authentication
Secure bearer token authentication protects all price endpoints with configurable expiration.
Rate Limiting
Built-in throttling with separate limits for global requests and login attempts, backed by Redis.
Interactive API Docs
Full Swagger/OpenAPI documentation at
/docs with request examples and error code references.How It Works
The batching architecture follows a simple but powerful flow:Smart Flush
The batch flushes when either:
- 3 pending requests accumulate (threshold), OR
- 5 seconds elapse (batch window)
Architecture Highlights
Tech Stack
- Framework: NestJS with Fastify for high performance
- Database: PostgreSQL with TypeORM for structured data
- Cache/Coordination: Redis (ioredis) for distributed batching and throttling
- Authentication: JWT tokens via
@nestjs/jwt - Documentation: OpenAPI/Swagger at
/docs - Testing: Jest with comprehensive unit and e2e coverage
Design Principles
CryptoPulse prioritizes efficiency and reliability. By batching requests intelligently, it can reduce external API calls by up to 90% in high-traffic scenarios while maintaining sub-second response times.
API Endpoints
CryptoPulse exposes a clean REST API:| Endpoint | Method | Description |
|---|---|---|
/auth/login | POST | Authenticate and receive JWT token |
/v1/price/:coinId | GET | Get current price (with batching) |
/v1/price/:coinId/history | GET | Get historical prices with pagination |
Use Cases
- Cryptocurrency Dashboards: Display real-time prices for multiple coins efficiently
- Trading Bots: Query prices with minimal API overhead and rate limit exposure
- Portfolio Trackers: Historical price data with date range filtering and pagination
- Price Alerts: Monitor specific coins with persistent price history
- Analytics Platforms: Build reports on price trends over time
What’s Next?
Quickstart
Get CryptoPulse running with Docker in under 5 minutes
Installation
Detailed installation guide for local development and production
API Reference
Complete API documentation with examples and error codes
Configuration
Learn about environment variables and customization options