Skip to main content
Install Hono in an existing project to start building web applications with this ultrafast framework.

Install Hono

Add Hono to your project using your preferred package manager:

Basic Setup

Once installed, create your first Hono application:
index.ts

Package Exports

Hono provides multiple entry points for different use cases. Here are the most common imports:

Core Framework

Middleware

Helpers

Runtime Adapters

Presets

Hono offers optimized presets for different use cases. These presets use different routers under the hood for specific performance characteristics.

Standard (Default)

The default import uses SmartRouter which combines RegExpRouter and TrieRouter for optimal performance:
This is the recommended preset for most applications. It provides:
  • Excellent routing performance
  • Support for all routing patterns
  • Automatic router selection based on route complexity

Tiny Preset

For applications where bundle size is critical (under 12kB), use the tiny preset with PatternRouter:
Characteristics:
  • Smallest bundle size (under 12kB)
  • Zero dependencies
  • Uses only Web Standard APIs
  • Ideal for Cloudflare Workers and edge environments

Quick Preset

For simpler applications with linear routing needs, use the quick preset with LinearRouter:
Characteristics:
  • Uses LinearRouter combined with TrieRouter
  • Optimized for applications with fewer routes
  • Good balance between size and performance
The choice of preset mainly affects routing performance and bundle size. The API remains the same across all presets.

Runtime-Specific Setup

Depending on your deployment target, you may need additional setup:
No additional setup required. Just export your app:
Add to your wrangler.toml:

TypeScript Configuration

For the best development experience with TypeScript, ensure your tsconfig.json includes:
tsconfig.json
Adjust the types field based on your runtime. For Node.js, use ["node"]. For Deno, this field is not needed.

Package.json Setup

Here’s a minimal package.json for a Hono project:
package.json
Make sure to set "type": "module" in your package.json to enable ES modules support.

Verifying Installation

Test that Hono is correctly installed by running a simple script:
test.ts
Run it:

Next Steps

Now that Hono is installed, you’re ready to build:

Quickstart Guide

Build your first Hono application

Routing

Learn about routes and path patterns

Middleware

Explore built-in and custom middleware

API Reference

Dive into the complete API documentation