Skip to main content

Fastify

This guide will help you quickly set up and integrate rate limiting into your Fastify application.

Example

import { fastifyRateLimiter } from "@radioac7iv/rate-limiter";

const rateLimit = fastifyRateLimiter({
key: (req) => req.ip as string,
message: "You have exceeded the rate limit",
headersType: "draft-7",
logs: {
directory: "./logs",
},
limitOptions: () => {
return { max: 5, window: 10 };
},
});