Summary
Provide an official rate limiting recipe with documentation and a reference middleware implementation. No mainstream framework bundles rate limiting internally — all provide it as a recipe or middleware pattern.
Competitive context
| Framework |
Rate Limiting |
| Next.js |
Recipe (Upstash/Redis in middleware.ts) |
| SvelteKit |
User implements in hooks.server.js |
| Astro |
User implements in onRequest middleware |
| Fresh |
User implements in _middleware.ts |
| openElement |
Zero documentation or templates |
Proposed deliverable
-
Recipe doc (docs/integrations/rate-limiting.md):
- In-memory sliding window (dev/single-instance)
- Upstash Redis (production/multi-instance)
- Deno KV (Deno Deploy)
-
Reference middleware (not a package — a documented pattern):
// app/middleware/rate-limit.ts
export function rateLimit(opts: { window: number; max: number }) {
const store = new Map<string, { count: number; reset: number }>();
return async (c, next) => {
const key = c.req.header('x-forwarded-for') || 'unknown';
// ... sliding window check
if (exceeded) return c.text('Too Many Requests', 429);
await next();
};
}
- Integration point: document how to attach via
_middleware.ts (existing Hono middleware seam)
Non-goals
- No
@openelement/rate-limit package
- No built-in Redis/KV dependency
- No per-route configuration API (use Hono middleware composition)
Target version
0.43.0 (documentation + recipe)
Summary
Provide an official rate limiting recipe with documentation and a reference middleware implementation. No mainstream framework bundles rate limiting internally — all provide it as a recipe or middleware pattern.
Competitive context
Proposed deliverable
Recipe doc (
docs/integrations/rate-limiting.md):Reference middleware (not a package — a documented pattern):
_middleware.ts(existing Hono middleware seam)Non-goals
@openelement/rate-limitpackageTarget version
0.43.0 (documentation + recipe)