株式会社オブライト
Software Dev2026-04-08

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.

FeatureDetails
Zero dependencieshono/tiny is under 12KB — no external packages needed
Web Standards compliantUses native Request/Response objects directly
TypeScript-firstNo @types/hono needed — type definitions are built-in
Multi-runtimeSame code runs on CF Workers, Deno, Bun, and Node.js
End-to-end type safetyRPC mode shares types between client and server
Blazing-fast routingRegExpRouter (Trie-based) achieves ~840K req/s
Middleware ecosystem100+ official and third-party middleware available
Loading diagram...

Supported Runtimes

Hono supports the following runtimes and platforms. Migrating between them requires only selecting the appropriate build adapter.

Runtime / PlatformAdapterNotes
Cloudflare WorkersNativeMost recommended environment
Cloudflare Pageshono/cloudflare-pagesFrontend integration
Denohono/denoUses Deno.serve
Bunhono/bunUses Bun.serve
Node.js@hono/node-serverExpress replacement
AWS Lambdahono/aws-lambdaServerless
Lambda@Edgehono/lambda-edgeCDN edge execution
Vercelhono/vercelEdge Functions support
Netlifyhono/netlifyEdge Functions support
Fastly Computehono/fastlyWasm 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.

bash
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 dev

With 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.

ts
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 app

Routing in Depth — Path Params, Queries, Grouping

Hono's routing is intuitive yet powerful, supporting path parameters, query strings, wildcards, and route grouping.

ts
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.

ts
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.

MiddlewareImport PathPurpose
loggerhono/loggerHTTP access logging
corshono/corsCORS control
basicAuthhono/basic-authBasic authentication
jwthono/jwtJWT verification
bearerAuthhono/bearer-authBearer token auth
cachehono/cacheResponse caching
compresshono/compressgzip/Brotli compression
csrfhono/csrfCSRF token validation
etaghono/etagETag headers
prettyJSONhono/pretty-jsonFormatted JSON output
secureHeadershono/secure-headersSecurity headers
timeouthono/timeoutRequest timeout control
validatorhono/validatorRequest validation

Middleware in Practice

ts
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 app

Real-World Production Use Cases

Hono is deployed in production across the globe. Here are some notable adoption examples.

Company / ProjectUse Case
CloudflareInternal APIs and official Workers examples
UpstashEdge-compatible Redis/Kafka client APIs
Ponder.lyReal-time event tracking API
IntelliQHigh-throughput AI proxy API
ActorCoreGame 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.

Frameworkreq/s (approx.)Environment
Hono~840,000Cloudflare Workers
Fastify~60,000Node.js
Express~15,000Node.js
Koa~20,000Node.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