Introduction
What is Katman and why should you use it?
What is Katman?
Katman is a TypeScript library that lets you build APIs with full type safety from the server all the way to the client. You define your API procedures once, and TypeScript makes sure everything is connected correctly — inputs, outputs, errors, and context.
The name comes from the Turkish word for "layer". The idea is simple: you build your API in clean, composable layers. Each layer has one job.
How does it work?
You write functions on the server. Katman compiles them into a fast pipeline at startup. Then you call those functions from the client with full autocomplete — no code generation, no manual type definitions.
import { } from "katman"
import { } from "zod"
// 1. Create an instance
const = ({
: () => ({ : getDB() }),
})
// 2. Define a procedure
const = .(
.({ : .().() }),
({ , }) => ..users.findMany({ : . }),
)
// 3. Create a router and start the server
.(.({ }), { : 3000 })That's it. The client gets full types automatically.
Key ideas
Single package. You install one thing: katman. Server, client, plugins, codecs — all included. No juggling five scoped packages.
Standard Schema. Katman doesn't lock you into Zod. It uses the Standard Schema spec, so Valibot and ArkType work too.
Compiled pipeline. When your server starts, Katman pre-links all your middleware into a direct function chain. No closures are created per request.
Multiple protocols. JSON by default, MessagePack for binary, devalue for rich types like Date and Map. The server picks the right format based on what the client asks for.