What is Contract Kit?
Contract Kit is a contract-first TypeScript framework for building type-safe APIs and typed clients without codegen. It works with any Standard Schema library (Zod, Valibot, ArkType, etc.).Key Features
Type-Safe Contracts
Define HTTP contracts once and get end-to-end type safety across your entire stack
No Codegen
No build steps or code generation required - just runtime validation and TypeScript inference
Standard Schema Support
Works with Zod, Valibot, ArkType, or any Standard Schema library
Clean Architecture
Built-in support for hexagonal architecture with ports and providers
What You Get
Contract Kit provides a comprehensive toolkit for building modern TypeScript applications:- Contracts: Define method, path, schemas (path/query/body/response/errors), and metadata
- Server runtime: Adapter-agnostic request pipeline with parsing, validation, middleware, and error mapping
- Server adapters: Next.js support (with more coming)
- Client: Typed fetch wrapper driven by the same contract
- Application layer: Use cases with commands and queries
- Ports + Providers: Hexagonal-style dependency injection (db, mail, cache, rate limit, jobs, logging…)
- OpenAPI: Generate OpenAPI 3.1 specifications from your contracts
- Optional React: TanStack Query + React Hook Form helpers
Philosophy
Contract Kit is designed around these principles:- Contracts as the source of truth - Define once, use everywhere
- Avoid code generation - Leverage TypeScript’s type system for inference
- Support clean architecture - Built with hexagonal architecture in mind
- Stay modular - Use the entire framework or just the pieces you need
- Scale from MVPs to production - Start simple, grow as needed
Quick Example
Quickstart
Get started with Contract Kit in minutes
Installation
Learn how to install Contract Kit and its dependencies
Acknowledgements
Contract Kit is inspired by and builds upon ideas from several excellent projects:- tRPC – for pioneering end-to-end type safety without codegen in TypeScript
- ts-rest – for demonstrating contract-first REST APIs with TypeScript
- Laravel – for showing how framework elegance and developer experience can coexist with power and flexibility