Overview
Contract Kit is part of a growing ecosystem of TypeScript libraries that provide end-to-end type safety for APIs. This page compares Contract Kit with similar libraries to help you choose the right tool for your project.Quick Comparison Table
| Feature | Contract Kit | tRPC | ts-rest | Hono RPC | Zodios |
|---|---|---|---|---|---|
| Protocol | REST | RPC | REST | RPC | REST |
| Type Safety | ✅ Full | ✅ Full | ✅ Full | ✅ Full | ✅ Full |
| Codegen | ❌ None | ❌ None | ❌ None | ❌ None | ❌ None |
| OpenAPI | ✅ Yes | ⚠️ Via plugin | ✅ Yes | ✅ Yes | ✅ Yes |
| Schema Libraries | Standard Schema | Zod/Superstruct/Yup | Zod | Zod | Zod |
| Architecture Support | Hexagonal/Clean | MVC/Custom | MVC/Custom | MVC/Custom | MVC/Custom |
| Framework Adapters | Next.js (more coming) | Multiple | Multiple | Hono-native | Express/etc |
| React Integration | Optional (@contract-kit/react-query) | Built-in | Optional | Limited | Limited |
| Dependency Injection | Built-in (Ports/Providers) | Custom | Custom | Custom | Custom |
Detailed Comparisons
Contract Kit vs tRPC
When to choose Contract Kit over tRPC
When to choose Contract Kit over tRPC
Contract Kit is a better choice when:
- You need RESTful APIs with proper HTTP semantics (methods, status codes, headers)
- You want OpenAPI/Swagger documentation out of the box
- You’re building with clean/hexagonal architecture patterns
- You need flexibility to use any Standard Schema library (Zod, Valibot, ArkType, etc.)
- You want built-in dependency injection with ports and providers
- Your API needs to be consumed by non-TypeScript clients
When to choose tRPC over Contract Kit
When to choose tRPC over Contract Kit
tRPC is a better choice when:
- You’re building a full-stack TypeScript application where client and server are always in the same monorepo
- You prefer RPC-style APIs over REST
- You need real-time subscriptions (tRPC has built-in WebSocket support)
- You want the most mature ecosystem with extensive community plugins
- You’re already using React Query heavily (tRPC integrates deeply with React Query)
Key Differences
API Style
Contract Kit: RESTful with proper HTTP methods, paths, and status codestRPC: RPC-style procedures (query/mutation) with custom protocol
OpenAPI
Contract Kit: Built-in OpenAPI generation from contractstRPC: Requires third-party plugins for OpenAPI support
Architecture
Contract Kit: Built-in hexagonal architecture with ports/providerstRPC: Flexible, but no opinionated architecture patterns
Schema Libraries
Contract Kit: Any Standard Schema library (Zod, Valibot, ArkType, etc.)tRPC: Zod, Superstruct, Yup, or custom validators
Contract Kit vs ts-rest
When to choose Contract Kit over ts-rest
When to choose Contract Kit over ts-rest
Contract Kit is a better choice when:
- You want built-in architecture patterns (hexagonal/clean architecture)
- You need dependency injection out of the box
- You prefer a more opinionated framework that guides structure
- You want integrated providers for common services (auth, mail, cache, etc.)
- You need support for any Standard Schema library, not just Zod
When to choose ts-rest over Contract Kit
When to choose ts-rest over Contract Kit
ts-rest is a better choice when:
- You want a minimal, unopinionated library you can integrate into any architecture
- You need maximum framework flexibility (works with Express, Fastify, Nest.js, etc.)
- You’re comfortable building your own architecture patterns
- You only need Zod for validation
Key Differences
Architecture
Contract Kit: Opinionated hexagonal architecture with built-in patternsts-rest: Minimal and unopinionated, fits into any architecture
Dependency Injection
Contract Kit: Built-in ports and providers systemts-rest: Bring your own DI solution
Framework Support
Contract Kit: Next.js (more adapters coming)ts-rest: Express, Fastify, Nest.js, Next.js, and more
Providers
Contract Kit: Pre-built providers for auth, mail, cache, etc.ts-rest: Build your own integrations
Contract Kit vs Hono RPC
When to choose Contract Kit over Hono RPC
When to choose Contract Kit over Hono RPC
Contract Kit is a better choice when:
- You need RESTful APIs with proper REST semantics
- You want hexagonal architecture support
- You need Next.js integration specifically
- You want built-in dependency injection and providers
- You need support for multiple schema libraries
When to choose Hono RPC over Contract Kit
When to choose Hono RPC over Contract Kit
Hono RPC is a better choice when:
- You’re already using Hono as your web framework
- You need edge runtime support (Cloudflare Workers, Deno, etc.)
- You want maximum performance and minimal overhead
- You prefer RPC-style APIs
Key Differences
Framework
Contract Kit: Standalone with adapters (Next.js, etc.)Hono RPC: Built specifically for Hono framework
Runtime
Contract Kit: Node.js focused (Next.js)Hono RPC: Edge runtime optimized
API Style
Contract Kit: RESTful with HTTP methods and status codesHono RPC: RPC-style procedures
Architecture
Contract Kit: Opinionated hexagonal architectureHono RPC: Minimal, flexible patterns
Contract Kit vs Zodios
When to choose Contract Kit over Zodios
When to choose Contract Kit over Zodios
Contract Kit is a better choice when:
- You want hexagonal architecture support
- You need built-in dependency injection
- You prefer Next.js integration
- You want more than just contracts (application layer, ports, providers)
- You need support for multiple schema libraries (not just Zod)
When to choose Zodios over Contract Kit
When to choose Zodios over Contract Kit
Zodios is a better choice when:
- You want a minimal contract-first library
- You only need Express support
- You’re already heavily invested in Zod
- You want a mature, stable library
Key Differences
Scope
Contract Kit: Full framework with architecture patternsZodios: Focused library for contracts and validation
Framework Support
Contract Kit: Next.js (more coming)Zodios: Express-focused
Architecture
Contract Kit: Built-in hexagonal architectureZodios: No architectural opinions
Maturity
Contract Kit: Prototype/exploratory - APIs may change before 1.0Zodios: Stable and mature
What Makes Contract Kit Unique?
Contract Kit stands out in several key areas:1. Hexagonal Architecture Built-In
Contract Kit is the only library with first-class support for clean/hexagonal architecture:2. Standard Schema Support
Works with any Standard Schema library, giving you maximum flexibility:- Zod
- Valibot
- ArkType
3. Optional Everything
Contract Kit is highly modular - use only what you need:- Core contracts without server/client
- Server without React
- React Query without React Hook Form
- Providers individually (auth, mail, cache, etc.)
4. Pre-Built Providers
Save time with ready-to-use provider integrations:- Auth: Better Auth integration
- Database: Drizzle + Turso
- Cache: Redis, Upstash
- Mail: Resend, SMTP
- Jobs: Inngest
- Rate Limiting: Upstash
Decision Guide
Choose your API style
- Need REST APIs? → Contract Kit, ts-rest, or Zodios
- Prefer RPC? → tRPC or Hono RPC
Consider your architecture
- Want clean/hexagonal architecture? → Contract Kit
- Need flexibility? → ts-rest, tRPC, Zodios
Evaluate framework compatibility
- Using Next.js? → Contract Kit or ts-rest
- Using Express? → ts-rest, Zodios
- Using Hono? → Hono RPC
- Need multiple frameworks? → ts-rest
Migration Paths
From tRPC
If you’re considering moving from tRPC to Contract Kit:What's similar
What's similar
- End-to-end type safety without codegen
- Runtime validation with schema libraries
- TypeScript inference for inputs and outputs
What's different
What's different
- REST instead of RPC (proper HTTP methods and status codes)
- Built-in OpenAPI generation
- Hexagonal architecture patterns
- Ports and providers for dependency injection
Migration considerations
Migration considerations
- You’ll need to restructure from procedures to REST endpoints
- OpenAPI docs will be automatically available
- You can adopt clean architecture gradually
- React Query integration is similar but separate package
From ts-rest
If you’re considering moving from ts-rest to Contract Kit:What's similar
What's similar
- Contract-first REST APIs
- Type-safe clients and servers
- OpenAPI generation support
What's different
What's different
- Built-in hexagonal architecture
- Ports and providers system
- Opinionated structure (less flexibility)
- Pre-built provider integrations
Migration considerations
Migration considerations
- Contract definitions are very similar
- You’ll gain architecture patterns and DI
- Currently limited to Next.js (more adapters coming)
- Pre-built providers save integration time
Acknowledgements
Contract Kit wouldn’t exist without the pioneering work of:- tRPC – for proving end-to-end type safety without codegen is possible and valuable
- ts-rest – for demonstrating contract-first REST APIs work beautifully with TypeScript
- Laravel – for showing that frameworks can be both elegant and powerful