byteNative
Backend

tRPC

Type-safe APIs without schema duplication, end-to-end in TypeScript.

What is tRPC?

tRPC connects frontend and backend in a type-safe way, with no duplicated schemas and no extra generation step. Instead of maintaining a separate API description, tRPC infers the types straight from your server functions and hands them to the client. In a shared TypeScript project the client notices every change to the backend at once, because type checking makes it immediately visible. It feels as though both sides are a single, connected program.

More in the documentation

How we use it

We use tRPC when frontend and backend live in the same repository and only we serve both sides. You rename a server function and the client immediately points you at every spot that needs to follow. That spares a small codebase a lot of manual coordination and speeds up every change.

ts
import { z } from "zod";
import { publicProcedure, router } from "./trpc";

export const appRouter = router({
  getUser: publicProcedure
    .input(z.object({ id: z.string() }))
    .query(({ input }) => db.user.findById(input.id)),
});
procedure with input validation, types follow automatically

Good to know

The type safety holds at build time only; it does not replace real validation of incoming data at runtime. So we attach a zod schema to every procedure, so malformed input is rejected cleanly instead of slipping through.

00Backend

More tools we work with in the same area.

Which technology fits you?

You don't have to decide that, it's our job. Tell us about your plans.