# Cloudflare Hono

> Wire Cloudflare Workers Env typings into Hono apps. Use when working in Cloudflare Workers + Hono, when the user mentions wrangler types, worker-configuration.d.ts, or typing Bindings/Env in Hono.

- Skill: `majiayu000/cloudflare-hono` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds add majiayu000/cloudflare-hono`
- Raw SKILL.md: https://api.skillmd.com/api/skills/majiayu000/cloudflare-hono/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: majiayu000 (https://skillmd.com/u/majiayu000)
- Updated: 2026-09-09
- Page: https://skillmd.com/skills/majiayu000/cloudflare-hono

---


# Cloudflare Hono Env Typing

## Quick start

Use the Env type generated by `wrangler types` from `apps/api/worker-configuration.d.ts`, then pass it into Hono's generics.

```
import type { Env } from "../worker-configuration";
import { Hono } from "hono";

export const domainWorkersRouter = new Hono<{ Bindings: Env }>();
```

## Workflow

1. Generate or update typings:
   - Run `wrangler types` in `apps/api` (this creates/updates `apps/api/worker-configuration.d.ts`).
2. Import the Env type from `apps/api/worker-configuration.d.ts`:
   - `import type { Env } from "../worker-configuration";`
3. Thread Env into Hono:
   - `new Hono<{ Bindings: Env }>()`
4. Use typed bindings via `c.env`:
   - `const db = c.env.ZEROSPIN_DATABASE`

## Notes

- Keep the Env import as a type-only import.
- The `worker-configuration.d.ts` file is generated; do not hand-edit it.
- If the file path changes, update the import path in routes/modules accordingly.

## Example route snippet

```
import type { Env } from "../worker-configuration";
import { Hono } from "hono";

export const domainWorkersRouter = new Hono<{ Bindings: Env }>();

domainWorkersRouter.get("/", (c) => {
  const db = c.env.ZEROSPIN_DATABASE;
  return c.json({ ok: true, hasDb: Boolean(db) });
});
```

