ClickHouse schema and migration CLI for TypeScript projects.
Define your ClickHouse schema in TypeScript, generate migrations automatically, detect drift, and run CI checks -- all from a single CLI.
- Schema-as-code -- Define tables, views, and materialized views in TypeScript using a declarative DSL
- Automatic migration generation -- Diff your schema changes and generate timestamped SQL migrations with rename detection
- Safe migrations -- Destructive operations are flagged with risk levels and require explicit confirmation
- Drift detection -- Compare your local schema against a live ClickHouse instance to catch out-of-band changes
- CI gate -- Run
chkit checkto fail builds on pending migrations, checksum mismatches, or schema drift - TypeScript codegen -- Generate row types and optional Zod schemas from your schema definitions (
@chkit/plugin-codegen) - Schema pulling -- Introspect an existing ClickHouse database into local schema files (
@chkit/plugin-pull) - Data backfill -- Time-windowed, checkpointed backfill operations with retry logic (
@chkit/plugin-backfill) - JSON output -- Every command supports
--jsonfor scripting and automation
bun add -d chkit# Scaffold a new project
bunx chkit init
# Generate a migration from schema changes
bunx chkit generate --name add-users-table
# Preview and apply pending migrations
bunx chkit migrate --apply
# Check migration status
bunx chkit status
# Detect schema drift
bunx chkit drift
# CI gate (fails on pending migrations or drift)
bunx chkit checkAll commands support --json for machine-readable output and --config <path> to specify a custom config file.
| Plugin | Description |
|---|---|
@chkit/plugin-codegen |
Generate TypeScript row types and Zod schemas |
@chkit/plugin-pull |
Pull schemas from a live ClickHouse instance |
@chkit/plugin-backfill |
Time-windowed data backfill with checkpoints |
@chkit/plugin-obsessiondb |
Auto-rewrite Shared engines for ObsessionDB compatibility |
Install the chkit agent skill so AI coding assistants understand chkit:
npx skills add obsessiondb/chkitSee the chkit documentation.
Sponsored by ObsessionDB