Build a Rate Limiter Service
Build a rate limiting service with multiple algorithms, a dashboard, and a JavaScript SDK.
Requirements
Implement two algorithms: Token Bucket and Sliding WindowHTTP API: POST /check with {key, limit, window} returning {allowed, remaining, resetAt}Dashboard showing: active keys, request counts, blocked requestsReal-time chart of requests per secondConfigurable rate limits per key via dashboardIn-memory storage with optional Redis (abstract storage layer)JavaScript SDK for easy integrationTechnical Notes
Use Next.js API routes. Token bucket: refill tokens at fixed rate. Sliding window: count requests in rolling time window.
Bonus Points
Distributed rate limiting with RedisRate limit headers in responses (X-RateLimit-*)Burst allowance configuration