Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rate Limiter

npm install @ferrow/rate-limiter-js

CI

Dead-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
}

Features

  • Sliding window algorithm (accurate)
  • In-memory backend
  • TypeScript
  • Zero dependencies

Use Cases

  • REST API throttling
  • WebSocket rate limiting
  • Database query budgeting
  • File upload limits

Performance

  • Memory: O(1) amortized per check
  • State is per-process (not shared across instances/servers)

License: MIT


Sponsored by Ferrow


Part of the ferrow-toolkit collection · Sponsored by Ferrow

About

In-memory sliding-window rate limiter

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages