Rate Limiting for Hono on Cloudflare Workers
The official documentation and examples felt outdated or overly complex, so I’ve created and use this instead.
Note
This repository is featured in the official Cloudflare documentation.
It has been reviewed by the Cloudflare and Hono teams, so you can safely use this.
This is not published as an npm package. It would feel like a wrapper around a wrapper.
Just copy the code directly into your project if needed.
The API response types used here follow my personal convention.
You are free to modify or remove them to fit your own needs.
Copy the src/rate-limit.ts
file into your project.
Use Wrangler to generate the type bindings:
wrangler types --env-interface CloudflareBindings
Inspired by elithrar/workers-hono-rate-limit
MIT