Overview
Hono is a web framework built on Web Standards. Because it is designed to run on any JavaScript runtime, you can install it using your favorite package manager and deploy your application across multiple environments including Node.js, Deno, Bun, Cloudflare Workers, AWS Lambda, Vercel, and Netlify.
This guide covers how to install Hono and launch your first application across different runtimes using its public API.
Installation
You can install Hono using npm, yarn, pnpm, bun, or deno.
# Using npm
npm install hono
# Using yarn
yarn add hono
# Using pnpm
pnpm add hono
# Using bun
bun add honoFor Deno, you can import Hono directly from the JSR registry:
import { Hono } from 'jsr:@hono/hono'Launching Your First Application
Basic Application Setup
To create a basic Hono application, instantiate the Hono class, define your routes using HTTP method functions such as app.get(), and return responses using helper methods like c.text() or c.json().
import { Hono } from 'hono'
const app = new Hono()
app.get('/', (c) => c.text('Hello!'))
export default appRuntime Adapters and Entry Points
Depending on the runtime environment where your application executes, you may need specific entry points or handlers to interface incoming requests with Hono's .fetch() method.
The table below lists the available runtime integration modules and supported adapters.
| Integration / Runtime | Module Import Path | Primary Helper / Handler |
|---|---|---|
| Cloudflare Workers | hono/cloudflare-workers | upgradeWebSocket, getConnInfo, serveStatic |
| Cloudflare Pages | hono/cloudflare-pages | handle, handleMiddleware, serveStatic |
| Deno | hono/deno | upgradeWebSocket, getConnInfo, serveStatic, toSSG |
| Bun | hono/bun | Runtime-native app.fetch |
| AWS Lambda | hono/aws-lambda | handle, streamHandle, getConnInfo |
| Vercel | hono/vercel | handle, getConnInfo |
| Netlify | hono/netlify | handle |
| Lambda@Edge | hono/lambda-edge | handle, getConnInfo |
| Service Worker | hono/service-worker | fire, handle |
Tip
You can detect your running environment programmatically using getRuntimeKey() from hono/adapter.
Supported runtime keys: node, deno, bun, workerd, fastly, edge-light, other
(Sources: src/helper/adapter/index.ts)
Examples by Runtime
1. Cloudflare Workers
Cloudflare Workers execute Hono directly via the exported fetch handler or module worker default export.
import { Hono } from 'hono'
import { getRuntimeKey } from 'hono/adapter'
const app = new Hono()
app.get('/', (c) => c.text(`Hello from ${getRuntimeKey()}`))
export default app2. AWS Lambda
Use the handle function from hono/aws-lambda to convert your Hono application into an AWS Lambda handler compatible with API Gateway, Application Load Balancers (ALB), and Function URLs.
import { Hono } from 'hono'
import { handle } from 'hono/aws-lambda'
const app = new Hono()
app.get('/', (c) => c.text('Hello from Lambda'))
export const handler = handle(app)3. Vercel
Vercel serverless functions consume the handle wrapper from hono/vercel.
import { Hono } from 'hono'
import { handle } from 'hono/vercel'
const app = new Hono()
app.get('/', (c) => c.text('Hello from Vercel'))
export default handle(app)4. Netlify
Netlify serverless functions integrate using the handle utility from hono/netlify.
import { Hono } from 'hono'
import { handle } from 'hono/netlify'
const app = new Hono()
app.get('/', (c) => c.text('Hello from Netlify'))
export default handle(app)