Skip to content

// Build edge-runtime APIs with Hono — routing, middleware, JWT, OpenAPI, runs on Workers/Bun/Deno.

Hono Edge API

skill --stat
  • last update

    Jun 2, 2026

  • license

    MITv1.0.0

  • format

    SKILL.md

quickstart.sh
3 steps
  1. Install

    // Downloads SKILL.md into ~/.claude/skills/hono-edge-api/

    $ curl -fsSL --create-dirs -o ~/.claude/skills/hono-edge-api/SKILL.md https://claudeskil.com/skills/hono-edge-api/SKILL.md
  2. Invoke

    // Inside Claude Code, type the skill name as a slash command

    > /hono-edge-api scaffold a typed REST endpoint
  3. Or copy this from the README

    // extracted ts block

    $ import { Hono } from 'hono'
    import { cors } from 'hono/cors'
    import { jwt } from 'hono/jwt'
    import { zValidator } from '@hono/zod-validator'
    import { z } from 'zod'
    
hono-edge-api/
references
SKILL.md
readonly
name:
Hono Edge API
slug:
hono-edge-api
version:
v1.0.0
license:
MIT
author:
@chiragthummar16
categories:
tags:
#hono#edge#cloudflare-workers#bun#typescript
description:

Build edge-runtime APIs with Hono — routing, middleware, JWT, OpenAPI, runs on Workers/Bun/Deno.

README.md

hono-edge-api/README.md
6 sections

Hono Edge API

Scaffold and ship production HTTP APIs with Hono, a small, fast web framework whose Request/Response-based core runs unchanged across Cloudflare Workers, Bun, Deno, Vercel Edge, Netlify, and AWS Lambda. This skill sets up routing, typed validation, JWT auth, CORS, structured error handling, and OpenAPI docs so you can write the API once and deploy it to whichever runtime you need. It's for backend and full-stack developers who want low-latency edge endpoints without rewriting handlers per platform.

When to use it

  • You're starting a new JSON API and want it portable across Workers/Bun/Deno from day one.
  • You need request validation tied to TypeScript types (via @hono/zod-validator) instead of hand-written checks.
  • You want auto-generated OpenAPI specs and a Swagger UI without maintaining them by hand.
  • You're migrating an Express/Fastify service to the edge and want a familiar middleware model.

How it works

Handlers are registered on a new Hono() app with app.get, .post, etc. Middleware is added with app.use, and Hono ships first-party middleware including cors, jwt (from hono/jwt), logger, and bearerAuth. The context object c exposes c.req, c.json(), c.text(), and c.var for values set by middleware. Validation uses zValidator('json', schema) to parse and type the body/query/params. Errors are centralized with app.onError and HTTPException. For documented APIs, the @hono/zod-openapi package lets you define routes with createRoute so the schema and the OpenAPI document stay in sync; pair it with @hono/swagger-ui.

Usage

bash
curl -fsSL --create-dirs -o ~/.claude/skills/hono-edge-api/SKILL.md https://claudeskil.com/skills/hono-edge-api/SKILL.md
ts
import { Hono } from 'hono'
import { cors } from 'hono/cors'
import { jwt } from 'hono/jwt'
import { zValidator } from '@hono/zod-validator'
import { z } from 'zod'

const app = new Hono()
app.use('/api/*', cors())
app.use('/api/*', jwt({ secret: 'my-secret' }))

app.post(
  '/api/users',
  zValidator('json', z.object({ name: z.string().min(1) })),
  (c) => {
    const { name } = c.req.valid('json')
    return c.json({ id: crypto.randomUUID(), name }, 201)
  }
)

export default app // Workers/Bun/Deno entry

Deploy with wrangler deploy (Workers), bun run, or deno run — the export default app entry works for all three.

Tips & gotchas

  • Read env/secrets from c.env (Workers bindings), not process.env — the latter is empty on most edge runtimes.
  • app.route('/sub', subApp) mounts sub-apps; chain .get().post() on one app to preserve RPC type inference for hono/client.
  • c.req.valid('json') only returns data validated by a zValidator on that route; calling it without the middleware returns nothing.
  • On Workers, defer background work with c.executionCtx.waitUntil() so the response isn't blocked.

FAQ

Does the same code really run everywhere? The core does. Runtime-specific bits (KV, D1, file system, cron) differ, so isolate those behind c.env or adapters.

How do I get a typed client? Export your app's type and use hc<typeof app>(url) from hono/client for end-to-end type-safe calls.

Can I serve OpenAPI? Yes — use @hono/zod-openapi with createRoute and mount @hono/swagger-ui at a route like /docs.

$ cat reviews/

Reviews

// No reviews yet. Be the first.
Loading review form…

$ ls related/

explore all →