# @chkit/plugin-codegen Plugin to generate TypeScript row types and optional Zod schemas from your chkit schema definitions. Part of the [chkit](https://github.com/obsessiondb/chkit) monorepo. This plugin extends the [`chkit`](https://www.npmjs.com/package/chkit) CLI with TypeScript code generation. ## Install ```bash bun add -d @chkit/plugin-codegen zod ``` `zod` is a peer dependency (`^4.0.0`): the plugin uses it at runtime, and any generated Zod schemas (`emitZod: true`) import `zod` from your project. Install the same `zod` your project already uses to avoid duplicate copies. ## Usage Register the plugin in your config: ```ts // clickhouse.config.ts import { defineConfig } from '@chkit/core' import { codegen } from '@chkit/plugin-codegen' export default defineConfig({ schema: './src/db/schema/**/*.ts', outDir: './chkit', plugins: [ codegen({ outFile: './src/generated/chkit-types.ts', emitZod: false, emitIngest: false, }), ], clickhouse: { url: process.env.CLICKHOUSE_URL ?? 'http://localhost:8123', }, }) ``` Then run: ```bash bunx chkit codegen ``` Codegen also runs automatically after `chkit generate` when `runOnGenerate` is enabled (default). When `emitIngest` is enabled, generated ingest helpers gzip-compress request bodies by default. Pass `{ compressed: false }` as the third argument to disable compression for a specific insert. ## Documentation See the [chkit documentation](https://chkit.obsessiondb.com). ## License [MIT](../../LICENSE)