Gathering detailed insights and metrics for express-limit
Gathering detailed insights and metrics for express-limit
Gathering detailed insights and metrics for express-limit
Gathering detailed insights and metrics for express-limit
express-rate-limit
Basic IP rate-limiting middleware for Express. Use to limit repeated requests to public APIs and/or endpoints such as password reset.
@types/express-rate-limit
Stub TypeScript definitions entry for express-rate-limit, which provides its own types definitions
rate-limit-redis
A Redis store for the `express-rate-limit` middleware
@nestjs/throttler
A Rate-Limiting module for NestJS to work on Express, Fastify, Websockets, Socket.IO, and GraphQL, all rolled up into a simple package.
npm install express-limit
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
5 Stars
28 Commits
4 Forks
1 Watchers
2 Branches
2 Contributors
Updated on Dec 01, 2022
Latest Version
1.0.0
Package Id
express-limit@1.0.0
Unpacked Size
18.56 kB
Size
4.32 kB
File Count
13
NPM Version
8.7.0
Node Version
19.3.0
Published on
Jan 22, 2023
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
express-limit is a small project that add rate limitations to your API.
1npm install --save express-limit
1const limit = require("express-limit").limit; 2 3app.get( 4 "/api/users", 5 limit({ 6 max: 5, // 5 requests 7 period: 60 * 1000, // per minute (60 seconds) 8 }), 9 function (req, res) { 10 res.status(200).json({}); 11 } 12);
1{ 2 (max = 60), // Maximum request per period 3 (period = 60 * 1000), // Period in milliseconds 4 (prefix = "rate-limit-"), // Prefix of the key 5 (status = 429), // Status code in case of rate limit reached 6 (message = "Too many requests"), // Message in case of rate limit reached 7 (identifier = (request) => { 8 // The identifier function/value of the key (IP by default, could be "req.user.id") 9 return request.ip || request.ips; // Read from Default properties 10 }), 11 (headers = { 12 // Headers names 13 remaining: "X-RateLimit-Remaining", 14 reset: "X-RateLimit-Reset", 15 limit: "X-RateLimit-Limit", 16 }), 17 (store = new Store()); // The storage, default storage: in-memory 18}
In some cases, you could want to skip the limitation you made for trusted client. In this case, you can add a special field in the request object:
1req._skip_limits = true;
Also, you could want to add specific limitations for a special client. In this case, you can add a special field in the request object:
1req._custom_limits = { 2 max: 1000, // 1000 requests 3 period: 60 * 1000, // per minutes 4};
Just don't forget where you place this modification! It could be applied for all routes!
Actually, two stores have been made:
1const RateLimiter = require("express-limit").RateLimiter; 2const InMemoryStore = require("express-limit").InMemoryStore; 3 4const store = new InMemoryStore(); 5 6const limit = (options = {}) => { 7 options.store = store; 8 9 return new RateLimiter(options).middleware; 10}; 11 12app.get( 13 "/api/users", 14 limit({ 15 max: 5, // 5 requests 16 period: 60 * 1000, // per minute (60 seconds) 17 }), 18 function (req, res) { 19 res.status(200).json({}); 20 } 21);
1const redis = require("redis"); 2const client = redis.createClient(); 3 4const RateLimiter = require("express-limit").RateLimiter; 5const RedisStore = require("express-limit").RedisStore; 6 7const store = new RedisStore(client); 8 9const limit = (options = {}) => { 10 options.store = store; 11 12 return new RateLimiter(options).middleware; 13}; 14 15app.get( 16 "/api/users", 17 limit({ 18 max: 5, // 5 requests 19 period: 60 * 1000, // per minute (60 seconds) 20 }), 21 function (req, res) { 22 res.status(200).json({}); 23 } 24);
true
)1const redis = require("redis"); 2const client = redis.createClient({ 3 legacyMode: true, 4}); 5 6const RateLimiter = require("express-limit").RateLimiter; 7const RedisLegacyStore = require("express-limit").RedisLegacyStore; 8 9const store = new RedisLegacyStore(client); 10 11const limit = (options = {}) => { 12 options.store = store; 13 14 return new RateLimiter(options).middleware; 15}; 16 17app.get( 18 "/api/users", 19 limit({ 20 max: 5, // 5 requests 21 period: 60 * 1000, // per minute (60 seconds) 22 }), 23 function (req, res) { 24 res.status(200).json({}); 25 } 26);
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
Found 1/13 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
19 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More