Hono — CLAUDE.md
Hono超高速WebフレームワークのCLAUDE.md。エッジファースト設計、ミドルウェア、RPC、Cloudflare Workers/Bun/Deno等マルチランタイム対応。
honojs/hono 21,000
# Hono — CLAUDE.md
## Overview
Hono is a fast, lightweight web framework for the Edges. Runs on Cloudflare Workers, Fastly Compute, Deno, Bun, Vercel, Netlify, AWS Lambda, and Node.js.
## Basic App
```typescript
import { Hono } from 'hono'
const app = new Hono()
app.get('/', (c) => c.text('Hello Hono!'))
app.get('/users/:id', async (c) => {
const id = c.req.param('id')
const user = await getUserById(id)
if (!user) return c.json({ error: 'Not found' }, 404)
return c.json(user)
})
app.post('/users', async (c) => {
const body = await c.req.json()
const user = await createUser(body)
return c.json(user, 201)
})
export default app
```
## Middleware
```typescript
import { logger } from 'hono/logger'
import { cors } from 'hono/cors'
import { bearerAuth } from 'hono/bearer-auth'
app.use('*', logger())
app.use('/api/*', cors())
app.use('/admin/*', bearerAuth({ token: env.API_TOKEN }))
```
## Zod Validator
```typescript
import { zValidator } from '@hono/zod-validator'
import { z } from 'zod'
const schema = z.object({
email: z.string().email(),
name: z.string().min(1),
})
app.post('/users', zValidator('json', schema), async (c) => {
const { email, name } = c.req.valid('json')
return c.json(await createUser({ email, name }))
})
```
## RPC (Type-Safe Client)
```typescript
// Server
const route = app.get('/users/:id',
(c) => c.json({ id: c.req.param('id'), name: 'Alice' })
)
export type AppType = typeof route
// Client (type-safe)
import { hc } from 'hono/client'
const client = hc<AppType>('http://localhost:3000')
const res = await client.users[':id'].$get({ param: { id: '1' } })
```
## Cloudflare Workers
```typescript
// wrangler.toml
// name = "my-worker"
const app = new Hono<{ Bindings: CloudflareBindings }>()
app.get('/kv', async (c) => {
const value = await c.env.MY_KV.get('key')
return c.text(value ?? 'not found')
})
export default app
``` こちらもおすすめ
Backend カテゴリの他のルール
もっとルールを探す
CLAUDE.md、.cursorrules、AGENTS.md、Image Prompts の全 223 ルールをチェック。



