Skip to main content
doc0blade47/honodocumentation home
Sign in

Runtime Adapters

Last updated Oct 12, 2026100% grounded

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 / PlatformImport PathKey Exports
Cloudflare Workershono/cloudflare-workersserveStatic, upgradeWebSocket, getConnInfo
Cloudflare Pageshono/cloudflare-pageshandle, handleMiddleware, serveStatic, getConnInfo, EventContext
Denohono/denoserveStatic, toSSG, denoFileSystemModule, upgradeWebSocket, getConnInfo
Bunhono/bunserveStatic, bunFileSystemModule, toSSG, createBunWebSocket, upgradeWebSocket, websocket, getConnInfo, getBunServer
AWS Lambdahono/aws-lambdahandle, streamHandle, defaultIsContentTypeBinary, getConnInfo, APIGatewayProxyResult, LambdaEvent
Vercelhono/vercelhandle, getConnInfo
Netlifyhono/netlifyhandle, getConnInfo
Lambda@Edgehono/lambda-edgehandle, getConnInfo
Service Workerhono/service-workerhandle, 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 app

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

Supported runtime keys returned by getRuntimeKey() include:

  • node
  • deno
  • bun
  • workerd
  • fastly
  • edge-light
  • other

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)
Was this page helpful?