Hono Complete Guide — Getting Started with the Ultrafast Multi-Runtime Web Framework [2026]
Hono is a zero-dependency, sub-12KB, Web Standards-based TypeScript-first web framework. The same code runs on Cloudflare Workers, Deno, Bun, and Node.js with 9M+ weekly downloads. Complete guide from setup to production.
What is Hono? — The Ultra-Lightweight, Ultra-Fast Web Framework
Hono is a zero-dependency, sub-12KB, Web Standards-based TypeScript-first web framework. Development began in December 2021 by Yusuke Wada, inspired by Cloudflare Workers. The name means "flame" in Japanese, reflecting its blazing-fast performance. As of 2026, Hono surpasses 9M weekly downloads, 28K+ GitHub stars, and is used internally by Cloudflare in production.
Why Hono? — Key Features
Hono's rapid adoption is driven by features that set it apart from other frameworks. The table below summarizes its core strengths.
| Feature | Details |
|---|---|
| Zero dependencies | hono/tiny is under 12KB — no external packages needed |
| Web Standards compliant | Uses native Request/Response objects directly |
| TypeScript-first | No @types/hono needed — type definitions are built-in |
| Multi-runtime | Same code runs on CF Workers, Deno, Bun, and Node.js |
| End-to-end type safety | RPC mode shares types between client and server |
| Blazing-fast routing | RegExpRouter (Trie-based) achieves ~840K req/s |
| Middleware ecosystem | 100+ official and third-party middleware available |
Supported Runtimes
Hono supports the following runtimes and platforms. Migrating between them requires only selecting the appropriate build adapter.
| Runtime / Platform | Adapter | Notes |
|---|---|---|
| Cloudflare Workers | Native | Most recommended environment |
| Cloudflare Pages | hono/cloudflare-pages | Frontend integration |
| Deno | hono/deno | Uses Deno.serve |
| Bun | hono/bun | Uses Bun.serve |
| Node.js | @hono/node-server | Express replacement |
| AWS Lambda | hono/aws-lambda | Serverless |
| Lambda@Edge | hono/lambda-edge | CDN edge execution |
| Vercel | hono/vercel | Edge Functions support |
| Netlify | hono/netlify | Edge Functions support |
| Fastly Compute | hono/fastly | Wasm runtime |
Getting Started — Set Up in 5 Minutes
Getting started with Hono is straightforward. A single `npm create hono@latest` command interactively scaffolds your project.
npm create hono@latest my-app
# Select a template:
# cloudflare-workers
# cloudflare-pages
# deno
# bun
# nodejs
# aws-lambda
# vercel
# netlify
# fastly
cd my-app
npm install
npm run devWith the Cloudflare Workers template selected, `wrangler dev` starts and your app is available at `http://localhost:8787`.
Hello World — Basic Code Structure
Below is the simplest Hono application. Developers familiar with Express or Fastify will find the API intuitive.
import { Hono } from 'hono'
const app = new Hono()
// Text response
app.get('/', (c) => c.text('Hello Hono!'))
// JSON response with path parameter
app.get('/api/users/:id', (c) => {
const id = c.req.param('id')
return c.json({ id, name: 'Alice' })
})
// POST handler
app.post('/api/users', async (c) => {
const body = await c.req.json()
return c.json({ created: true, data: body }, 201)
})
export default appRouting in Depth — Path Params, Queries, Grouping
Hono's routing is intuitive yet powerful, supporting path parameters, query strings, wildcards, and route grouping.
import { Hono } from 'hono'
const app = new Hono()
// Path parameter
app.get('/users/:id', (c) => {
const id = c.req.param('id')
return c.json({ id })
})
// Multiple path parameters
app.get('/posts/:postId/comments/:commentId', (c) => {
const { postId, commentId } = c.req.param()
return c.json({ postId, commentId })
})
// Query string
app.get('/search', (c) => {
const q = c.req.query('q')
const page = c.req.query('page') ?? '1'
return c.json({ q, page })
})
// Wildcard
app.get('/files/*', (c) => c.text('File route'))
// Route grouping
const api = new Hono()
api.get('/users', (c) => c.json([]))
api.post('/users', (c) => c.json({}, 201))
app.route('/api/v1', api)The Context Object (c) — Request and Response Handling
The context object `c` is central to every Hono handler. It provides unified access to request data and response helpers.
app.get('/demo', async (c) => {
// Request info
const method = c.req.method // 'GET'
const url = c.req.url // Full URL
const header = c.req.header('x-custom') // Custom header
// Response types
return c.json({ message: 'JSON response' }) // JSON
return c.text('Plain text') // Text
return c.html('<h1>Hello HTML</h1>') // HTML
return c.redirect('/new-path', 301) // Redirect
return c.body(stream, { headers: {...} }) // Stream
})Middleware Overview — Built-in Middleware List
Hono ships with essential production-ready middleware out of the box, covering most use cases without additional packages.
| Middleware | Import Path | Purpose |
|---|---|---|
| logger | hono/logger | HTTP access logging |
| cors | hono/cors | CORS control |
| basicAuth | hono/basic-auth | Basic authentication |
| jwt | hono/jwt | JWT verification |
| bearerAuth | hono/bearer-auth | Bearer token auth |
| cache | hono/cache | Response caching |
| compress | hono/compress | gzip/Brotli compression |
| csrf | hono/csrf | CSRF token validation |
| etag | hono/etag | ETag headers |
| prettyJSON | hono/pretty-json | Formatted JSON output |
| secureHeaders | hono/secure-headers | Security headers |
| timeout | hono/timeout | Request timeout control |
| validator | hono/validator | Request validation |
Middleware in Practice
import { Hono } from 'hono'
import { logger } from 'hono/logger'
import { cors } from 'hono/cors'
import { jwt } from 'hono/jwt'
const app = new Hono()
// Global middleware
app.use('*', logger())
app.use('*', cors({ origin: 'https://example.com' }))
// JWT auth for specific routes
const secret = 'your-secret-key'
app.use('/api/*', jwt({ secret }))
app.get('/api/profile', (c) => {
const payload = c.get('jwtPayload')
return c.json({ userId: payload.sub })
})
export default appReal-World Production Use Cases
Hono is deployed in production across the globe. Here are some notable adoption examples.
| Company / Project | Use Case |
|---|---|
| Cloudflare | Internal APIs and official Workers examples |
| Upstash | Edge-compatible Redis/Kafka client APIs |
| Ponder.ly | Real-time event tracking API |
| IntelliQ | High-throughput AI proxy API |
| ActorCore | Game backend edge execution |
Benchmark Performance — vs Express and Fastify
In Cloudflare Workers benchmarks, Hono records approximately 840,000 req/s — roughly 10x Express (Node.js) and 3x Fastify. This performance is achieved through its Trie-based RegExpRouter, which keeps routing computation at O(log n) or below.
| Framework | req/s (approx.) | Environment |
|---|---|---|
| Hono | ~840,000 | Cloudflare Workers |
| Fastify | ~60,000 | Node.js |
| Express | ~15,000 | Node.js |
| Koa | ~20,000 | Node.js |
Hono v4 Highlights — SSG, Client Components, File-based Routing
Hono v4 introduced major full-stack capabilities: - Static Site Generation (SSG): Use `toSSG()` to pre-render static files at build time for CDN delivery - Client Components: Build JSX-based UI components with `hono/jsx`. Supports Island Architecture for Partial Hydration - File-based Routing: HonoX enables Next.js-style filesystem routing - RPC Mode: `hc()` helper auto-shares types between client and server — combine with Zod for complete type safety
What to Learn Next — RPC Mode, HonoX, Cloudflare Workers
Once you have mastered the basics, the following topics are recommended next steps: 1. RPC Mode: Call server functions type-safely from the client using the `hc()` helper 2. HonoX: A Vite-based full-stack framework with file-based routing and Island Architecture 3. Cloudflare Workers Integration: Build serverless backends with D1, KV, R2, and Workers AI 4. Zod Validation: `@hono/zod-validator` provides simultaneous request validation and type inference 5. Testing: The `app.request()` method allows unit tests without spinning up an HTTP server
Frequently Asked Questions (FAQ)
Q1. Can Hono replace Express? Yes. Using the `@hono/node-server` adapter, Hono works as a drop-in Express replacement on Node.js. The API design is similar, keeping migration costs low. Q2. Does Hono support GraphQL? Yes. The `@hono/graphql-server` package enables GraphQL API development and can serve as an Apollo Server alternative. Q3. Can I use Hono without TypeScript? Yes, but Hono is designed TypeScript-first. To get the most out of its type inference and autocompletion, TypeScript is strongly recommended. Q4. How many routers does Hono have? Five: SmartRouter (default, auto-selects the best), RegExpRouter (fastest), TrieRouter (memory-efficient), LinearRouter (for small apps), and PatternRouter (simple implementation). Q5. Does Hono include an ORM? No, but it integrates seamlessly with Drizzle ORM, Prisma, Cloudflare D1, and other database libraries. Q6. How do I handle sessions? Use `hono/cookie` for Cookie management. Sessions are typically implemented with Cloudflare KV or Redis (Upstash). Q7. Can I use Hono with Auth.js (NextAuth)? A Hono adapter for Auth.js is under development. For custom implementations, combining `hono/jwt` and `hono/cookie` is the recommended approach.
Build Fast Hono Applications with Oflight
Oflight provides design, development, and operational support for edge APIs built on Hono and Cloudflare Workers. From greenfield ultra-fast web services to migrating existing Node.js apps to Hono, we cover the full spectrum. Pricing starts from $3,000 USD for initial consulting engagements. Feel free to reach out for a consultation. Explore our Software Development Services
Feel free to contact us
Contact Us