DEV Community

Cover image for I built a production-ready rate limiter for Node.js with multiple algorithms and Redis support
Zayn41
Zayn41

Posted on

I built a production-ready rate limiter for Node.js with multiple algorithms and Redis support

Hey everyone 👋

I recently built nexus-limiter, a production-ready rate limiting library for Node.js.

This started as a learning project to understand how different rate limiting algorithms work internally, and grew into a fully usable library with multiple frameworks and storage backends.

🚀 Features
4 rate limiting algorithms:
Token Bucket
Fixed Window
Sliding Window Log
Sliding Window Counter
Framework support:
Express
Fastify
NestJS
Hono
Storage options:
In-memory (with LRU eviction)
Redis (atomic Lua scripts for safety)
Advanced features:
Plugin system (logging, metrics, etc.)
Weighted requests (different cost per endpoint)
Custom key generation
Fail-open strategy
💡 Why I built it

Most libraries I tried were either:

limited to one algorithm
hard to extend
or not flexible across frameworks

So I built this to experiment with a more modular and extensible design.

🔗 Links
npm: https://www.npmjs.com/package/nexus-limiter
GitHub: https://github.com/Zayn41/rate-limiter

Happy to hear feedback, suggestions, or real-world edge cases I might have missed 🙌

Top comments (0)