Release Notes
Hono v3.9.0 is out now! Let's take a look at what's new.
Improving the Developer Experience for JSX
Now we have the types for JSX.
Type definitions for JSX intrinsic elements are available. So, you can write your JSX with type annotation.
You can also override the definitions to add your custom elements and attributes.
declare global {
namespace JSX {
interface IntrinsicElements {
'my-custom-element': Hono.HTMLAttributes & {
'x-event'?: 'click' | 'scroll'
}
}
}
}
Clerk Middleware
Now Clerk Middleware is available! You can use Clerk for authentication in your application.
import { clerkMiddleware, getAuth } from '@hono/clerk-auth'
import { Hono } from 'hono'
const app = new Hono()
app.use('*', clerkMiddleware())
app.get('/', (c) => {
const auth = getAuth(c)
if (!auth?.userId) {
return c.json({
message: 'You are not logged in.'
})
}
return c.json({
message: 'You are logged in!',
userId: auth.userId
})
})
export default app
Thanks @octoper!
New Starter Template for Cloudflare Pages
The Cloudflare Pages starter template is now Vite-based! You can develop truly full-stack applications quickly and fast thanks to Vite's HMR.
It uses Hono's original dev-server provided by @hono/vite-dev-server. And uses @hono/vite-cloudflare-pages for building the application. The config file is very neat.
import { defineConfig } from 'vite'
import devServer from '@hono/vite-dev-server'
import pages from '@hono/vite-cloudflare-pages'
export default defineConfig({
plugins: [
pages(),
devServer({
entry: 'src/index.tsx'
})
]
})
You can use it with the create hono
command:
npm create hono@latest
Ecosystem
The ecosystem has evolved. We introduce two products for Hono and one framework using Hono. Try them!
- Hono Storage - Hono Storage is a storage helper for Hono, similar to multer in Express. by @sor4chi
- Hono for Durable Object - Hono DO is a wrapper for Cloudflare Workers' Durable Object, designed for Hono. by @sor4chi
- Hwy - Hwy is a simple, lightweight, and flexible web framework, built on Hono and HTMX. by @sjc5