Overview
Runtime adapters allow you to run and deploy your Hono applications seamlessly across different JavaScript runtimes and serverless platforms like Cloudflare Workers, Node.js, Bun, Deno, AWS Lambda, Vercel, and Netlify. Because Hono is built on standard Web APIs (Request and Response), adapters bridge platform-specific request and response formats to Hono's unified application handler.
Supported Adapters and Imports
Hono provides dedicated entry points for each supported runtime environment. Below is the complete list of available adapter modules and their primary exports.
| Runtime / Platform | Import Path | Key Exports |
|---|---|---|
| Cloudflare Workers | hono/cloudflare-workers | serveStatic, upgradeWebSocket, getConnInfo |
| Cloudflare Pages | hono/cloudflare-pages | handle, handleMiddleware, serveStatic, getConnInfo, EventContext |
| Deno | hono/deno | serveStatic, toSSG, denoFileSystemModule, upgradeWebSocket, getConnInfo |
| Bun | hono/bun | serveStatic, bunFileSystemModule, toSSG, createBunWebSocket, upgradeWebSocket, websocket, getConnInfo, getBunServer |
| AWS Lambda | hono/aws-lambda | handle, streamHandle, defaultIsContentTypeBinary, getConnInfo, APIGatewayProxyResult, LambdaEvent |
| Vercel | hono/vercel | handle, getConnInfo |
| Netlify | hono/netlify | handle, getConnInfo |
| Lambda@Edge | hono/lambda-edge | handle, getConnInfo |
| Service Worker | hono/service-worker | handle, fire |
Note
Sources: package.json, jsr.json, and individual adapter entry files under src/adapter/.
Configuration by Platform
Cloudflare Workers
Cloudflare Workers natively execute code using standard fetch event listeners or ES module exports. A Hono app designed for Cloudflare Workers exports the app instance directly.
import { Hono } from 'hono'
const app = new Hono()
app.get('/', (c) => c.text('Hello from Cloudflare Workers'))
export default appCloudflare Pages
For Cloudflare Pages Functions, use the handle adapter to wrap your Hono application for the Pages environment.
import { Hono } from 'hono'
import { handle } from 'hono/cloudflare-pages'
const app = new Hono()
app.get('/', (c) => c.text('Hello from Cloudflare Pages'))
export const onRequest = handle(app)AWS Lambda
To deploy on AWS Lambda (supporting API Gateway v1/v2, Application Load Balancer, or Function URLs), use the handle function from hono/aws-lambda.
import { Hono } from 'hono'
import { handle } from 'hono/aws-lambda'
const app = new Hono()
app.get('/', (c) => c.text('Hello from AWS Lambda'))
export const handler = handle(app)Tip
For streaming responses on AWS Lambda, you can use streamHandle(app) instead of standard handle(app).
Vercel
Vercel Serverless Functions expect a handler that accepts a standard Request object and returns a Response.
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)Netlify
Netlify functions receive a standard Request object and a context object. The Netlify adapter forwards these to Hono automatically.
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)Environment and Connection Helpers
Detecting Runtimes and Reading Environment Variables
Hono provides a universal env helper and runtime detection utility via hono/adapter. This allows you to write environment-agnostic code or gracefully read bindings across different platforms.
import { Hono } from 'hono'
import { env, getRuntimeKey } from 'hono/adapter'
const app = new Hono()
app.get('/', (c) => {
const runtime = getRuntimeKey()
return c.text(`Running on: ${runtime}`)
})
app.get('/env', (c) => {
const bindings = env<{ MY_VAR: string }>(c)
return c.text(`MY_VAR is ${bindings.MY_VAR}`)
})
export default appSupported runtime keys returned by getRuntimeKey() include:
nodedenobunworkerdfastlyedge-lightother
Important
Sources: src/helper/adapter/index.ts.
Retrieving Connection Info
Several runtime adapters export a getConnInfo helper to retrieve client connection details such as remote IP addresses.
import { Hono } from 'hono'
import { handle, getConnInfo } from 'hono/cloudflare-pages'
const app = new Hono()
app.get('/ip', (c) => {
const info = getConnInfo(c)
return c.text(`Your IP address is: ${info.remote.address}`)
})
export const onRequest = handle(app)