Katman
Integrations

Nitro

Use Katman with Nitro v3 — as the server framework (like Hono) or alongside H3 routes.

Nitro is the server engine behind Nuxt and TanStack Start. Katman integrates with Nitro in two ways: as the server framework (replacing H3, like Hono does) or alongside H3 file-system routes.

Just like Hono with Nitro, export an object with a fetch method from server.ts. Nitro detects it and uses Katman as the server framework:

// server.ts
import { ,  } from "katman"
import {  } from "zod"

const  = ({
  : () => ({
    : getDB(),
    : .(.),
  }),
})

const { , , , ,  } = 

const  = (() => ({ : "ok" }))

const  = (
  .({ : .().() }),
  ({ ,  }) => ..users.findMany({ : . }),
)

const  = ({ , : { :  } })

// Export with fetch — Nitro uses it directly
export default { : () }

No H3, no file-system routing, no katmanNitro adapter — Katman IS the framework. Full content negotiation (JSON, MessagePack, devalue) works out of the box.

POST /health          → { status: "ok" }
POST /users/list      → [{ id: 1, name: "Alice" }, ...]

This is the same pattern Hono uses with Nitro. Nitro detects the fetch method on the default export and routes all requests through it.

H3 mode

If you need Nitro's file-system routing or want to mix Katman with H3 routes, use the katmanNitro adapter:

// server/routes/rpc/[...path].ts
import {  } from "katman/nitro"
import {  } from "~/server/rpc"

export default (, {
  : () => ({
    : getDB(),
    : ..,
  }),
})

Nitro maps [...path] to the procedure path:

POST /rpc/users/list     → users/list
POST /rpc/users/create   → users/create

Context from Nitro middleware

// server/middleware/auth.ts
import {  } from "nitro/h3"

export default (() => {
  .. = verifyToken(...("authorization"))
})
// server/routes/rpc/[...path].ts
export default katmanNitro(appRouter, {
  : () => ({
    : .context.auth,
  }),
})

Which mode to choose?

ScenarioMode
New project, Katman is the only frameworkDirect ({ fetch: handler() })
Existing Nitro/Nuxt app, adding RPCH3 (katmanNitro())
Need H3 middleware (auth, session, etc.)H3
Want full protocol support (msgpack, devalue, SSE)Direct

Both modes target Nitro v3 (H3 v2). For Nitro v2 (Nuxt 3), use the H3 adapter instead.

Examples

Working examples in the repo:

What's next?

  • H3 — lower-level H3 v2 adapter
  • Server — standalone serve() with full protocol support
  • Integrations — other available integrations

On this page