ClickHouse ORM

The closest thing to a TypeScript ORM for ClickHouse

Prisma, Drizzle, and Kysely were built for transactional databases. ClickHouse is an analytics database with a fundamentally different data model — and it needs a different tool. hypequery gives you the schema-first, type-safe developer experience of an ORM without the wrong abstractions.

Type source

Generated from live schema

Target database

ClickHouse native

Best for

Analytics-heavy TypeScript apps

Transactional ORMs are the wrong abstraction for ClickHouse

Prisma and Drizzle model rows, relationships, and transactions. ClickHouse is columnar, append-optimised, and designed for aggregations over billions of rows — not joins and foreign keys. Forcing a relational ORM onto it produces awkward code and missing features.

Kysely and generic query builders do not understand ClickHouse types

Kysely is excellent for Postgres. For ClickHouse it needs adapting: DateTime returns as a string, UInt64 returns as a string, Nullable works differently. You end up hand-writing type mappings that drift from reality.

@clickhouse/client gives you a connection but no structure

The official client runs queries and returns untyped results. You get full control but you also build the entire type layer, reuse layer, and API layer yourself — which most teams end up reinventing repeatedly.

How hypequery works

Schema-first types and composable queries, built for ClickHouse

hypequery introspects your live ClickHouse schema and generates a TypeScript interface for every table and column — with correct ClickHouse-to-TypeScript type mappings. You then build queries using a fluent builder that understands ClickHouse natively.

  • Schema types generated from your live ClickHouse database — not hand-written
  • Correct runtime mappings: DateTime→string, UInt64→string, Nullable→T|null
  • Composable query builder with typed filters, joins, CTEs, and raw SQL escape hatches
  • Same query definition runs inline, over HTTP, or as a React hook
  • OpenAPI docs generated automatically from query definitions

Step 1

Generate types from your ClickHouse schema

how-hypequery-works.ts

One command introspects your live ClickHouse instance and outputs a TypeScript interface for every table. This is what makes the query builder fully typed without hand-maintaining interfaces.

Step 2

Build typed queries from generated schema

The query builder uses the generated schema types so every table name, column name, and return value is fully typed. Autocomplete works. Refactors are safe. The schema stays in sync by re-running generate.

This is the ORM-like experience for ClickHouse — not a relational ORM adapted to fit, but a tool designed from the ground up for the ClickHouse data model and the TypeScript developer workflow.

Read the query builder guide or the comparison with @clickhouse/client to understand exactly what you get and where the boundaries are.

Step 2

Typed queries from generated schema

step-2.ts

Autocomplete on table names and column names. Return types inferred from the schema. No hand-written interfaces, no silent drift when columns change.

Why teams search for this

Common implementation questions this page should solve

ClickHouse ORM TypeScript

There is no Prisma or Drizzle for ClickHouse — the data model is too different. hypequery is the schema-driven, type-safe query layer that fills that gap, built specifically for ClickHouse analytics workloads.

Prisma alternative for ClickHouse

Prisma does not support ClickHouse. hypequery gives you the same schema-first experience — generate types from your database, build typed queries, and get autocomplete — without needing a relational data model.

Drizzle alternative for ClickHouse

Drizzle does not support ClickHouse. hypequery is the TypeScript-first ClickHouse alternative — schema generation, a composable query builder, and typed HTTP APIs designed for analytics-heavy applications.

Type-safe ClickHouse queries without hand-written interfaces

The core ORM value proposition — types that come from the database, not from your imagination — is exactly what hypequery provides for ClickHouse. Run generate, get types, build queries.

Next step

Generate schema types and write your first typed query

Run schema generation against your ClickHouse instance, then build a typed query. The whole setup takes under five minutes.