Feat/redis rate limiter#343
Open
AugistineCreates wants to merge 4 commits into
Open
Conversation
AugistineCreates
force-pushed
the
feat/redis-rate-limiter
branch
from
July 16, 2026 07:46
5635106 to
ef1122c
Compare
Contributor
|
Hi 👋 Appreciate this PR! The CI is flagging a failing check — could you take a peek at the failed job and push a fix? Happy to help if you need a hand 🙏 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #212
This PR migrates the process-local
Maprate limiter insidecreateRateLimitermiddleware to a Redis Sorted Set (ZSET) sliding-window rate limiter, allowing the backend to scale across multiple replicas, share state, and maintain limits through process restarts.Changes
MULTItransaction containingZREMRANGEBYSCORE,ZADD,ZRANGE(with scores to retrieve the oldest request timestamp for header reset computation),ZCARD, andEXPIREper unique IP client key.RedisServiceto the middleware factory in bothmain.tsandsecurity.e2e-spec.ts.@prisma/clientto a lightweight proxy mock during test compilation to support local offline runs without requiring connections to external Prisma engine binaries.AppModulecontext (with BullMQ workers/queues, database pools, and scheduler jobs), solving local open handles and thread hangs.429 Too Many Requestsalong with the correct rate-limiting headers.500 Internal Server Error.