Menu

1 / 6

High-Concurrency Distributed Rate Limiter for Node.js & NestJS with Redis

DEV Community: redis·Tarek Mohamed·about 6 hours ago
#3MBuAVMc
#devtoredis#devto#dev#rate#distributed
Reading 0:00
15s threshold

Standard fixed-window rate limiters suffer from boundary burst attacks : a malicious user can send their full quota at 00:59 and another full quota at 01:01 , doubling the allowed rate and overwhelming backend services.

distributed-rate-limiter-node implements an atomic sliding-window log algorithm using optimized Redis Lua scripts, providing microsecond-level accuracy across distributed Node.js and NestJS clusters.

Distributed Rate Limiter for Node.js 🛑⚡

A high-concurrency sliding-window distributed rate limiter middleware for Express and NestJS backends powered by Redis.

Developed by Tarek Mohamed ( @seotarek )

🚀 Key Advantages

Atomic Lua Scripting: Single roundtrip execution prevents race conditions across multiple server instances.

Express & NestJS Decorators: Clean, plug-and-play middleware and guard integration.

Dynamic Tiering: Easily apply different limits for authenticated users, IP addresses, or API keys.

💻 NestJS Example

import { Controller , Get , UseGuards } from ' @nestjs/common '…

Continue reading — create a free account

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