Hono Middleware (@universal-rate-limit/hono)
Hono middleware adapter for universal-rate-limit.

Hono middleware for universal-rate-limit — a zero-dependency rate limiter built on web standards. Supports fixed-window, sliding-window, and token-bucket algorithms, pluggable stores (memory, Redis, or your own), and IETF-compliant rate limit headers out of the box. Works on Node.js, Bun, Deno, Cloudflare Workers, and other edge runtimes.
Try the playground to see rate limiting in action.
Install
npm install @universal-rate-limit/honoUsage
import { Hono } from 'hono';
import { honoRateLimit } from '@universal-rate-limit/hono';
const app = new Hono();
// Apply to all routes
app.use(
honoRateLimit({
algorithm: { type: 'sliding-window', windowMs: 60_000 }, // 1 minute
limit: 60 // 60 requests per window
})
);
// Or apply to specific routes
app.use(
'/api/*',
honoRateLimit({
algorithm: { type: 'sliding-window', windowMs: 60_000 },
limit: 30
})
);
export default app;Options
Accepts all core options — limit, algorithm, cost, store, keyGenerator, skip, handler, message, statusCode, headers, legacyHeaders, failOpen, and prefix.
Example
See examples/hono for a complete working app with integration tests.
Documentation
License
MIT