Katman
Integrations

Astro

Use Katman with Astro API routes.

Astro supports server-side API routes via file-based routing. Katman integrates via a catch-all endpoint.

Setup

Create a catch-all API route:

// src/pages/api/rpc/[...path].ts
import {  } from "katman/astro"
import {  } from "~/server/rpc"

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

export const  = 
export const  = 

Procedures are accessible at:

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

SSR mode

Katman requires server-side rendering. Enable it in your Astro config:

// astro.config.mjs
export default defineConfig({
  : "server",
})

What's next?

  • Server — standalone serve() as an alternative
  • Integrations — other available integrations

On this page