Skip to content
atarashi
Documentation menu

mw/rate-limit

Per-IP request throttling with standard RateLimit headers, for Express, Fastify or Hono.

Provides: middleware:rate-limit

Requires: http

Dependencies

  • express-rate-limit@^7.5.1 (when has('http/express'))
  • @fastify/rate-limit@^10.3.0 (when has('http/fastify'))
  • hono-rate-limiter@^0.4.2 (when has('http/hono'))

What it contributes to other files

FileSlotLine
src/app.ts|jsimportsimport rateLimit from 'express-rate-limit';
src/app.ts|jsmiddlewareapp.use(
src/app.ts|jsimportsimport fastifyRateLimit from '@fastify/rate-limit';
src/app.ts|jsmiddlewareawait app.register(fastifyRateLimit, { max: 100, timeWindow: '1 minute' });
src/app.ts|jsimportsimport { rateLimiter } from 'hono-rate-limiter';
src/app.ts|jsmiddlewareapp.use(

Use it

atarashi new my-app --add mw/rate-limit
atarashi add mw/rate-limit

Version 1.0.0. Format reference: Authoring blueprints.

Part of the atarashi documentation, written and maintained by Gautam Suthar.