Gathering detailed insights and metrics for koa-simple-ratelimit
Gathering detailed insights and metrics for koa-simple-ratelimit
Gathering detailed insights and metrics for koa-simple-ratelimit
Gathering detailed insights and metrics for koa-simple-ratelimit
npm install koa-simple-ratelimit
Typescript
Module System
Min. Node Version
Node Version
NPM Version
TypeScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
17 Stars
313 Commits
5 Forks
2 Watchers
2 Branches
5 Contributors
Updated on Oct 02, 2021
Latest Version
5.1.1
Package Id
koa-simple-ratelimit@5.1.1
Unpacked Size
9.78 kB
Size
3.81 kB
File Count
5
NPM Version
7.24.1
Node Version
16.10.0
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
Rate limiter middleware for koa v2. Differs from koa-ratelimit by not depending on ratelimiter and using redis ttl (time to live) to handle expiration time remaining. This creates only one entry in redis instead of the three that node-ratelimiter does.
1npm install koa-simple-ratelimit
1import Koa from 'koa'; 2import redis from 'redis'; 3 4import { ratelimit } from 'koa-simple-ratelimit'; 5 6const app = new Koa(); 7 8// Apply rate limit 9 10app.use(ratelimit({ 11 db: redis.createClient(), 12 duration: 60000, 13 max: 100 14})); 15 16// Response middleware 17 18app.use((ctx, next) => { 19 ctx.body = 'Stuff!'; 20 return next(); 21}); 22 23app.listen(4000); 24console.log('listening on port http://localhost:4000');
db
redis connection instancemax
max requests within duration
[2500]duration
of limit in milliseconds [3600000]id
id to compare requests [ip]allowlist
array of ids to allowlistblocklist
array of ids to blocklistprefix
redis key prefix ["limit"]Example 200 with header fields:
HTTP/1.1 200 OK
X-Powered-By: koa
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 99
X-RateLimit-Reset: 1384377793
Content-Type: text/plain; charset=utf-8
Content-Length: 6
Date: Wed, 13 Nov 2013 21:22:13 GMT
Connection: keep-alive
Stuff!
Example 429 response:
HTTP/1.1 429 Too Many Requests
X-Powered-By: koa
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1384377716
Content-Type: text/plain; charset=utf-8
Content-Length: 39
Retry-After: 7
Date: Wed, 13 Nov 2013 21:21:48 GMT
Connection: keep-alive
Rate limit exceeded, retry in 8 seconds
MIT
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/30 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
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
18 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