Skip to main content
The Vercel adapter provides utilities for running Hono applications on Vercel’s Edge Runtime and Serverless Functions.

Import

Functions

handle()

Converts a Hono application into a Vercel request handler.

Parameters

  • app - The Hono application instance

Returns

A request handler function that can be exported as the default export.

Example

getConnInfo()

Extracts connection information from the Vercel request.

Returns

Example

Platform-Specific Notes

Edge Runtime vs Serverless

Vercel supports two runtime environments:
  • Edge Runtime: Runs on Vercel’s Edge Network, closer to users for lower latency
  • Serverless Functions: Traditional serverless functions with full Node.js compatibility
The adapter works with both. Configure the runtime in your vercel.json:

Request Headers

Vercel provides additional headers:
  • x-real-ip - Client’s real IP address
  • x-forwarded-for - Proxy chain
  • x-vercel-ip-country - Country code (e.g., “US”)
  • x-vercel-ip-city - City name (e.g., “San Francisco”)
  • x-vercel-ip-country-region - Region code (e.g., “CA”)
  • x-vercel-ip-latitude - Latitude
  • x-vercel-ip-longitude - Longitude

File Structure

For file-based routing in the api/ directory:

Example with Dynamic Routes

Catch-All Routes

For a single handler that handles all routes:

Environment Variables

Access Vercel environment variables directly:

Configuration

vercel.json

TypeScript Configuration

Deployment

Using Vercel CLI

Using Git Integration

Connect your repository to Vercel:
  1. Import your Git repository at vercel.com/new
  2. Configure build settings (if needed)
  3. Deploy automatically on every push

Build Configuration

Complete Example

See Also