depends_on: [00-runtime.md, 05-schema.md] tags: [api, http, rpc, workers] Last updated: 2026-07-10
Bun detects the fetch export automatically and calls Bun.serve():
import { Hono } from "hono";
const app = new Hono();
app.get("/", (c) => c.text("Hello"));
export default app;| Router | Speed | Use case |
|---|---|---|
| RegExpRouter | Fastest | Static route set |
| LinearRouter | Second | Per-request initialisation (ISR) |
| SmartRouter | Auto | Default, picks the best |
- Type safety covers request, response, error, and middleware (Hono RPC covers only request and response)
- Contract-first: define the contract before the implementation
- Framework integration: TanStack Query native
- vs tRPC: type checking 1.6x faster, runtime 2.8x faster, bundle 2x smaller
- Multi-runtime: CF Workers, Deno, Bun, Node
const getPost = os
.use(dbProvider)
.use(requireAuth)
.route({ method: "GET", path: "/post/{id}" })
.input(z.object({ id: z.string() }))
.errors({ NOT_FOUND: { data: z.object({ id: z.string() }) } })
.handler(async ({ input, context }) => {
// context.user is typed
});- Hono: https://hono.dev
- oRPC: https://orpc.dev