Getting Started
Core Concepts
Built-In Middleware
Advanced Features
Troubleshooting
Runtime Adapters allow you to run your Hono application on various serverless and runtime environments. Each adapter acts as a bridge, translating the unique requests and responses of a specific platform into a format that Hono understands.
By using these adapters, you can write your application logic once and deploy it to different environments like AWS Lambda, Cloudflare Workers, Bun, or Deno with minimal configuration changes.
We provide official adapters for the following platforms. Each can be accessed via their specific import path.
Note
To use an adapter, import the necessary functions directly from the platform-specific sub-path of the hono package.
While specific requirements vary by platform, the general setup follows this pattern:
new Hono() constructor.hono/adapter/... path.To handle requests in an AWS Lambda environment, use the handle function to translate the Lambda event into a Hono request:
import { Hono } from 'hono'
import { handle } from 'hono/aws-lambda'
const app = new Hono()
app.get('/', (c) => c.text('Hello AWS Lambda!'))
export const handler = handle(app)Tip
Use streamHandle instead of handle if your application requires response streaming support in AWS Lambda.
Understanding these common adapter components will help you build portable applications:
handle / serveStatic: These act as the primary entry points. They translate incoming platform-specific events (like API Gateway events or raw HTTP requests) into standard Web Request and Response objects.getConnInfo: A helper function provided by all major adapters to retrieve connection metadata, such as client IP addresses, which are handled differently across runtimes.upgradeWebSocket: A utility used to transition an HTTP request into a WebSocket connection, available for runtimes that support persistent connections.Certain runtimes provide capabilities beyond basic request handling:
bun and deno via toSSG, allowing you to export your application routes as static files for deployment to CDNs.bun, deno, and cloudflare-workers via the serveStatic utility, which enables efficient delivery of assets.Warning
Always verify the specific platform documentation regarding request body sizes, execution timeouts, and memory limits, as these constraints are imposed by the cloud provider or runtime, not by Hono.
The following diagram illustrates how an adapter facilitates communication between a client and your application: