ClickHouse ORM

The closest thing to an ORM for ClickHouse

Most teams searching for an ORM for ClickHouse are not looking for relations or migrations. They want generated types, query composition, and a way to reuse analytics logic without hand-maintaining interfaces. Prisma, Drizzle, and TypeORM were built for transactional databases. hypequery is built for ClickHouse.

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.

Most teams searching for a ClickHouse ORM actually need a reusable query layer

The official client gives you connectivity, not structure. Once ClickHouse powers app features, teams usually need generated types, reusable queries, and typed delivery paths rather than entity mapping.

How hypequery works

Schema-first types and composable queries for ClickHouse

hypequery introspects your live ClickHouse schema and generates a TypeScript interface for every table and column with the right ClickHouse-to-TypeScript mappings. You then build queries with a fluent builder that stays close to real ClickHouse usage.

  • 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 so table names, column names, and result shapes stay typed. Autocomplete works, refactors are safer, and the schema stays in sync by re-running generate.

This is the ORM-like experience for ClickHouse, but without pretending ClickHouse behaves like Postgres.

If you want the fastest proof, generate types from your own schema and write one real query. That will tell you more than another comparison table.

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.

Where teams usually get stuck

The questions this page should answer

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 useful part of the ORM promise is simple: types should come from the database, not from your imagination. That is exactly what hypequery gives you for ClickHouse.

Next step

Generate schema types and start with hypequery on a real ClickHouse query

Run schema generation against your ClickHouse instance, then build your first typed query. This is the fastest way to prove the ORM-like workflow on your real schema.