/Knowledge/sources/honojs__hono/llms-full/factory-helper-factory-createapp--4029e724c3f9.md
Factory Helper: factory.createApp() - hono-docs
Factory Helper: factory.createApp() Source evidence: /Sources/honojs hono/provenance.md Canonical citation: https://hono.dev/llms full.txt factory createapp...
Factory Helper: factory.createApp()
Source evidence: /Sources/honojs__hono/provenance.md Canonical citation: https://hono.dev/llms-full.txt#factory-createapp
Summary
createApp() helps to create an instance of Hono with the proper types. If you use this method with createFactory(), you can avoid redundancy in the definition of the Env type. If your application is like this, you have to set the `...
Content
createApp() helps to create an instance of Hono with the proper types. If you use this method with createFactory(), you can avoid redundancy in the definition of the Env type.
If your application is like this, you have to set the Env in two places:
import { createMiddleware } from 'hono/factory'
type Env = {
Variables: {
myVar: string
}
}
// 1. Set the `Env` to `new Hono()`
const app = new Hono<Env>()
// 2. Set the `Env` to `createMiddleware()`
const mw = createMiddleware<Env>(async (c, next) => {
await next()
})
app.use(mw)
By using createFactory() and createApp(), you can set the Env only in one place.
Metadata
{
"chunk_index": 0,
"citation": "https://hono.dev/llms-full.txt#factory-createapp",
"coverage_role": "overview",
"qualified_title": "Hono / llms-full / Factory Helper > `factory.createApp()` (1)",
"retrieved_at": "2026-07-02T05:51:01Z",
"section_index": 662,
"source_id": "/honojs/hono",
"source_type": "llms_full",
"target_label": "llms-full",
"title": "Factory Helper: factory.createApp()",
"upstream_url": "https://hono.dev/llms-full.txt",
"version": "2026"
}