ClickHouse for Convex
ClickHouse for Convex buffers analytics events in Convex and batch-flushes them to ClickHouse Cloud through the ClickHouse HTTP API.
Install the component with:
npm install @devwithbobby/clickhouseMount it in convex/convex.config.ts:
import { defineApp } from "convex/server";
import clickhouse from "@devwithbobby/clickhouse/convex.config.js";
const app = defineApp();
app.use(clickhouse);
export default app;Features
- Buffer analytics rows in Convex before sending them in batches
- Flush data to ClickHouse Cloud from an action, cron, or scheduler
- Configure batch size and retry behavior
- Run read-only ClickHouse queries from Convex actions
- Validate and quote ClickHouse table names before inserts
- Keep ClickHouse credentials in Convex environment variables
- Test integrations with the included
convex-testhelper
Configure CLICKHOUSE_URL, CLICKHOUSE_USER, and CLICKHOUSE_PASSWORD in the Convex environment before connecting.