Build an analytics query
Start with working data, see the SQL, and reuse the query in your application.
Quarry adds typed query composition to your existing @clickhouse/client.
Table names, filters, and selected columns determine the inputs you can pass
and the result rows you receive.
Start with a working example
Your first analytics endpoint
Start ClickHouse, generate your types, and run a query on real seed data. Follow the SQL all the way to the JSON response.
Bring your existing database
Keep your client and introduce Quarry one query at a time. Use the npm package in your TypeScript service.
Just exploring? Open the playground to inspect generated SQL without a database.
Build something useful
Daily activity
Turn events into a daily series for a chart.
Latest event per user
Select one recent event from each user's history.
Dashboard filters
Add optional filters while keeping typed inputs and results.
Paginated reports
Page through grouped results in a stable order.
Streaming exports
Process rows as they arrive from ClickHouse.
Explore the API
Find a method, check its signature, and see what it returns.
Every recipe uses the quickstart's schema and seed data. Its query code comes from the runnable example, and CI checks its SQL and expected results against ClickHouse.
Find an answer
- API reference: method signatures, accepted inputs, and result types.
- Schema generation: generate types from tables, views, and dictionaries.
- SQL and type debugging: inspect a query and trace an unexpected result.
- ClickHouse support: supported clauses and remaining limitations.
- Choosing Quarry: compare the same task with raw SQL and other libraries.
Know which version you are using
Quarry is pre-1.0. Minor releases may change the API with a changelog entry; patch releases preserve it. These docs cover Quarry 0.10.0. Release guidance identifies the differences and explains how to run matching examples.