Gathering detailed insights and metrics for @casual-simulation/rate-limit-redis
Gathering detailed insights and metrics for @casual-simulation/rate-limit-redis
Gathering detailed insights and metrics for @casual-simulation/rate-limit-redis
Gathering detailed insights and metrics for @casual-simulation/rate-limit-redis
Casual Open Simulation for the Web
npm install @casual-simulation/rate-limit-redis
Typescript
Module System
Node Version
NPM Version
71.8
Supply Chain
99.3
Quality
82.9
Maintenance
100
Vulnerability
100
License
TypeScript (67.12%)
JavaScript (27.4%)
TeX (3.8%)
Vue (1.24%)
CSS (0.27%)
HTML (0.1%)
Shell (0.04%)
SCSS (0.02%)
Dockerfile (0.01%)
Total Downloads
13,669
Last Day
4
Last Week
9
Last Month
160
Last Year
4,878
NOASSERTION License
53 Stars
14,101 Commits
10 Forks
7 Watchers
268 Branches
13 Contributors
Updated on Jun 30, 2025
Minified
Minified + Gzipped
Latest Version
3.4.0
Package Id
@casual-simulation/rate-limit-redis@3.4.0
Unpacked Size
25.56 kB
Size
8.01 kB
File Count
20
NPM Version
lerna/8.0.0/node@v18.20.7+x64 (linux)
Node Version
18.20.7
Published on
Apr 05, 2025
Cumulative downloads
Total Downloads
4
rate-limit-redis
A redis
store for the
express-rate-limit
middleware.
From the npm registry:
1# Using npm 2> npm install rate-limit-redis 3# Using yarn or pnpm 4> yarn/pnpm add rate-limit-redis
From Github Releases:
1# Using npm 2> npm install https://github.com/wyattjoh/rate-limit-redis/releases/download/v{version}/rate-limit-redis.tgz 3# Using yarn or pnpm 4> yarn/pnpm add https://github.com/wyattjoh/rate-limit-redis/releases/download/v{version}/rate-limit-redis.tgz
Replace {version}
with the version of the package that you want to your, e.g.:
3.0.0
.
This library is provided in ESM as well as CJS forms, and works with both Javascript and Typescript projects.
This package requires you to use Node 14 or above.
Import it in a CommonJS project (type: commonjs
or no type
field in
package.json
) as follows:
1const RedisStore = require('rate-limit-redis');
Import it in a ESM project (type: module
in package.json
) as follows:
1import RedisStore from 'rate-limit-redis';
To use it with a node-redis
client:
1import rateLimit from 'express-rate-limit';
2import RedisStore from 'rate-limit-redis';
3import { createClient } from 'redis';
4
5// Create a `node-redis` client
6const client = createClient({
7 // ... (see https://github.com/redis/node-redis/blob/master/docs/client-configuration.md)
8});
9// Then connect to the Redis server
10await client.connect();
11
12// Create and use the rate limiter
13const limiter = rateLimit({
14 // Rate limiter configuration
15 windowMs: 15 * 60 * 1000, // 15 minutes
16 max: 100, // Limit each IP to 100 requests per `window` (here, per 15 minutes)
17 standardHeaders: true, // Return rate limit info in the `RateLimit-*` headers
18 legacyHeaders: false, // Disable the `X-RateLimit-*` headers
19
20 // Redis store configuration
21 store: new RedisStore({
22 sendCommand: (...args: string[]) => client.sendCommand(args),
23 }),
24});
25app.use(limiter);
To use it with a ioredis
client:
1import rateLimit from 'express-rate-limit';
2import RedisStore from 'rate-limit-redis';
3import RedisClient from 'ioredis';
4
5// Create a `ioredis` client
6const client = new RedisClient();
7// ... (see https://github.com/luin/ioredis#connect-to-redis)
8
9// Create and use the rate limiter
10const limiter = rateLimit({
11 // Rate limiter configuration
12 windowMs: 15 * 60 * 1000, // 15 minutes
13 max: 100, // Limit each IP to 100 requests per `window` (here, per 15 minutes)
14 standardHeaders: true, // Return rate limit info in the `RateLimit-*` headers
15 legacyHeaders: false, // Disable the `X-RateLimit-*` headers
16
17 // Redis store configuration
18 store: new RedisStore({
19 // @ts-expect-error - Known issue: the `call` function is not present in @types/ioredis
20 sendCommand: (...args: string[]) => client.call(...args),
21 }),
22});
23app.use(limiter);
sendCommand
The function used to send commands to Redis. The function signature is as follows:
1(...args: string[]) => Promise<number> | number
The raw command sending function varies from library to library; some are given below:
Library | Function |
---|---|
node-redis | async (...args: string[]) => client.sendCommand(args) |
ioredis | async (...args: string[]) => client.call(...args) |
handy-redis | async (...args: string[]) => client.nodeRedis.sendCommand(args) |
tedis | async (...args: string[]) => client.command(...args) |
redis-fast-driver | async (...args: string[]) => client.rawCallAsync(args) |
yoredis | async (...args: string[]) => (await client.callMany([args]))[0] |
noderis | async (...args: string[]) => client.callRedis(...args) |
prefix
The text to prepend to the key in Redis.
Defaults to rl:
.
resetExpiryOnChange
Whether to reset the expiry for a particular key whenever its hit count changes.
Defaults to false
.
MIT © Wyatt Johnson
No vulnerabilities found.
Reason
30 commit(s) and 20 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
packaging workflow detected
Details
Reason
project is fuzzed
Details
Reason
license file detected
Details
Reason
binaries present in source code
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
security policy file not detected
Details
Reason
no SAST tool detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
29 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-23
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 MoreLast Day
0%
4
Compared to previous day
Last Week
-90.4%
9
Compared to previous week
Last Month
-79.4%
160
Compared to previous month
Last Year
-39.4%
4,878
Compared to previous year