Menu

I built a production-ready rate limiter for Node.js with multiple algorithms and Redis support
πŸ–ΌοΈ

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

DEV CommunityΒ·Zayn41Β·6 months ago
#Bbkmpbx0
#node#typescript#backend#javascript#rate
Reading 0:00
15s threshold

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…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.