Hono
Add authentication to a Hono app with Clowk: install, configure your keys, and protect routes with JWT middleware on Workers, Bun, Deno or Node.js.
Install
pnpm add @clowk/hono @clowk/coreConfigure
import { Hono } from 'hono'
import { clowkMiddleware, requireAuth } from '@clowk/hono'
const app = new Hono()Protect all routes
Apply the middleware globally. The decoded JWT is available via c.get('auth'):
app.use(clowkMiddleware({
secretKey: process.env.CLOWK_SECRET_KEY,
}))
app.get('/me', (c) => {
const auth = c.get('auth')
return c.json({ user: auth })
})
export default appProtect specific routes
Use requireAuth() to gate routes — returns 401 if no valid token:
app.get('/public', (c) => {
return c.json({ message: 'This is public' })
})
app.get('/dashboard', requireAuth(), (c) => {
const auth = c.get('auth')
return c.json({ user: auth })
})Runtimes
Hono + Clowk works on every runtime. @clowk/core uses native fetch and Web Crypto APIs — no Node.js-specific dependencies.
| Runtime | Deploy target |
|---|---|
| Cloudflare Workers | wrangler deploy |
| Bun | bun run src/index.ts |
| Deno | deno run src/index.ts |
| Node.js | node src/index.ts |
Next steps
- Express quickstart — if you need Express compatibility
- Full Hono integration — complete API reference
Express
Add authentication to an Express app with Clowk in a few steps: install the SDK, set your keys, and protect routes with clowkMiddleware and requireAuth.
FAQ
Answers to common questions about Clowk: pricing, open source and hosting, Clowk vs Clerk, supported frameworks, password storage and what if it goes down.