Hono + Cloudflare Workers Bundle
For Developers building APIs on Cloudflare Workers with Hono
A complete CLAUDE.md rules file for Hono on Cloudflare Workers. Covers D1, KV, R2, Queues, RPC mode, middleware, and 8 mistakes every model makes.
Description
Hono's RPC mode is the most hallucinated TypeScript API in the Cloudflare ecosystem — every model gets the client chain wrong. This bundle fixes that plus every other Workers-specific pattern: Bindings/Variables interface, D1 batch queries and transactions, KV with TTL, R2 upload/download, queue consumers, Zod validation, testClient with mock bindings, JWT auth, and geo data. 978 lines of patterns that actually run.
What's included
- CLAUDE.md rules file (978 lines)
- README.md — installation for Claude Code, Cursor, Windsurf, Copilot
- Customization guide
Sample content
RPC client type chain must be exact
The RPC client type is derived from the app's route type. Any mismatch — extra route, missing type export, split app — silently breaks type inference. One app, one type export.
Bindings go on the Hono generic, not process.env
Cloudflare Workers don't have `process.env`. Bindings are on `c.env`. Type them with the `Bindings` interface on the Hono generic. Never use `process.env` in Workers code.
D1 queries return undefined on empty, not null
`db.prepare().first()` returns `undefined` when no row matches, not `null`. Null checks will miss empty results. Always check `=== undefined` or use `.all()` with a length check.
3 of 978 included items previewed above.
Delivery
Instant download after Stripe checkout. File: nightforge-hono-workers-bundle.zip