Skip to content

Add to an existing project

Install chkit alongside your existing application code, drop a minimal config and starter schema into the current directory, and produce your first migration. Use this path when you already have a TypeScript project that talks to ClickHouse.

  • Node.js 20+ or Bun 1.3.5+
  • A ClickHouse endpoint (CLICKHOUSE_URL, optionally CLICKHOUSE_USER, CLICKHOUSE_PASSWORD, CLICKHOUSE_DB)

Add chkit and @chkit/core as dev dependencies:

$ bun add -d chkit @chkit/core

chkit init writes clickhouse.config.ts (config with sensible defaults) and src/db/schema/example.ts (a starter MergeTree table). It’s idempotent — running it on an existing project leaves both files untouched.

$ bunx chkit init

Edit src/db/schema/example.ts to match the table you actually want before moving on.

chkit generate diffs your schema definitions against the previous snapshot and writes migration SQL into chkit/migrations/. Pass --name to label the migration file.

$ bunx chkit generate --name init

chkit migrate --apply runs unapplied migrations against the ClickHouse endpoint from your environment. Make sure CLICKHOUSE_URL (and any auth env vars) are set before running this.

$ bunx chkit migrate --apply

chkit status shows which migrations have been applied. chkit check confirms the live schema matches your TypeScript definitions.

$ bunx chkit status
$ bunx chkit check

chkit ships an agent skill so AI coding assistants (Claude Code, Cursor, GitHub Copilot, Codex, Windsurf, and others) understand chkit commands, schema DSL, and workflows.

On the first interactive run, chkit detects your agent and prompts to install the skill. To install it manually at any time:

$ bunx skills add obsessiondb/chkit

The skill is installed into your project’s agent directory (e.g. .claude/skills/chkit/, .cursor/skills/chkit/).