Integrations
H3
Use Katman with H3 v2, Nitro, and Nuxt server routes.
H3 is a minimal HTTP framework used by Nitro and Nuxt. Katman's H3 adapter lets you mount RPC procedures alongside your existing routes.
Setup
import { } from "h3"
import { } from "katman/h3"
const = new ()
// Existing routes
.("/api/health", () => ({ : "ok" }))
// Katman RPC under /rpc prefix
.("/rpc/**", (appRouter, {
: () => ({
: getDB(),
: .context.user,
}),
}))Each procedure becomes available at its path under the prefix:
POST /rpc/users/list
POST /rpc/users/createContext from H3
The context function receives the H3 event. Use it to bridge H3's auth, session, or any middleware data into Katman's context:
katmanH3(appRouter, {
: () => ({
: .context.user, // from H3 middleware
: .req.headers.get("x-forwarded-for"),
}),
})Nitro / Nuxt server routes
In a Nitro or Nuxt project, create a catch-all server route:
// server/routes/rpc/[...].ts
import { } from "katman/h3"
import { } from "~/server/rpc"
export default (, {
: "/rpc",
: () => ({ : getDB() }),
})This adapter supports H3 v2 (used in Nitro v3 and Nuxt 4). For H3 v1, the API is similar but uses defineEventHandler instead of defineHandler.
What's next?
- Server — standalone
serve()as an alternative - Integrations — other available integrations