chmonitor
Getting Started

Local development

Run the chmonitor dashboard from source with Bun and TanStack Start to develop and test changes before deploying.

Run chmonitor from source for development or to test changes before deploying.

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.

Steps

Clone the repo

git clone https://github.com/chmonitor/chmonitor
cd clickhouse-monitoring

Install dependencies

The project uses Bun. Install it first if you don't have it.

bun install

Create .env.local

In apps/dashboard/, create .env.local:

CLICKHOUSE_HOST=http://localhost:8123
CLICKHOUSE_USER=monitoring
CLICKHOUSE_PASSWORD=your-password

# Optional
CLICKHOUSE_NAME=local-dev
CLICKHOUSE_MAX_EXECUTION_TIME=60
CLICKHOUSE_TZ=UTC
EVENTS_TABLE_NAME=system.monitoring_events

For dual-surface settings you normally set the canonical CHM_* name once and the VITE_* is derived at build time (e.g. set CHM_AUTH_PROVIDER, not VITE_AUTH_PROVIDER). Client-side variables in the TanStack app use the VITE_* prefix. The Next.js app uses NEXT_PUBLIC_* for the same variables. For example:

TanStack (VITE_*)Next.js (NEXT_PUBLIC_*)
VITE_AUTH_PROVIDERNEXT_PUBLIC_AUTH_PROVIDER
VITE_CLERK_PUBLISHABLE_KEYNEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
VITE_TITLE_SHORTNEXT_PUBLIC_TITLE_SHORT

Never put secrets in VITE_* variables

Client vars are inlined at build time and shipped to the browser.

Configure ClickHouse

Make sure the user you set in the previous step has the right grants:

Start the dev server

cd apps/dashboard
bun run dev

Open http://localhost:3000.

Verify

The dashboard should hot-reload as you edit source, and the overview page should render live metrics from your ClickHouse instance.

Troubleshooting

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.

On this page