CLI
@contract-kit/cli creates new Contract Kit apps and gives the framework a place for maintenance commands over time.
Create a new app
bunx -p @contract-kit/cli contract-kit create my-app
By default the generated app uses the standard preset:
- One todos contract
- One typed in-memory port
- One validated application use case
- A Contract Kit server wired to Next.js route handlers
- A typed client
- TanStack Query
- React Hook Form
- OpenAPI output
Choose a preset
Presets describe the kind of app you want to start from. Integrations stay separate, so you only add the services your app needs.
bunx -p @contract-kit/cli contract-kit create my-app --preset standard
| Preset | Includes |
|---|---|
minimal | Contracts, ports, use cases, server wiring, and API routes |
standard | minimal plus typed client, React Query, React Hook Form, and OpenAPI |
production | Opinionated production starter with app errors, env validation, devtools, provider wiring, health checks, and separated ports/infrastructure |
Use minimal when you want API routes and contracts only:
bunx -p @contract-kit/cli contract-kit create my-api --preset minimal
Use standard when you want a simple full-stack app:
bunx -p @contract-kit/cli contract-kit create my-app --preset standard
Use production when you want the recommended production architecture:
bunx -p @contract-kit/cli contract-kit create my-app --preset production
Choose features
Features are framework capabilities layered onto the base app.
bunx -p @contract-kit/cli contract-kit create my-app \
--preset minimal \
--features client,openapi
Available features:
| Feature | Adds |
|---|---|
client | A typed Contract Kit HTTP client |
react-query | TanStack Query provider and contract query helpers |
forms | React Hook Form wired to the contract body schema |
openapi | /api/openapi route generated from contracts |
Choose integrations
Integrations add provider packages, setup notes, env examples, and provider wiring where the provider can run without app-specific infrastructure.
bunx -p @contract-kit/cli contract-kit create my-app \
--integrations drizzle-turso,inngest,pino
You can also repeat --integration:
bunx -p @contract-kit/cli contract-kit create my-app \
--integration inngest \
--integration resend
Selected integrations add the provider package, required peer dependencies, .env.example, and setup notes in docs/integrations.md.
For a production starter with extra services, compose the preset and integrations explicitly:
bunx -p @contract-kit/cli contract-kit create my-app \
--preset production \
--integrations drizzle-turso,inngest,resend,upstash-rate-limit
Available integrations:
| Integration | Adds |
|---|---|
better-auth | @contract-kit/provider-auth-better-auth, better-auth, and notes for replacing the production starter's anonymous AuthPort |
drizzle-turso | @contract-kit/provider-drizzle-turso, @libsql/client, drizzle-orm, drizzle-kit, and production persistence scaffolding |
inngest | @contract-kit/provider-inngest and inngest |
pino | @contract-kit/provider-logger-pino and pino |
resend | @contract-kit/provider-mail-resend and resend |
upstash-rate-limit | @contract-kit/provider-rate-limit-upstash, @upstash/ratelimit, and @upstash/redis |
Options
contract-kit create <directory> [options]
| Option | Description |
|---|---|
--template next | Selects the app template. next is the only template today. |
--preset standard | Selects minimal, standard, or production. Defaults to standard. |
--package-manager bun | Controls the package manager shown in next steps. |
--feature <name> | Adds one feature. Repeatable. |
--features <names> | Adds features from a comma-separated list. |
--integration <name> | Adds one integration. Repeatable. |
--integrations <names> | Adds integrations from a comma-separated list. |
--force | Writes into a non-empty directory. |