A lightweight and efficient rate-limiting library for Node.js, designed to help developers control API request rates and prevent abuse.
- ✅ In-memory, Redis & Mongo Support
- ✅ Dynamic Rate Limiting
- ✅ Supports Express, Fastify & NestJS
npm install @radioac7iv/rate-limiter
Basic example using Express:
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");
});
Detailed usage, configuration options, and examples are available in the official documentation:
Contributions are welcome! To get started:
-
Fork the repository
-
Clone your fork
-
Install dependencies:
npm install
- Create a new branch:
git checkout -b feature-name
- Make your changes & commit:
git commit -m "Add new feature"
- Push & open a PR:
git push origin feature-name
Read the full Contribution Guidelines here
To run the tests:
cd package
npm test
To get coverage report:
npm run test:cov
This project is licensed under the MIT License. See the LICENSE file for details.