Katman
Integrations

Next.js

Use Katman with Next.js App Router — API routes with full type safety and protocol support.

Katman integrates with Next.js App Router via catch-all API routes. Full content negotiation (JSON, MessagePack, devalue) works out of the box.

Setup

Create a catch-all API route:

// app/api/rpc/[...path]/route.ts
import {  } from "katman/nextjs"
import {  } from "~/server/rpc"

const  = (, {
  : "/api/rpc",
  : () => ({
    : getDB(),
    : .(.),
  }),
})

export {  as ,  as  }

Procedures are accessible at:

POST /api/rpc/users/list
POST /api/rpc/users/create
GET  /api/rpc/health

Server Actions

For server-first React apps, use React Server Actions instead of API routes:

// app/actions.ts
"use server"
import {  } from "katman/react"

export const  = (appRouter.users.list)

Edge Runtime

The handler uses standard Fetch API — works on both Node.js and Edge runtime:

export const  = "edge"

Katman compiles the router once at module load time. Next.js caches module imports across requests, so the compilation cost is paid only once per cold start.

What's next?

On this page