Skip to content

Plugins Overview

Add plugins for code generation, schema imports, API sync, or SQL backfills. Install TypeScript plugins as npm packages. Python plugins ship inside chkit-py; API sync requires TypeScript. Register plugins in your config:

import { defineConfig } from '@chkit/core'
import { codegen } from '@chkit/plugin-codegen'
import { pull } from '@chkit/plugin-pull'
export default defineConfig({
schema: './src/db/schema/**/*.ts',
outDir: './chkit',
plugins: [
codegen({ outFile: './src/generated/chkit-types.ts' }),
pull({ outFile: './src/db/schema/pulled.ts' }),
],
// ...
})

Plugin authors use lifecycle hooks to transform schema definitions before a diff, register CLI commands, run setup (onInit) or teardown (onComplete), and transform SQL before migration (onBeforeApply). The CLI: chkit plugin command lists plugins active in your config.

Follow the plugin reference to configure a published plugin. Use the lifecycle hooks when writing a plugin.

You can author your own plugins; the existing official plugins are the reference. See Contributing for the entry point.

For @chkit/plugin-obsessiondb (Python: chkit_plugin_obsessiondb), see the ObsessionDB section.

  • @chkit/plugin-codegen: TypeScript row types and optional Zod schemas (Python: Pydantic models), generated from your schema files.
  • @chkit/plugin-pull: introspect a live ClickHouse database into local schema files. Useful for adopting chkit on an existing database. Built into the Python CLI as chkit pull.
  • @chkit/plugin-backfill: time-windowed data backfill with checkpoints, for materialized views and historical data loads.
  • @chkit/plugin-ingest: API sync with an external scheduler with journaled checkpoints (TypeScript only). The dedicated guides cover source readers, storage, checkpoints, loading, and an installable skill.