Skip to main content
doc0blade47/honodocumentation home
Sign in

App Presets Configuration

Last updated Oct 12, 2026100% grounded

Overview

Hono allows you to customize how your application behaves through initialization options, strict path routing, and lightweight minimal router presets. By selecting specific router presets or configuring options when creating your Hono instance, you can optimize your app for performance, bundle size, or specific path-matching rules.

Note

Hono defaults to a smart router setup combining RegExpRouter and TrieRouter for general use cases.


Configuration Options

Initialization and Settings

When initializing a standard Hono application, you can pass an options object to customize routing behavior and path resolution.

Option KeyTypeDefaultDescription
strictbooleantrueControls whether trailing slashes are treated as distinct paths.
routerRouterundefinedA custom router instance to handle route matching.
getPathFunctionundefinedA custom function to extract the path from incoming requests.

Strict Path Routing

By default, strict routing is enabled (true), meaning a route defined as /hello will not match a request to /hello/. You can disable strict path routing by setting strict: false.

import { Hono } from 'hono'
 
// Disable strict path routing (trailing slashes are treated equivalently)
const app = new Hono({ strict: false })
 
app.get('/hello', (c) => c.text('Hello!'))

Minimal Presets: Tiny and Quick

Preset Selection

If you want to reduce your application's bundle size or target specific router algorithms, Hono provides minimal entry points: hono/tiny and hono/quick.

Using hono/tiny

The hono/tiny preset uses PatternRouter, which is lightweight and well-suited for minimal bundle footprints.

import { Hono } from 'hono/tiny'
 
const app = new Hono()
 
app.get('/tiny', (c) => c.text('Running with PatternRouter'))
 
export default app

Using hono/quick

The hono/quick preset uses a SmartRouter configured with LinearRouter and TrieRouter.

import { Hono } from 'hono/quick'
 
const app = new Hono()
 
app.get('/quick', (c) => c.text('Running with Linear and Trie routers'))
 
export default app

Supported Routers

Hono includes several internal routers that can be supplied via the router option or used within custom presets.

Router IdentifierDescription
RegExpRouterMatches routes using regular expressions.
TrieRouterMatches routes using a tree data structure.
SmartRouterAutomatically selects the best underlying router based on registered routes.
PatternRouterLightweight pattern-matching router used in hono/tiny.
LinearRouterLinear search router used alongside TrieRouter in hono/quick.

Sources: src/hono.ts, src/preset/tiny.ts, src/preset/quick.ts, src/router/reg-exp-router/index.ts, src/router/smart-router/index.ts, src/router/trie-router/index.ts, src/router/pattern-router/index.ts, src/router/linear-router/index.ts.


Customizing with Factory

You can also pre-configure default application options using the Factory helper when generating multiple application instances.

import { Factory } from 'hono/factory'
 
const factory = new Factory({
  defaultAppOptions: {
    strict: false,
  },
})
 
const app = factory.createApp()

Tip

Use hono/tiny when building applications for edge environments where bundle size is strictly constrained.

Was this page helpful?