Local Development
Run chmonitor from source for development or to test changes before deploying.
The dashboard app
Section titled “The dashboard app”The dashboard is apps/dashboard (TanStack Start, v0.3+). Client env vars use the VITE_* prefix. The legacy Next.js app has been removed. The steps below target apps/dashboard.
1. Clone the repo
git clone https://github.com/duyet/clickhouse-monitoringcd clickhouse-monitoring2. Install dependencies
The project uses Bun. Install it first if you don’t have it.
bun install3. Create .env.local
In apps/dashboard/, create .env.local:
## RequiredCLICKHOUSE_HOST=http://localhost:8123CLICKHOUSE_USER=monitoringCLICKHOUSE_PASSWORD=your-password
## OptionalCLICKHOUSE_NAME=local-devCLICKHOUSE_MAX_EXECUTION_TIME=60CLICKHOUSE_TZ=UTCEVENTS_TABLE_NAME=system.monitoring_eventsClient-side variables in the TanStack app use VITE_* prefix. The Next.js app uses NEXT_PUBLIC_* for the same variables. For example:
TanStack (VITE_*) | Next.js (NEXT_PUBLIC_*) |
|---|---|
VITE_AUTH_PROVIDER | NEXT_PUBLIC_AUTH_PROVIDER |
VITE_CLERK_PUBLISHABLE_KEY | NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY |
VITE_TITLE_SHORT | NEXT_PUBLIC_TITLE_SHORT |
Client vars are inlined at build time. Never put secrets in VITE_* variables.
4. Configure ClickHouse
Make sure the user you set in step 3 has the right grants. See:
5. Start the dev server
cd apps/dashboardbun run devOpen http://localhost:3000.
Common issues
Section titled “Common issues”localhost connection refused — If ClickHouse is not running locally, update CLICKHOUSE_HOST to point at your remote instance.
Type errors on first run — Run bun run type-check from the repo root. Some generated types require a build pass first.
Missing system tables — See Enable system tables.