Generate types from your schema. Build queries with full autocomplete and compile-time validation. Catch errors before they hit production.
No type safety — column names are plain strings. Typo in a column name? You won't know until runtime. In production. At 3am.
No autocomplete — your IDE can't help you. Every query is a black box of string concatenation. Want to know what columns exist? Go check the ClickHouse console.
No schema codegen — every time you add a column, you manually update TypeScript interfaces. They drift apart. Nobody notices until the wrong data flows through.
No ClickHouse features — Kysely doesn't know about FINAL, argMax, SETTINGS, or ReplacingMergeTree. Prisma and Drizzle don't even support ClickHouse.
chtype generates types directly from your ClickHouse schema, then gives you a query builder that catches every mistake at compile time.
Run one command and get TypeScript types for every table. Row types for reads, Insert types for writes — with DEFAULT columns optional and MATERIALIZED columns excluded automatically.
Column names, operators, sort directions — all validated at compile time. Typo a column name? TypeScript catches it before you even save the file. No more runtime surprises.
argMax for ReplacingMergeTree deduplication, FINAL modifier, query-level SETTINGS, engine-aware types. Features that generic query builders like Kysely or Drizzle simply can't offer.
chtype compiles down to plain parameterized SQL. No ORM magic, no runtime reflection, no query overhead. Just type-safe queries that run exactly as fast as hand-written SQL.
One command generates your types. Then your IDE does the rest.
Type safety, autocomplete, and codegen. All in one lightweight package.