https://github.com/0xradioac7iv/rate-limiter
Rate Limiting Middleware Library for Express & Fastify
https://github.com/0xradioac7iv/rate-limiter
express fastify fastify-plugin nodejs npm npm-package rate-limiter rate-limiting
Last synced: 12 months ago
JSON representation
Rate Limiting Middleware Library for Express & Fastify
- Host: GitHub
- URL: https://github.com/0xradioac7iv/rate-limiter
- Owner: 0xRadioAc7iv
- License: mit
- Created: 2024-12-19T14:10:24.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-03-02T13:30:49.000Z (over 1 year ago)
- Last Synced: 2025-03-02T14:28:50.916Z (over 1 year ago)
- Topics: express, fastify, fastify-plugin, nodejs, npm, npm-package, rate-limiter, rate-limiting
- Language: TypeScript
- Homepage: https://rate-limiter.0xradioactiv.xyz
- Size: 853 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Rate Limiter ๐
A lightweight and efficient rate-limiting library for Node.js, designed to help developers control API request rates and prevent abuse.
## Features
- โ
In-memory, Redis & Mongo Support
- โ
Dynamic Rate Limiting
- โ
Supports Express, Fastify & NestJS
## Setup
### Installation
```bash
npm install @radioac7iv/rate-limiter
```
### Usage
Basic example using Express:
```typescript
import express from "express";
import { expressRateLimiter } from "@radioac7iv/rate-limiter";
const app = express();
const rateLimit = expressRateLimiter({
limitOptions: () => {
return { max: 5, window: 10 };
},
});
app.use(rateLimit);
app.get("/", (request, response) => {
response.status(200).send({ message: "Hello!" });
});
app.listen(3000, () => {
console.log("Server started at PORT: 3000");
});
```
### ๐ Documentation
Detailed usage, configuration options, and examples are available in the official documentation:
[Read the Docs](https://rate-limiter.0xradioactiv.xyz/)
### ๐ค Contributing
Contributions are welcome! To get started:
1. Fork the repository
2. Clone your fork
3. Install dependencies:
```bash
npm install
```
4. Create a new branch:
```bash
git checkout -b feature-name
```
5. Make your changes & commit:
```bash
git commit -m "Add new feature"
```
6. Push & open a PR:
```bash
git push origin feature-name
```
Read the full Contribution Guidelines [here](./CONTRIBUTING.md)
### ๐งช Testing
To run the tests:
```bash
cd package
npm test
```
To get coverage report:
```bash
npm run test:cov
```
### ๐ License
This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for details.