@wnodex/rate-limit 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
 
2
- > @wnodex/rate-limit@0.2.1 build /home/runner/work/wnodex/wnodex/packages/rate-limit
2
+ > @wnodex/rate-limit@0.2.2 build /home/runner/work/wnodex/wnodex/packages/rate-limit
3
3
  > rolldown -c && tsc
4
4
 
5
5
  [log] <DIR>/index.js chunk │ size: 1.69 kB
6
6
  [log]
7
- [success] rolldown v1.0.0-rc.1 Finished in 31.88 ms
7
+ [success] rolldown v1.0.0-rc.1 Finished in 17.78 ms
package/README.md CHANGED
@@ -1,14 +1,77 @@
1
1
  # @wnodex/rate-limit
2
2
 
3
- wnodex rate-limit middleware
3
+ > wnodex rate-limit middleware
4
4
 
5
- ---
5
+ Part of the [wnodex](https://github.com/wnodex/wnodex) ecosystem, this package provides rate limiting middleware to protect your application from abuse.
6
6
 
7
- ## Table of Content
7
+ ## About
8
8
 
9
- - [License](#license)
9
+ `@wnodex/rate-limit` integrates `express-rate-limit` to limit repeated requests to public APIs and/or endpoints such as password reset. It helps prevent brute-force attacks and denial-of-service attacks.
10
10
 
11
- ---
11
+ ## Features
12
+
13
+ - Easy to configure rate limiting for all routes.
14
+ - Sensible defaults for immediate protection.
15
+ - Fully customizable window, limit, and message.
16
+ - Integrated into the central `wnodex` configuration.
17
+
18
+ ## Why use it?
19
+
20
+ Protecting your application from excessive requests is essential for maintaining service availability and security. This package offers a simple, configuration-driven way to apply rate limiting, using a widely trusted library, without cluttering your application code.
21
+
22
+ ## Installation
23
+
24
+ You can install the package using your favorite package manager:
25
+
26
+ **pnpm**
27
+
28
+ ```bash
29
+ pnpm add @wnodex/rate-limit
30
+ ```
31
+
32
+ **npm**
33
+
34
+ ```bash
35
+ npm install @wnodex/rate-limit
36
+ ```
37
+
38
+ **yarn**
39
+
40
+ ```bash
41
+ yarn add @wnodex/rate-limit
42
+ ```
43
+
44
+ **bun**
45
+
46
+ ```bash
47
+ bun add @wnodex/rate-limit
48
+ ```
49
+
50
+ ## Usage
51
+
52
+ `@wnodex/rate-limit` is enabled by default with a limit of 100 requests per 15 minutes. You can customize these settings or disable it entirely.
53
+
54
+ ```typescript
55
+ import { Wnodex } from 'wnodex';
56
+
57
+ // Example: Customize rate limit settings
58
+ const server = new Wnodex({
59
+ rateLimit: {
60
+ windowMs: 60 * 1000, // 1 minute
61
+ max: 20, // 20 requests per minute
62
+ message: 'Too many requests from this IP, please try again after a minute',
63
+ },
64
+ });
65
+
66
+ // Example: Disable rate limiting
67
+ const serverWithoutRateLimit = new Wnodex({
68
+ rateLimit: false,
69
+ });
70
+
71
+ server.start();
72
+ ```
73
+
74
+ The options object is passed directly to the `express-rate-limit` library.
12
75
 
13
76
  ## License
14
77
 
package/package.json CHANGED
@@ -1,10 +1,16 @@
1
1
  {
2
2
  "name": "@wnodex/rate-limit",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "private": false,
5
- "description": "wnodex rate-limit middleware",
5
+ "description": "A wnodex middleware that integrates express-rate-limit to protect applications from abuse.",
6
6
  "keywords": [
7
- "wnodex"
7
+ "wnodex",
8
+ "middleware",
9
+ "rate-limit",
10
+ "express",
11
+ "security",
12
+ "ddos",
13
+ "brute-force"
8
14
  ],
9
15
  "homepage": "https://github.com/wnodex/wnodex#readme",
10
16
  "bugs": {
@@ -38,7 +44,7 @@
38
44
  "@types/node": "^25.0.10",
39
45
  "rolldown": "1.0.0-rc.1",
40
46
  "typescript": "5.9.2",
41
- "@wnodex/typescript-config": "0.2.1"
47
+ "@wnodex/typescript-config": "0.2.2"
42
48
  },
43
49
  "publishConfig": {
44
50
  "access": "public"