NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm · #1282 most downloaded on npm
Web framework built on Web Standards
Last release 3 days ago
30 Sep 2026
Ships on a steady schedule
a new release about every 2 weeks
Nearly every release is documented
notes for 60 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
5 years old
454 releases · first in 2021
One column per quarter.
chore(benchmark): add "loop" script by @yusukebe in https://github.com/honojs/hono/pull/2431
caches is not defined by @yusukebe in https://github.com/honojs/hono/pull/2443Full Changelog: https://github.com/honojs/hono/compare/v4.1.5...v4.1.6
perf: Don't use Arrap.prototype.map if it is not needed return value by @nakasyou in https://github.com/honojs/hono/pull/2419
Arrap.prototype.map if it is not needed return value by @nakasyou in https://github.com/honojs/hono/pull/2419await cached contents by @yusukebe in https://github.com/honojs/hono/pull/2430Full Changelog: https://github.com/honojs/hono/compare/v4.1.4...v4.1.5
fix(jsx): allow null, undefined, and boolean as children by @usualoma in https://github.com/honojs/hono/pull/2394
Full Changelog: https://github.com/honojs/hono/compare/v4.1.3...v4.1.4
fix(deno): export jwt helpers for Deno in src/helper.ts by @yusukebe in https://github.com/honojs/hono/pull/2385
src/helper.ts by @yusukebe in https://github.com/honojs/hono/pull/2385json and form validation by @yusukebe in https://github.com/honojs/hono/pull/2392Full Changelog: https://github.com/honojs/hono/compare/v4.1.2...v4.1.3
feat(utils/cookie): Typesafe cookie options by @Jxck in https://github.com/honojs/hono/pull/2350
slice + indexOf for getPath() by @yusukebe in https://github.com/honojs/hono/pull/2376MergePath merge blank paths correctly by @yusukebe in https://github.com/honojs/hono/pull/2365Full Changelog: https://github.com/honojs/hono/compare/v4.1.1...v4.1.2
fix(context): export ExecutionContext from hono by @yusukebe in https://github.com/honojs/hono/pull/2346
ExecutionContext from hono by @yusukebe in https://github.com/honojs/hono/pull/2346denoify by @yusukebe in https://github.com/honojs/hono/pull/2362true by @yusukebe in https://github.com/honojs/hono/pull/2363this.#headers by @yusukebe in https://github.com/honojs/hono/pull/2364Full Changelog: https://github.com/honojs/hono/compare/v4.1.0...v4.1.1
Hono v4.1.0 is now available! Let's take a look at the new features.
Hono v4.1.0 is now available! Let's take a look at the new features.
Now Hono supports WebSockets! With WebSocket helper, you can easily handle WebSockets in your application. Currently, Cloudflare Workers / Pages, Deno, and Bun adapters are available.
const app = new Hono()
app.get(
'/ws',
upgradeWebSocket((c) => {
return {
onMessage(event, ws) {
console.log(`Message from client: ${event.data}`)
ws.send('Hello from server!')
},
onClose: () => {
console.log('Connection closed')
}
}
})
)
PRC mode is now also supported for WebSockets endpoints. The following is a demo.
Thanks @nakasyou!
Introducing Body Limit Middleware. This middleware can limit the file size of the request body.
const app = new Hono()
app.post(
'/upload',
bodyLimit({
maxSize: 50 * 1024, // 50kb
onError: (c) => {
return c.text('overflow :(', 413)
}
}),
async (c) => {
const body = await c.req.parseBody()
if (body['file'] instanceof File) {
console.log(`Got file sized: ${body['file'].size}`)
}
return c.text('pass :)')
}
)
Thanks @EdamAme-x and @usualoma!
We made the target in the tsconfig.json as ES2022 instead of ES2020. So, the generated JavaScript files are now ES2022. That made the file size smaller! The following is the result of the minify and build of "Hello World" with Wrangler.
// ES2020
hono => Total Upload: 20.15 KiB / gzip: 7.42 KiB
hono/tiny => Total Upload: 12.74 KiB / gzip: 4.69 KiB
// ES2022
hono => Total Upload: 18.46 KiB / gzip: 7.09 KiB
hono/tiny => Total Upload: 11.12 KiB / gzip: 4.38 KiB
Performance has also been improved in some Node.js environments.
__Secure- and __Host- prefix https://github.com/honojs/hono/pull/2269cause option https://github.com/honojs/hono/pull/2224NO_COLOR https://github.com/honojs/hono/pull/2228NO_COLOR by @ryuapp in https://github.com/honojs/hono/pull/2228@hono/node-server by @yusukebe in https://github.com/honojs/hono/pull/2323bodyLimit for Deno by @yusukebe in https://github.com/honojs/hono/pull/2324Full Changelog: https://github.com/honojs/hono/compare/v4.0.10...v4.1.0
Nothing published for this version
fix (jsx/dom): keep ref.current value during lifecycle. by @usualoma in https://github.com/honojs/hono/pull/2307
Full Changelog: https://github.com/honojs/hono/compare/v4.0.9...v4.0.10
fix(stream): remove async from onabort by @sor4chi in https://github.com/honojs/hono/pull/2293
{} instead of Partial by @yusukebe in https://github.com/honojs/hono/pull/2305Full Changelog: https://github.com/honojs/hono/compare/v4.0.8...v4.0.9
fix(ssg): allow app: Hono for toSSG by @yusukebe in https://github.com/honojs/hono/pull/2272
app: Hono<any, any, any> for toSSG by @yusukebe in https://github.com/honojs/hono/pull/2272Full Changelog: https://github.com/honojs/hono/compare/v4.0.7...v4.0.8
fix(jsx/dom): import from correct file for avoiding circular dependency by @usualoma in https://github.com/honojs/hono/pull/2268
MergeSchemaPath supports regexp path params by @yusukebe in https://github.com/honojs/hono/pull/2271Full Changelog: https://github.com/honojs/hono/compare/v4.0.6...v4.0.7
chore: use official deno installer by @ryuapp in https://github.com/honojs/hono/pull/2250
Full Changelog: https://github.com/honojs/hono/compare/v4.0.5...v4.0.6
fix: Dot-containing paths do not correctly receive extension completion. by @watany-dev in https://github.com/honojs/hono/pull/2243
Full Changelog: https://github.com/honojs/hono/compare/v4.0.4...v4.0.5
docs(contribution): add install flag --frozen-lockfile by @ryuapp in https://github.com/honojs/hono/pull/2229
--frozen-lockfile by @ryuapp in https://github.com/honojs/hono/pull/2229@edge for compute by @yusukebe in https://github.com/honojs/hono/pull/2235Full Changelog: https://github.com/honojs/hono/compare/v4.0.3...v4.0.4
fix(jsx-renderer): support async component by @yusukebe in https://github.com/honojs/hono/pull/2211
Full Changelog: https://github.com/honojs/hono/compare/v4.0.2...v4.0.3
This is a patch release. But, it includes a minor feature.
This is a patch release. But, it includes a minor feature.
SSG helper now generates HTML files only if they are handling GET or ALL methods.
createHandler Response Types (handler x1) by @nakasyou in https://github.com/honojs/hono/pull/2192c.env variables to disable/enable SSG by @usualoma in https://github.com/honojs/hono/pull/2179Full Changelog: https://github.com/honojs/hono/compare/v4.0.1...v4.0.2
fix(context): remove duplicate definition of render method by @usualoma in https://github.com/honojs/hono/pull/2191
Full Changelog: https://github.com/honojs/hono/compare/v4.0.0...v4.0.1
Hono v4.0.0 is out! This major update includes some breaking changes and the addition of three major features.
Going to full-stack.
Hono v4.0.0 is out! This major update includes some breaking changes and the addition of three major features.
So Hono is going to full-stack. Let's take a look at the three features.
We introduce SSG Helper. With it you can generate static pages of your Hono applications.
To use this, create a separate file build.ts from the application and call the toSSG() function in it.
import fs from 'node:fs/promises'
import { toSSG } from 'hono/ssg'
import app from './src/index'
toSSG(app, fs)
There are adapters for Bun and Deno, so you can write shorter for Bun, for example.
import { toSSG } from 'hono/bun'
import app from './src/index'
toSSG(app)
And, just run it.
bun ./build.ts
Then HTML is generated.
$ ls static
about.html index.html
You can easily deploy this page to Cloudflare Pages, etc.
$ wrangler pages deploy static
We have created a plugin @hono/vite-ssg for Vite. By using this, you will be able to develop and build a static sites with just the vite command.
The configuration is the following:
import build from '@hono/vite-ssg'
import devServer from '@hono/vite-dev-server'
import { defineConfig } from 'vite'
export default defineConfig({
plugins: [
build(),
devServer({
entry: 'src/index.tsx'
})
]
})
If you want to develope, just run the command:
vite
If you want to build, just run the command:
vite build
In combination with the deployment mentioned above to Cloudflare Pages, you can develop, SSG build, and deploy non-stop. And each of them is extremely fast (the video is 2x faster).
hono/jsx was originally designed to run server-side as an alternative to template engines such as Mustache. Server-side JSX is an interesting experiment, creating a new stack to combine with HTMX and Alpine.js. But that's not all.
Now, hono/jsx runs on the client as well. We call it hono/jsx/dom or Client Components.
The exact same code as React runs with Hono's JSX.
import { useState } from 'hono/jsx'
import { render } from 'hono/jsx/dom'
function Counter() {
const [count, setCount] = useState(0)
return (
<div>
<p>Count: {count}</p>
<button onClick={() => setCount(count + 1)}>Increment</button>
</div>
)
}
function App() {
return (
<html>
<body>
<Counter />
</body>
</html>
)
}
const root = document.getElementById('root')
render(<App />, root)
The Hooks listed below are also implemented and you can create Client Components just like in React.
startViewTransition familyIn addition, the original APIs, startViewTransition family make the View Transition API easy to use.
import { useState, startViewTransition } from 'hono/jsx'
import { Style, css, keyframes } from 'hono/css'
const fadeIn = keyframes`
from { opacity: 0; }
to { opacity: 1; }
`
const App = () => {
const [showTitleImage, setShowTitleImage] = useState(false)
return (
<>
<button onClick={() => startViewTransition(() => setShowTitleImage((state) => !state))}>Click!</button>
<div>
{!showTitleImage ? (
<img src="https://hono.dev/images/logo.png" />
) : (
<div
class={css`
animation: ${fadeIn} 1s;
background: url('https://hono.dev/images/logo-large.png');
background-size: contain;
background-repeat: no-repeat;
background-position: center;
width: 500px;
height: 200px;
`}
/>
)}
</div>
</>
)
}
You can easily create the animation.
The hono/jsx/dom is fast and ultra-small. It has a smaller JSX runtime dedicated to the DOM in addition to the common server and client ones. Just specify hono/jsx/dom instead of hono/jsx in tsconfig.json.
"jsx": "react-jsx",
"jsxImportSource": "hono/jsx/dom"
The above counter example is 2.8KB with Brotli compression.
In comparison, React is 47.3 KB for the same thing.
Last is File-based Routing. This is not included in the hono package, but is provided in a separate package.
It is named HonoX.
HonoX has the following features.
You can try it now. One of create-hono's starter templates named "x-base" uses HonoX.
For detailed usage, please see the following HonoX repository.
https://github.com/honojs/honox
The addition of this feature has no impact on the core. "Hello World" in hono/tiny is still small, only 12KB minified.
'*' for app.use() - https://github.com/honojs/hono/pull/1753app.on supports multiple paths - https://github.com/honojs/hono/pull/1923c.json() - https://github.com/honojs/hono/pull/2021mimes option for serve-static - https://github.com/honojs/hono/pull/2094There are several breaking changes. Please see the Migration Guide below.
https://github.com/honojs/hono/blob/main/docs/MIGRATION.md
Thanks to all contributors. Great job on all the hard work!
app.on supports multiple paths by @yusukebe in https://github.com/honojs/hono/pull/1923import by @yusukebe in https://github.com/honojs/hono/pull/1969node:path by @nakasyou in https://github.com/honojs/hono/pull/1965deprecated from Factory and createHandlers by @yusukebe in https://github.com/honojs/hono/pull/1979manifest required by @yusukebe in https://github.com/honojs/hono/pull/1984.tsx by @yusukebe in https://github.com/honojs/hono/pull/1994c.get() inference by @yusukebe in https://github.com/honojs/hono/pull/1995ssgParams middleware by @nakasyou in https://github.com/honojs/hono/pull/1960isDynamicRoute and ssgParams matter by @yusukebe in https://github.com/honojs/hono/pull/2006useTransition() handling more simple by @usualoma in https://github.com/honojs/hono/pull/2003test:deno by @yusukebe in https://github.com/honojs/hono/pull/2014deno.lock by @yusukebe in https://github.com/honojs/hono/pull/2015return c.json() by @yusukebe in https://github.com/honojs/hono/pull/2021ssgParams flexibility by @sor4chi in https://github.com/honojs/hono/pull/2024BlankSchema or BlankInput by @yusukebe in https://github.com/honojs/hono/pull/2040useViewTransition() hook and viewTransition() helper by @usualoma in https://github.com/honojs/hono/pull/2053Installing dependencies by @yusukebe in https://github.com/honojs/hono/pull/2113mimes option for serve-static by @ryuapp in https://github.com/honojs/hono/pull/2094disableSSG and onlySSG by @yusukebe in https://github.com/honojs/hono/pull/2104c.var type by @Kyiro in https://github.com/honojs/hono/pull/2121hono/html by @javascripter in https://github.com/honojs/hono/pull/2143helper.ts by @yusukebe in https://github.com/honojs/hono/pull/2150MergeSchemePath infers param types correctly by @yusukebe in https://github.com/honojs/hono/pull/2152MergeSchemaPath infer inputs not only params by @yusukebe in https://github.com/honojs/hono/pull/2154getExtension() fast by @ryuapp in https://github.com/honojs/hono/pull/2168Full Changelog: https://github.com/honojs/hono/compare/v3.12.10...v4.0.0
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
fix(types): MergeSchemaPath infer inputs not only params by @yusukebe in https://github.com/honojs/hono/pull/2154
MergeSchemaPath infer inputs not only params by @yusukebe in https://github.com/honojs/hono/pull/2154Full Changelog: https://github.com/honojs/hono/compare/v3.12.11...v3.12.12
fix(html): Remove circular dependencies in hono/html by @javascripter in https://github.com/honojs/hono/pull/2143
hono/html by @javascripter in https://github.com/honojs/hono/pull/2143MergeSchemePath infers param types correctly by @yusukebe in https://github.com/honojs/hono/pull/2152Full Changelog: https://github.com/honojs/hono/compare/v3.12.10...v3.12.11
fix(trie-router): fix same parameter name issue by @yusukebe in https://github.com/honojs/hono/pull/2136
Full Changelog: https://github.com/honojs/hono/compare/v3.12.9...v3.12.10
chore: add development environment by @jarqvi in https://github.com/honojs/hono/pull/2095
curly rule as all by @yusukebe in https://github.com/honojs/hono/pull/2112Full Changelog: https://github.com/honojs/hono/compare/v3.12.8...v3.12.9
fix(factory): correct types inside of createMiddleware() by @yusukebe in https://github.com/honojs/hono/pull/2081
createMiddleware() by @yusukebe in https://github.com/honojs/hono/pull/2081Full Changelog: https://github.com/honojs/hono/compare/v3.12.7...v3.12.8
refactor: aws lambda createResult method by @ariskemper in https://github.com/honojs/hono/pull/2038
NO_COLOR by @ryuapp in https://github.com/honojs/hono/pull/2007env command by @ryuapp in https://github.com/honojs/hono/pull/2062Full Changelog: https://github.com/honojs/hono/compare/v3.12.6...v3.12.7
feat: Add Type to request for Lambda@Edge adapter to support S3 origin by @mosle in https://github.com/honojs/hono/pull/1991
c.json({}, requestInit) problem by @yusukebe in https://github.com/honojs/hono/pull/2025Full Changelog: https://github.com/honojs/hono/compare/v3.12.5...v3.12.6
fix(trie-router): fixed same name path params matter by @yusukebe in https://github.com/honojs/hono/pull/1992
Full Changelog: https://github.com/honojs/hono/compare/v3.12.4...v3.12.5
chore(package.json): use escape double quotes by @ryuapp in https://github.com/honojs/hono/pull/1957
Full Changelog: https://github.com/honojs/hono/compare/v3.12.3...v3.12.4
fix(context): set multiple cookies correctly in set res by @yusukebe in https://github.com/honojs/hono/pull/1947
set res by @yusukebe in https://github.com/honojs/hono/pull/1947ClientResponse and ClientRequest by @yusukebe in https://github.com/honojs/hono/pull/1952Full Changelog: https://github.com/honojs/hono/compare/v3.12.2...v3.12.3
fix(client): Fix issue awaiting RPC client by @codekrafter in https://github.com/honojs/hono/pull/1924
adapter/netlify/index.ts by @yusukebe in https://github.com/honojs/hono/pull/1932./netlify by @charkour in https://github.com/honojs/hono/pull/1930deno_dist/adapter/netlify by @charkour in https://github.com/honojs/hono/pull/1931Full Changelog: https://github.com/honojs/hono/compare/v3.12.1...v3.12.2
fix(jsx): fix jsx-runtime for falsy children by @usualoma in https://github.com/honojs/hono/pull/1910
c.req.valid() by @yusukebe in https://github.com/honojs/hono/pull/1914onAbort correctly by @sor4chi in https://github.com/honojs/hono/pull/1920Full Changelog: https://github.com/honojs/hono/compare/v3.12.0...v3.12.1
c.stream() is now deprecated and you should use stream() in Streaming Helper. And, stream.abort() has been added.
Hono v3.12.0 is now available! Let's take a look at the new features.
This release introduces CSRF Protection Middleware. It is easy to use and can prevent CSRF attacks by simply writing like the following:
import { csrf } from 'hono/csrf'
// ...
app.use('*', csrf())
CSRF Protection Middleware compares the Origin header value with the request URL. This is the same method used by SvelteKit and is valid in many situations except when using older browsers.
Thanks to @usualoma! And, the original idea for CSRF Protection was suggested by @htunnicliff. Thanks!
We created a built-in CSS in JS(X). It's "hono/css".
The css helper can be used with JSX. You can write the CSS in a css template literal tag and specify the returned value as the class value and it will be applied to that element.
app.get('/', (c) => {
const headerClass = css`
background-color: orange;
color: white;
padding: 1rem;
`
return c.html(
<html>
<head>
<Style />
</head>
<body>
<h1 class={headerClass}>Hello!</h1>
</body>
</html>
)
})
If you use VS Code, you can use vscode-styled-components for Syntax highlighting and IntelliSense for css tagged literals.
By combining keyframes and JSX rendering, you can create a like button without JavaScript!
Also, you can use a CSS-generating design tool such as Figma to create components even if you are not a CSS guru.
You can use other CSS in JS libraries in Hono, such as Panda CSS. However, hono/css can be used by simply importing the hono package, and Async components and Suspense are also supported.
Thanks to @usualoma!
stream.onAbort()c.stream() is now deprecated and you should use stream() in Streaming Helper. And, stream.abort() has been added.
app.get('/stream', (c) => {
return stream(c, async (stream) => {
stream.onAbort(() => {
console.log('Aborted!')
})
// ...
})
})
Thanks to @sor4chi!
onNotFound option for serveStaticCloudflare Workers, Deno, and Bun serveStatic now have an onNotFound option. You can write a handle when a file is not found.
app.get(
'/static/*',
serveStatic({
onNotFound: (path, c) => {
console.log(`${path} is not found, you access ${c.req.path}`)
}
})
)
Thanks to @Th1nkK1D!
colorize option for showRoutes()The colorize option has been added to the showRoutes function in hono/dev. If you set this value to false, the output will not be colored, which can be used when you want to log output, etc.
import { showRoutes } from 'hono/dev'
showRoutes(app, {
colorize: false
})
getRouterName()$url()c.stream* to helper by @sor4chi in https://github.com/honojs/hono/pull/1846getRouterName() by @yusukebe in https://github.com/honojs/hono/pull/1841onNotFound handler in adapters' serveStatic by @Th1nkK1D in https://github.com/honojs/hono/pull/1825colorize option for showRoutes() by @yusukebe in https://github.com/honojs/hono/pull/1886param option to $url() by @yusukebe in https://github.com/honojs/hono/pull/1885Full Changelog: https://github.com/honojs/hono/compare/v3.11.12...v3.12.0
fix(dev): preserve original handler in [composedHandler]. by @usualoma in https://github.com/honojs/hono/pull/1873
JSONParsed supports interface and Date etc. by @yusukebe in https://github.com/honojs/hono/pull/1853Full Changelog: https://github.com/honojs/hono/compare/v3.11.11...v3.11.12
Refactor(test): update vitest settings by @watany-dev in https://github.com/honojs/hono/pull/1851
ClientResponse by @yusukebe in https://github.com/honojs/hono/pull/1861req.queries() receives unexpected values by @yusukebe in https://github.com/honojs/hono/pull/1862Full Changelog: https://github.com/honojs/hono/compare/v3.11.10...v3.11.11
fix(trie-router): pass params to the next node by @yusukebe in https://github.com/honojs/hono/pull/1852
Full Changelog: https://github.com/honojs/hono/compare/v3.11.9...v3.11.10
Use vitest for fastly compute testing by @ysugimoto in https://github.com/honojs/hono/pull/1828
ts-jest by @yusukebe in https://github.com/honojs/hono/pull/18291.0.18 by @yusukebe in https://github.com/honojs/hono/pull/1832onError and notFound as class field by @yusukebe in https://github.com/honojs/hono/pull/1839Full Changelog: https://github.com/honojs/hono/compare/v3.11.8...v3.11.9
chore: bump devDependencies by @yusukebe in https://github.com/honojs/hono/pull/1820
devDependencies by @yusukebe in https://github.com/honojs/hono/pull/1820tsconfig.json): use vitest/globals for types by @yusukebe in https://github.com/honojs/hono/pull/1819Full Changelog: https://github.com/honojs/hono/compare/v3.11.7...v3.11.8
This release includes a security patch that fixes the vulnerability in TrieRouter.
This release includes a security patch that fixes the vulnerability in TrieRouter.
If you are using the default preset or hono/quick, or specifying the router as TrieRouter, you must upgrade to this version 3.11.7 immediately.
Just increment the version specifier to v3.11.7.
import { Hono } from 'https://deno.land/x/hono@v3.11.7/mod.ts'
import { serveStatic } from 'https://deno.land/x/hono@v3.11.7/middleware.ts'
Upgrade the hono package via npm:
npm install hono
// OR
yarn add hono
// OR
pnpm up hono
You may not update the hono package with npm update, so please use npm install.
The clients may override named path parameter values from previous requests if the application is using TrieRouter. So, there is a risk that a privileged user may use unintended parameters when deleting REST API resources.
TrieRouter is used either explicitly or when the application matches a pattern that is not supported by the default RegExpRouter.
The advisory: https://github.com/honojs/hono/security/advisories/GHSA-f6gv-hh8j-q8vq
If you discover such a vulnerability, please contact us immediately. We will respond immediately; we have enabled GitHub's private vulnerability reporting feature, so please use that.
https://github.com/honojs/hono/security/advisories
Thanks.
Full Changelog: https://github.com/honojs/hono/compare/v3.11.6...v3.11.7
fix(context): set status correctly by @yusukebe in https://github.com/honojs/hono/pull/1814
status correctly by @yusukebe in https://github.com/honojs/hono/pull/1814Full Changelog: https://github.com/honojs/hono/compare/v3.11.5...v3.11.6
fix(context): set headers values correctly by @yusukebe in https://github.com/honojs/hono/pull/1808
hono/tiny size by @ryuapp in https://github.com/honojs/hono/pull/1809c.json() allows object and returns JSONParsed<T> by @yusukebe in https://github.com/honojs/hono/pull/1806Full Changelog: https://github.com/honojs/hono/compare/v3.11.4...v3.11.5
fix(client): c.json() supports undefined/null response by @yusukebe in https://github.com/honojs/hono/pull/1794
c.json() supports undefined/null response by @yusukebe in https://github.com/honojs/hono/pull/1794Full Changelog: https://github.com/honojs/hono/compare/v3.11.3...v3.11.4
fix(base): name private _basePath instead of #basePath by @yusukebe in https://github.com/honojs/hono/pull/1785
private _basePath instead of #basePath by @yusukebe in https://github.com/honojs/hono/pull/1785ClientResponse.json() returns Union correctly by @yusukebe in https://github.com/honojs/hono/pull/1786Full Changelog: https://github.com/honojs/hono/compare/v3.11.2...v3.11.3
fix(types): Added E env type argument to showRoutes & inspectRoutes hono parameter by @NuroDev in https://github.com/honojs/hono/pull/1778
E env type argument to showRoutes & inspectRoutes hono parameter by @NuroDev in https://github.com/honojs/hono/pull/1778Full Changelog: https://github.com/honojs/hono/compare/v3.11.1...v3.11.2
fix(context): Strict type checking c.json() by @yusukebe in https://github.com/honojs/hono/pull/1776
c.json() by @yusukebe in https://github.com/honojs/hono/pull/1776Full Changelog: https://github.com/honojs/hono/compare/v3.11.0...v3.11.1
app.showRoutes has been deprecated.
Hono v3.11.0 is now available! Let's take a look at the new features.
ErrorBoundaryThis release introduces the new JSX component ErrorBoundary. It allows you to catch errors in child components.
For instance, in the example below, it will display the content specified in fallback if an error occurs.
import { ErrorBoundary } from 'hono/jsx'
// ...
function SyncComponent() {
throw new Error('Error')
return <div>Hello</div>
}
app.get('/sync', async (c) => {
return c.html(
<html>
<body>
<ErrorBoundary fallback={<div>Out of Service</div>}>
<SyncComponent />
</ErrorBoundary>
</body>
</html>
)
})
ErrorBoundary can be used with asynchronous components and Suspense as well.
async function AsyncComponent() {
await new Promise((resolve) => setTimeout(resolve, 2000))
throw new Error('Error')
return <div>Hello</div>
}
app.get('/with-suspense', async (c) => {
return c.html(
<html>
<body>
<ErrorBoundary fallback={<div>Out of Service</div>}>
<Suspense fallback={<div>Loading...</div>}>
<AsyncComponent />
</Suspense>
</ErrorBoundary>
</body>
</html>
)
})
Thanks to @usualoma!
createFactory() and createHandlers()The Factory helper now provides createFactory(), which creates an instance of the Factory class.
import { createFactory } from 'hono/factory'
const factory = createFactory()
createHandlers() in a Factory class instance assists in defining handlers.
import { createFactory } from 'hono/factory'
import { logger } from 'hono/logger'
// ...
const factory = createFactory<Env>()
const middleware = factory.createMiddleware(async (c, next) => {
c.set('foo', 'bar')
await next()
})
const handlers = factory.createHandlers(logger(), middleware, (c) => {
return c.json(c.var.foo)
})
app.get('/api', ...handlers)
Dev Helper is now available.
Instead of using app.showRoutes(), the showRoutes() function exported from hono/dev will display the registered routes in your console.
Consider an application like the following:
import { showRoutes } from 'hono/dev'
// ...
const app = new Hono().basePath('/v1')
app.get('/posts', (c) => {
// ...
})
app.get('/posts/:id', (c) => {
// ...
})
app.post('/posts', (c) => {
// ...
})
showRoutes(app)
When this application starts, the routes will be displayed in your console as follows:
GET /v1/posts
GET /v1/posts/:id
POST /v1/posts
Thanks to @usualoma!
app.showRoutes has been deprecated.
c.json() supports RPCc.json() now supports RPC, meaning you no longer need to use c.jsonT() for RPC-mode.
c.jsonT() has been deprecated.
Thanks to @usualoma!
c.req.routePathYou can retrieve the registered path within the handler as shown below:
app.get('/posts/:id', (c) => {
return c.json({ path: c.req.routePath })
})
If you access /posts/123, it will return /posts/:id:
{ "path": "/posts/:id" }
Thanks to @usualoma!
ErrorBoundary component by @usualoma in https://github.com/honojs/hono/pull/1714createFactory() and createHandlers() by @yusukebe in https://github.com/honojs/hono/pull/1743experimental from c.render/c.setRenderer() by @yusukebe in https://github.com/honojs/hono/pull/1748bearerAuth to accept a list of token strings by @mstibbard in https://github.com/honojs/hono/pull/1749inspectRoutes() and showRoutes() by @usualoma in https://github.com/honojs/hono/pull/1716Env types with changed routes by @yusukebe in https://github.com/honojs/hono/pull/1757MESSAGE_MATCHER_IS_ALREADY_BUILT by @yusukebe in https://github.com/honojs/hono/pull/1763c.json() have a type equivalent to c.jsonT() by @usualoma in https://github.com/honojs/hono/pull/1728matchedRoutes and routePath for HonoRequest by @usualoma in https://github.com/honojs/hono/pull/1744ErrorBoundary as experimental by @yusukebe in https://github.com/honojs/hono/pull/1771createHandlers by @yusukebe in https://github.com/honojs/hono/pull/1772# for private properties by @yusukebe in https://github.com/honojs/hono/pull/1762Full Changelog: https://github.com/honojs/hono/compare/v3.10.5...v3.11.0
fix(client): Allow optional props in JSON response by @yusukebe in https://github.com/honojs/hono/pull/1769
Full Changelog: https://github.com/honojs/hono/compare/v3.10.4...v3.10.5
fix(context): Set content-type with c.text() correctly by @yusukebe in https://github.com/honojs/hono/pull/1761
content-type with c.text() correctly by @yusukebe in https://github.com/honojs/hono/pull/1761Full Changelog: https://github.com/honojs/hono/compare/v3.10.3...v3.10.4
chore: remove jest.config.js by @yusukebe in https://github.com/honojs/hono/pull/1731
jest.config.js by @yusukebe in https://github.com/honojs/hono/pull/1731Path=/ for setCookie()/setSignedCookie() by @yusukebe in https://github.com/honojs/hono/pull/1742Full Changelog: https://github.com/honojs/hono/compare/v3.10.2...v3.10.3
ci: rename fastly compute@edge to compute by @yusukebe in https://github.com/honojs/hono/pull/1708
compute@edge to compute by @yusukebe in https://github.com/honojs/hono/pull/1708onError() handler to be async by @yusukebe in https://github.com/honojs/hono/pull/1730Full Changelog: https://github.com/honojs/hono/compare/v3.10.1...v3.10.2
fix(context): c.text() set the status set by c.status() by @yusukebe in https://github.com/honojs/hono/pull/1702
c.text() set the status set by c.status() by @yusukebe in https://github.com/honojs/hono/pull/1702Full Changelog: https://github.com/honojs/hono/compare/v3.10.0...v3.10.1
Hono v3.10.0 is now available! Let's explore the new features.
Hono v3.10.0 is now available! Let's explore the new features.
Hono's JSX now supports Async Components. You can use async/await in your components.
const fetchData = async () => {
const res = await fetch('https://jsonplaceholder.typicode.com/todos/1')
return res.json<{ title: string }>()
}
const Component = async () => {
const data = await fetchData()
return <div>{data.title}</div>
}
app.get('/', (c) => {
return c.html(
<html>
<body>
<h1>Hono v3.10.0</h1>
<Component />
</body>
</html>
)
})
Thanks, @usualoma!
Suspense and renderToReadableStream()With the Async Component, as shown above, it will await until fetch is completed. But now, if you want to render HTML before that, you can use Suspense.
When you use Suspense with renderToReadableStream(), it initially renders the content in fallback. After the Promise in Suspense is resolved, the real content is rendered.
import { renderToReadableStream, Suspense } from 'hono/jsx/streaming'
// ...
app.get('/', (c) => {
const stream = renderToReadableStream(
<html>
<body>
<h1>Hono v3.10.0</h1>
<Suspense fallback={<div>loading...</div>}>
<Component />
</Suspense>
</body>
</html>
)
return c.body(stream, {
headers: {
'Content-Type': 'text/html; charset=UTF-8',
'Transfer-Encoding': 'chunked'
}
})
})
If you make Component sleep for 2 seconds, the result will be as follows:
https://github.com/honojs/hono/assets/10682/5a02f18e-1368-4b8e-819b-29d22173d2a8
Thanks, @usualoma!
streamThe JSX Renderer Middleware now supports stream, allowing you to use Suspense with it. You can return streaming responses without renderToReadableStream() and without writing header values such as Transfer-Encoding: chunked.
import { jsxRenderer } from 'hono/jsx-renderer'
// ...
app.get(
'*',
jsxRenderer(
({ children }) => {
return (
<html>
<body>
<h1>Hono v3.10.0</h1>
{children}
</body>
</html>
)
},
{
stream: true
}
)
)
app.get('/', (c) => {
return c.render(
<Suspense fallback={<div>loading...</div>}>
<Component />
</Suspense>
)
})
Thanks, @usualoma!
The streamHandle is now available in the AWS Lambda adapter. With this, AWS Lambda can handle streaming responses.
import { Hono } from 'hono'
import { streamHandle } from 'hono/aws-lambda'
const app = new Hono()
app.get('/stream', async (c) => {
return c.streamText(async (stream) => {
for (let i = 0; i < 3; i++) {
await stream.writeln(`${i}`)
await stream.sleep(1)
}
})
})
const handler = streamHandle(app)
Thanks, @watany-dev!
@jsx precompile for DenoNow, Hono's JSX supports the precompile feature for Deno. To enable it, write deno.json as follows.
{
"compilerOptions": {
"jsx": "precompile",
"jsxImportSource": "hono/jsx"
},
"imports": {
"hono/jsx/jsx-runtime": "https://deno.land/x/hono@v3.10.0/jsx/jsx-runtime.ts"
}
}
Thanks, @usualoma!
The ecosystem is evolving. Today, we introduce one framework using Hono.
Suspense and use. by @usualoma in https://github.com/honojs/hono/pull/1630@experimental from createMiddleware() by @yusukebe in https://github.com/honojs/hono/pull/1653Compute@Edge to Compute by @yusukebe in https://github.com/honojs/hono/pull/1664experimental flag from app.mount() by @yusukebe in https://github.com/honojs/hono/pull/1669ContextVariableMap for c.var by @yusukebe in https://github.com/honojs/hono/pull/1682console.error() for default errorHandler by @yusukebe in https://github.com/honojs/hono/pull/1687Full Changelog: https://github.com/honojs/hono/compare/v3.9.2...v3.10.0
Nothing published for this version
Nothing published for this version
This release includes a security patch that fixes the vulnerability for serveStatic on Windows OS. If you run a Hono app on Windows with Deno or Node.…
This release includes a security patch that fixes the vulnerability for serveStatic on Windows OS. If you run a Hono app on Windows with Deno or Node.js, you must upgrade to this version 3.9.2 immediately.
Note: You don't need upgrade it right now if you run it on Cloudflare, Deno on Linux/Unix/macOS, Deno Deploy, Bun, or Node.js on Linux/Unix/macOS.
Just increment the version specifier to v3.9.2.
import { Hono } from 'https://deno.land/x/hono@v3.9.2/mod.ts'
import { serveStatic } from 'https://deno.land/x/hono@v3.9.2/middleware.ts'
Upgrade the hono package via npm:
npm install hono
// OR
yarn add hono
// OR
pnpm up hono
You may not update the hono package with npm update, so please use npm install.
If you discover such a vulnerability, please contact us immediately. We will respond immediately; we have enabled GitHub's private vulnerability reporting feature, so please use that.
https://github.com/honojs/hono/security/advisories
Thanks.
Full Changelog: https://github.com/honojs/hono/compare/v3.9.1...v3.9.2
fix(package.json): export types correctly by @yusukebe in https://github.com/honojs/hono/pull/1633
package.json): export types correctly by @yusukebe in https://github.com/honojs/hono/pull/1633Full Changelog: https://github.com/honojs/hono/compare/v3.9.0...v3.9.1
Your coding agent can read these notes before it upgrades. Set up the MCP server →