Skip to content

Rate Limiting for JavaScript - Hono, Express, Nuxt, H3

Protect your APIs from abuse. Framework-agnostic rate limiting for Hono, Express, H3, Nuxt, and Edge runtimes.

Why @jfungus/ratelimit?

Any Framework

First-class support for Hono, Express, H3/Nitro, and Nuxt. Same API everywhere.

Edge Ready

Works on Cloudflare Workers, Vercel Edge, Deno Deploy, and traditional Node.js servers.

Smart Algorithms

Cloudflare-style sliding window prevents burst attacks. Fixed window also available.

Distributed Storage

In-memory for development. Redis, Cloudflare KV, or Vercel KV for production.

Packages

PackageDescriptionUse Case
@jfungus/ratelimitCore algorithms + MemoryStoreDirect usage, custom integrations
@jfungus/ratelimit-honoHono middlewareHono apps, Cloudflare Workers
@jfungus/ratelimit-expressExpress middlewareExpress.js applications
@jfungus/ratelimit-h3H3/Nitro middlewareNitro servers, standalone H3
@jfungus/ratelimit-nuxtNuxt moduleNuxt 3 applications
@jfungus/ratelimit-unstorageStorage adapterRedis, KV, distributed setups

Quick Example

import { Hono } from "hono";
import { rateLimiter } from "@jfungus/ratelimit-hono";
const app = new Hono();
// 100 requests per minute per IP
app.use(
rateLimiter({
limit: 100,
windowMs: 60 * 1000, // 1 minute
}),
);
app.get("/api/data", (c) => c.json({ success: true }));

Production Ready

// With Redis for distributed deployments
import { createStorage } from "unstorage";
import redisDriver from "unstorage/drivers/redis";
import { createUnstorageStore } from "@jfungus/ratelimit-unstorage";
const store = createUnstorageStore({
storage: createStorage({
driver: redisDriver({ url: process.env.REDIS_URL }),
}),
});
app.use(rateLimiter({ limit: 100, windowMs: 60 * 1000, store })); // 1 minute