npm install @hypequery/clickhouse

Type-Safe Query Builder for ClickHouse

Stop writing raw SQL. Build dashboards, APIs, and data pipelines with compile-time validation. Our TypeScript SDK brings type safety to analytical workloads.

The Challenge

ClickHouse queries, meet type safety

Without types, ClickHouse queries are error-prone. String concatenation leads to SQL injection risks. Runtime errors cause production issues. And the disconnect between queries and result types wastes developer time.

The Solution

A type-safe query builder designed for developers

hypequery provides a fluent, type-safe API that makes working with ClickHouse a joy. Say goodbye to SQL strings and hello to autocomplete, runtime safety, and developer productivity.

Before: Raw SQL

Typescript
// ❌ Error-prone string concatenation
const query = `
  SELECT user_id, name, email
  FROM users
  WHERE age > '${userAge}'
    AND status = '${userStatus}'
  ORDER BY created_at DESC
  LIMIT 10
`;

// ❌ No type checking
const result = await client.query(query);

// ❌ Runtime errors only
result.forEach(user => 
  console.log(user.non_existent_field);
);

Pain Points

SQL injection vulnerabilities
No autocomplete or IntelliSense
Risk of runtime errors
Manual type definitions

After: hypequery

TypeScript
// ✅ Type-safe query builder
const users = await db
  .table('users')
  .select(['user_id', 'name', 'email'])
  .where('age', 'gt', age)
  .where('status', 'eq', status)
  .orderBy('created_at', 'DESC')
  .limit(10)
  .execute();

// ✅ Full type safety & autocomplete
users.forEach(user => 
  console.log(user.name); // ✅ Type checked!
);

Benefits

SQL injection protection
Full autocomplete & IntelliSense
Compile-time error checking
Auto-generated types

Features that spark joy ✨

Everything you need for ClickHouse development

Complete Type Safety

Every part of your query is type-checked - from table and column names to filter values and result types.

Flexible Join System

Easily create powerful joins with a fluent API. Set up relationship definitions for even more convenience.

SQL Expressions & Functions

Use raw SQL expressions and ClickHouse functions when you need them, while maintaining type safety.

Streaming Support

Process large result sets efficiently with built-in support for Clickhouse query streaming

Advanced Filtering

Define and apply cross filters to multiple queries with ease.

Comprehensive Logging

Track query execution with detailed logs of queries, parameters, timing, and row counts.

Ready to build with type safety?

Get started with our TypeScript SDK today and transform how you work with ClickHouse.