← marketplace
engineersframeworksha:10096aae3362d54amanual
hono
Use when building fast, lightweight web APIs or edge apps on Cloudflare Workers, Deno, Bun, or Node with a tiny router and Web Standards.
Install confidence
curl --create-dirs -fsSL https://skillmake.xyz/i/hono -o ~/.claude/skills/hono/SKILL.md
Pinned content
sha:10096aae3362d54a
Generated with
manual
Source
hono.dev
The file served at /api/marketplace/hono-10096aae/raw matches this hash. Inspect before install, then copy the command.
4,928 chars · ~1,232 tokens
--- name: hono description: Use when building fast, lightweight web APIs or edge apps on Cloudflare Workers, Deno, Bun, or Node with a tiny router and Web Standards. source: https://hono.dev/docs/ generated: 2026-07-02T18:41:57.070Z category: framework audience: engineers --- ## When to use - Building HTTP APIs or routers on Cloudflare Workers, Deno, Bun, or Node - You need a small, zero-dependency framework built on Web Standard Request/Response - Adding typed middleware, validation, or RPC-style typed clients to a service - Serving edge functions with first-class TypeScript support ## Key concepts ### Hono app instance The core object created with `new Hono()`. You register routes and middleware on it, then export it as the runtime's fetch handler. ### Context (c) The single argument handlers receive. Wraps the request/response and exposes helpers like c.req, c.json(), c.text(), c.env, and c.var for shared state. ### Middleware Functions registered with app.use() that run before/after handlers; they call `await next()` to continue the chain. Built-ins include cors, logger, jwt, basicAuth. ### RPC / typed client Hono can infer route types so the `hc<AppType>()` client gives end-to-end type safety between server and client without code generation. ### Validator Use validator() or @hono/zod-validator to validate body/query/param/header; validated data is read back with c.req.valid('json'). ### Adapters Per-runtime entry points (hono/cloudflare-workers, hono/bun, @hono/node-server, hono/deno) adapt the app to each platform's server API. ## API reference ``` const app = new Hono<{ Bindings: Env }>() ``` Create an app; the generic carries Cloudflare Bindings and Variables types for c.env and c.var. ``` import { Hono } from 'hono' type Bindings = { DB: D1Database } const app = new Hono<{ Bindings: Bindings }>() export default app ``` ``` app.get(path, ...handlers) / app.post / app.put / app.delete / app.all ``` Register a route for an HTTP method. Path supports params (:id), wildcards (*), and regex. ``` app.get('/users/:id', (c) => { const id = c.req.param('id') return c.json({ id }) }) ``` ``` c.json(object, status?, headers?) ``` Return a JSON response with optional status code and headers. ``` app.post('/users', async (c) => { const body = await c.req.json() return c.json({ created: body }, 201) }) ``` ``` c.text(str) / c.html(str) / c.redirect(url, status?) / c.body(data) ``` Return plain text, HTML, a redirect, or a raw body response. ``` app.get('/', (c) => c.text('Hello Hono!')) ``` ``` app.use(path?, middleware) ``` Mount middleware globally or on a path prefix; middleware calls await next(). ``` import { cors } from 'hono/cors' import { logger } from 'hono/logger' app.use(logger()) app.use('/api/*', cors({ origin: 'https://example.com' })) ``` ``` app.route(basePath, subApp) ``` Mount a sub-application under a base path to compose larger apps. ``` const api = new Hono() api.get('/ping', (c) => c.text('pong')) app.route('/api', api) ``` ``` zValidator(target, schema) ``` Validate request data against a Zod schema; read validated data with c.req.valid(target). ``` import { zValidator } from '@hono/zod-validator' import { z } from 'zod' app.post('/u', zValidator('json', z.object({ name: z.string() })), (c) => { const { name } = c.req.valid('json') return c.json({ name }) }) ``` ``` hc<typeof app>(baseUrl) ``` Create a type-safe RPC client inferred from the server app type. ``` import { hc } from 'hono/client' const client = hc<typeof app>('http://localhost:8787') const res = await client.api.ping.$get() ``` ``` c.env / c.var / c.set(key, val) / c.get(key) ``` Access runtime bindings (c.env), shared request-scoped values set by middleware (c.var / c.get / c.set). ``` app.use(async (c, next) => { c.set('user', { id: 1 }); await next() }) app.get('/me', (c) => c.json(c.get('user'))) ``` ## Gotchas - On Node you must use @hono/node-server's serve(); `export default app` only works on Workers/Bun/Deno. - c.req.json()/text()/parseBody() return promises and consume the body once — read it a single time. - Middleware must await next() (and not return early) or downstream handlers and post-processing won't run. - Route order matters: more specific routes should be registered before wildcards/catch-alls. - On Cloudflare Workers, c.env holds bindings — process.env is not available; type it via the Bindings generic. - For RPC type inference to work you must export the app type and avoid breaking it into untyped fragments. - c.executionCtx.waitUntil() is required for background work on Workers; raw promises get cancelled after response. - The default RegExpRouter is fast but some patterns fall back to other routers; avoid overly dynamic regex on hot paths. --- Generated by SkillMake from https://hono.dev/docs/ on 2026-07-02T18:41:57.070Z. Verify against source before relying on details.
File: ~/.claude/skills/hono/SKILL.md