ts-rest

A TypeScript toolkit for defining a REST API contract once and getting a typed client and server from it. It works with frameworks like NestJS, Fastify and Next.js.

Share on XLicense: MIT

Overview

ts-rest is a TypeScript toolkit for defining a REST API contract once and using it on both client and server. The contract gives end-to-end type safety without code generation, and you can adopt it step by step in an existing app. It offers an RPC-like client, optional Zod validation, and optional OpenAPI output, and it works with frameworks such as NestJS, Fastify and Next.js.

Key features

  • Shared API contract with end-to-end type safety
  • RPC-like client side API
  • No code generation and a small bundle size
  • Zod support for runtime validation
  • Optional OpenAPI integration

Best for

TypeScript teams that want typed REST endpoints shared between frontend and backend while keeping a plain REST API. It can be adopted incrementally.

Upstream
ts-rest/ts-rest
Fork on GitHub
Guo-astro/ts-rest
Upstream stars
3.3k
Category
Developer tools and infrastructure
Language
TypeScript
License
MIT
Forked
2023-04-24
Sync status
In syncLast synced 2026-09-29