{"id":51629689,"url":"https://github.com/obsessiondb/chkit","last_synced_at":"2026-07-13T06:00:57.242Z","repository":{"id":340822148,"uuid":"1153717828","full_name":"obsessiondb/chkit","owner":"obsessiondb","description":"ClickHouse schema and migration CLI for TypeScript projects","archived":false,"fork":false,"pushed_at":"2026-07-07T08:10:41.000Z","size":18181,"stargazers_count":17,"open_issues_count":1,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-07-07T09:23:06.690Z","etag":null,"topics":["cli","clickhouse","clickhouse-migrations","database","migrations","schema","typescript"],"latest_commit_sha":null,"homepage":"https://chkit.obsessiondb.com","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/obsessiondb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-09T16:06:39.000Z","updated_at":"2026-07-07T08:10:45.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/obsessiondb/chkit","commit_stats":null,"previous_names":["obsessiondb/chkit"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/obsessiondb/chkit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obsessiondb%2Fchkit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obsessiondb%2Fchkit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obsessiondb%2Fchkit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obsessiondb%2Fchkit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/obsessiondb","download_url":"https://codeload.github.com/obsessiondb/chkit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obsessiondb%2Fchkit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35412247,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-13T02:00:06.543Z","response_time":119,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","clickhouse","clickhouse-migrations","database","migrations","schema","typescript"],"created_at":"2026-07-13T06:00:30.618Z","updated_at":"2026-07-13T06:00:57.227Z","avatar_url":"https://github.com/obsessiondb.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./assets/hero.png\" alt=\"chkit — ClickHouse schema and migrations, as code\" width=\"100%\"\u003e\n\u003c/p\u003e\n\n# chkit\n\n**ClickHouse schema and migration CLI for TypeScript projects.**\n\n[![npm version](https://img.shields.io/npm/v/chkit?label=npm)](https://www.npmjs.com/package/chkit)\n[![CI](https://github.com/obsessiondb/chkit/actions/workflows/ci.yml/badge.svg)](https://github.com/obsessiondb/chkit/actions/workflows/ci.yml)\n[![Docs](https://img.shields.io/badge/docs-chkit.obsessiondb.com-blue)](https://chkit.obsessiondb.com)\n\nDefine your ClickHouse tables, views, and materialized views in TypeScript. chkit diffs your schema, generates migration SQL, applies it safely, and keeps your dev and production databases in sync -- all from the command line.\n\n\u003e **Status: beta.** chkit powers production workloads and the CLI surface and schema DSL are stable. We may still make small breaking changes to UX and internal APIs before 1.0.\n\n## Key Features\n\n- **TypeScript-native schema definitions** -- tables, views, materialized views\n- **Automatic migration generation** -- diff-based SQL from your schema changes\n- **Safe migration execution** -- preview first, destructive-operation blocking\n- **Schema drift detection** -- compare live database to expected state\n- **CI gate command** -- `chkit check` fails your build on pending migrations or drift\n- **TypeScript codegen** -- row types and optional Zod schemas from your schema\n- **Plugin system** -- pull, codegen, backfill, or write your own\n- **JSON output mode** -- `--json` on every command for scripting\n\n## Quick Start\n\n```bash\nbun add -d chkit @chkit/core\nbunx chkit init\n```\n\nDefine a table in `src/db/schema/example.ts`:\n\n```ts\nimport { schema, table } from '@chkit/core'\n\nconst events = table({\n  database: 'default',\n  name: 'events',\n  engine: 'MergeTree',\n  columns: [\n    { name: 'id', type: 'UInt64' },\n    { name: 'source', type: 'String' },\n    { name: 'ingested_at', type: 'DateTime64(3)', default: 'fn:now64(3)' },\n  ],\n  primaryKey: ['id'],\n  orderBy: ['id'],\n  partitionBy: 'toYYYYMM(ingested_at)',\n})\n\nexport default schema(events)\n```\n\nGenerate and apply your first migration:\n\n```bash\nbunx chkit generate --name init\nbunx chkit migrate --apply\nbunx chkit status\n```\n\n## Commands\n\n| Command | Description |\n|---------|-------------|\n| `chkit init` | Scaffold config and example schema |\n| `chkit generate` | Diff schema and generate migration SQL |\n| `chkit migrate` | Preview and apply pending migrations |\n| `chkit status` | Show migration counts and checksum status |\n| `chkit drift` | Compare live database to expected schema |\n| `chkit check` | CI gate: fail on pending/drift/mismatch |\n| `chkit codegen` | Generate TypeScript types from schema |\n| `chkit pull` | Pull existing ClickHouse schema to local files |\n\nAll commands support `--json` for machine-readable output. See the [full CLI reference](https://chkit.obsessiondb.com/cli/overview/) for details.\n\n## Configuration\n\n```ts\n// clickhouse.config.ts\nimport { defineConfig } from '@chkit/core'\nimport { pull } from '@chkit/plugin-pull'\nimport { codegen } from '@chkit/plugin-codegen'\n\nexport default defineConfig({\n  schema: './src/db/schema/**/*.ts',\n  outDir: './chkit',\n  plugins: [\n    pull({ outFile: './src/db/schema/pulled.ts' }),\n    codegen({ outFile: './src/generated/chkit-types.ts' }),\n  ],\n  clickhouse: {\n    url: process.env.CLICKHOUSE_URL ?? 'http://localhost:8123',\n    username: process.env.CLICKHOUSE_USER ?? 'default',\n    password: process.env.CLICKHOUSE_PASSWORD ?? '',\n    database: process.env.CLICKHOUSE_DB ?? 'default',\n  },\n})\n```\n\nSee the [configuration docs](https://chkit.obsessiondb.com/configuration/overview/) for all options.\n\n## Packages\n\n| Package | Description |\n|---------|-------------|\n| [`chkit`](packages/cli) | CLI binary and command implementations |\n| [`@chkit/core`](packages/core) | Schema DSL, config, and diff engine |\n| [`@chkit/clickhouse`](packages/clickhouse) | ClickHouse client wrapper |\n| [`@chkit/codegen`](packages/codegen) | TypeScript type generation engine |\n| [`@chkit/plugin-pull`](packages/plugin-pull) | Pull live schema into local files |\n| [`@chkit/plugin-codegen`](packages/plugin-codegen) | Codegen plugin for the CLI |\n| [`@chkit/plugin-backfill`](packages/plugin-backfill) | Backfill plugin for data migrations |\n| [`@chkit/plugin-obsessiondb`](packages/plugin-obsessiondb) | ObsessionDB integration: auto-rewrite `Shared` engines for ClickHouse targets |\n\n## Documentation\n\nFull documentation is available at **[chkit.obsessiondb.com](https://chkit.obsessiondb.com)**.\n\n## ObsessionDB\n\nchkit is built by the team behind [**ObsessionDB**](https://obsessiondb.com), a fully-managed ClickHouse database. ObsessionDB is the recommended way to run chkit in production:\n\n- **First-party integration.** The [`@chkit/plugin-obsessiondb`](packages/plugin-obsessiondb) plugin auto-detects ObsessionDB and keeps your schema on `SharedReplacingMergeTree` / `SharedMergeTree` for managed replication — same TypeScript schema as your local ClickHouse, no manual switching.\n- **No ops.** No Keeper, no replica tuning, no manual scaling.\n- **Tested alongside chkit.** Every chkit release runs its E2E suite against ObsessionDB.\n\n[Try ObsessionDB →](https://obsessiondb.com)\n\n## Community\n\n- [@ObsessionDB on X](https://x.com/ObsessionDB) — release notes and updates\n- [GitHub Issues](https://github.com/obsessiondb/chkit/issues) — bugs and feature requests\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and guidelines.\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fobsessiondb%2Fchkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fobsessiondb%2Fchkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fobsessiondb%2Fchkit/lists"}