Cloudflare Workers in Hono
From the Hono cheat sheet · Deployment · verified Jul 2026
Cloudflare Workers
Deploy to Cloudflare Workers edge network
typescript
// wrangler.toml
name = "my-hono-app"
main = "src/index.ts"
compatibility_date = "2024-01-01"
[vars]
API_KEY = "dev-key"
// src/index.ts
import { Hono } from 'hono'
type Bindings = {
API_KEY: string
MY_KV: KVNamespace
MY_DB: D1Database
}
const app = new Hono<{ Bindings: Bindings }>()
app.get('/', (c) => {
const apiKey = c.env.API_KEY
return c.json({ key: apiKey })
})
export default app
# Deploy
npx wrangler deploy💡 Use Bindings type for type-safe environment access
⚡ Access bindings via c.env in handlers
📌 .dev.vars for local secrets (add to .gitignore)
🎯 npx wrangler deploy for production