Skip to main content

Overview

contract-kit is the meta package for Contract Kit. It re-exports the core framework building blocks so you can get started with a single dependency.

Installation

npm install contract-kit zod

What’s Included

The meta package re-exports:
  • @contract-kit/core - Contract definitions and builders
  • @contract-kit/client - HTTP client for contract-based requests
  • @contract-kit/application - Use case factory (commands/queries)
  • @contract-kit/domain - Domain modeling helpers
  • @contract-kit/errors - Error catalog and utilities
  • @contract-kit/config - Environment-first configuration
  • @contract-kit/ports - Ports and provider system
  • @contract-kit/openapi - OpenAPI 3.1 generation

What’s Not Included

Install these separately if you need them:
  • Server adapters - @contract-kit/next, @contract-kit/server
  • React integrations - @contract-kit/react, @contract-kit/react-query, @contract-kit/react-hook-form
  • Providers - @contract-kit/provider-*

Quick Example

import { createContractGroup, createClient } from "contract-kit";
import { z } from "zod";

const todos = createContractGroup().namespace("todos");

export const getTodo = todos
  .get("/api/todos/:id")
  .path(z.object({ id: z.string() }))
  .response(200, z.object({
    id: z.string(),
    title: z.string(),
    completed: z.boolean(),
  }));

const client = createClient({ baseUrl: "https://api.example.com" });
const todo = await client.endpoint(getTodo).call({ path: { id: "123" } });

Next Steps