Type-Safe Client
The client SDK is automatically typed from your API definition. No codegen, no compile step — just TypeScript.
@farbenmeer/tapi lets you build REST APIs with a fully typed client SDK — client and server share the same type definitions with no code generation or build step involved.
npm install @farbenmeer/tapiType-Safe Client
The client SDK is automatically typed from your API definition. No codegen, no compile step — just TypeScript.
Auth by Default
Every route requires an explicit authorizer function, making it nearly impossible to accidentally ship an unauthenticated endpoint.
Built-in Validation
Request and response validation powered by Zod. Define your schema once, get validation and types together.
Automatic OpenAPI
An OpenAPI schema is auto-generated from your route definitions and served at /.well-known/openapi.json.
Tag-Based Caching
Integrated support for tag-based cache invalidation via @farbenmeer/tag-based-cache.
Offline Ready
Automatic service worker caching means apps built with TApi are available offline by default.
The easiest way to use TApi is with the Bunny Framework. For standalone usage:
import { defineApi } from "@farbenmeer/tapi/server";import { z } from "zod";
export const api = defineApi().route( "/hello", import("./api/hello"));import { defineHandler } from "@farbenmeer/tapi/server";import { z } from "zod";
export default defineHandler({ GET: { output: z.object({ message: z.string() }), handler: async () => ({ message: "Hello, world!" }), },});// Client usageimport { createFetchClient } from "@farbenmeer/tapi/client";import type { api } from "./api";
const client = createFetchClient<typeof api.routes>("/api");const { message } = await client.hello.get();