npm install @ferrow/rate-limiter-jsDead-simple, in-memory rate limiting. Sliding window with minimal overhead.
const limiter = new RateLimiter({ maxRequests: 100, windowMs: 60000 });
if (limiter.tryConsume(userId)) {
// Handle request
} else {
// Reject: rate limit exceeded
}- Sliding window algorithm (accurate)
- In-memory backend
- TypeScript
- Zero dependencies
- REST API throttling
- WebSocket rate limiting
- Database query budgeting
- File upload limits
- Memory: O(1) amortized per check
- State is per-process (not shared across instances/servers)
Sponsored by Ferrow
Part of the ferrow-toolkit collection · Sponsored by Ferrow