Skip to content

chkit init

Creates a clickhouse.config.ts configuration file and an example schema file in your project. If either file already exists, it is left untouched.

chkit init

No command-specific flags. See global flags.

chkit init writes two files relative to the current working directory:

  1. clickhouse.config.ts — project configuration with sensible defaults:

    • schema: './src/db/schema/**/*.ts'
    • outDir: './chkit'
    • migrationsDir: './chkit/migrations'
    • metaDir: './chkit/meta'
    • plugins: []
    • clickhouse block reading from environment variables (CLICKHOUSE_URL, CLICKHOUSE_USER, CLICKHOUSE_PASSWORD, CLICKHOUSE_DB)
  2. src/db/schema/example.ts — a sample table definition using MergeTree engine with columns id (UInt64), source (String), and ingested_at (DateTime64(3)).

The command is idempotent — running it again on an existing project does nothing.

Initialize a new project:

Terminal window
chkit init

Output:

Created clickhouse.config.ts
Created src/db/schema/example.ts

Run on an existing project (no changes):

Terminal window
chkit init
# No output — both files already exist