feat: add server-side rate limiting for API endpoints (#1425) - #1466
Merged
JiyaBatra merged 1 commit intoAug 14, 2026
Merged
Conversation
|
@jayshreerathoreai32-hue is attempting to deploy a commit to the jiya's projects Team on Vercel. A member of the Team first needs to authorize it. |
✅ Deploy Preview for codevibeforyou ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.
Resolves #1425
Description
This PR implements server-side rate limiting for the Express backend using
express-rate-limitto protect API endpoints from abuse, brute-force attacks, excessive automated traffic, and repeated requests.The implementation introduces configurable rate limiters through environment variables and applies them at both the global API level and to sensitive authentication endpoints. Integration tests have also been added to verify that request limits are enforced correctly and that clients receive the expected
429 Too Many Requestsresponse when the limit is exceeded.Changes Included
1. Rate Limiter Middleware Refactor
rateLimiter.jsto useexpress-rate-limitfor request throttling.2. Global API Rate Limiting
generalLimiterfor general API protection./api/*endpoints.3. Authentication Rate Limiting
authLimiterfor sensitive authentication routes such as:4. Environment-Based Configuration
.env.example.5. Automated Integration Tests
server/tests/rateLimiter.test.js.Security & Reliability Improvements
This change adds an additional layer of protection to the backend by limiting how frequently clients can interact with API endpoints.
It helps reduce the impact of:
The stricter authentication limiter provides targeted protection for endpoints where repeated requests can pose a greater security risk.
How to Test
Clone or checkout this branch.
Start the backend server: