Katman
Integrations

NestJS

Use Katman as a NestJS controller — Express or Fastify under the hood.

Register Katman as a NestJS controller. Works with both Express and Fastify adapters.

Setup

// rpc.controller.ts
import { , , ,  } from "@nestjs/common"
import {  } from "katman/nestjs"
import {  } from "./rpc"

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

@("rpc")
export class  {
  @("*")
  async (@() : Request, @() : Response) {
    return (, )
  }
}

Procedures are accessible at:

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

Context from NestJS

The context factory receives the Express/Fastify request. Access guards, pipes, and other NestJS features through the request:

katmanNestHandler(appRouter, {
  : () => ({
    : .user,       // from NestJS AuthGuard
    : .ip,
    : .headers,
  }),
})

NestJS's own dependency injection, guards, and interceptors run before the Katman handler. You can use @UseGuards(), @UseInterceptors(), etc. alongside Katman.

What's next?

On this page