Skip to content

Vercel

Deploy with Vercel

Or deploy manually:

  1. Import the repo at vercel.com/new.
  2. Set environment variables in the Vercel dashboard (Project → Settings → Environment Variables).
  3. Deploy.
SettingValue
Framework presetNext.js
Build commandbun run build (or npm run build)
Output directory.next
Install commandbun install
Node.js version22.x or later

Set environment variables in Vercel dashboard → Project → Settings → Environment Variables.

On Vercel (Next.js), client-side vars use NEXT_PUBLIC_*. These are inlined at build time. Server-side vars are plain names. This differs from the TanStack app which uses VITE_*.

TanStack (current app)Next.js / VercelPurpose
VITE_AUTH_PROVIDERNEXT_PUBLIC_AUTH_PROVIDERAuth provider (client)
VITE_CLERK_PUBLISHABLE_KEYNEXT_PUBLIC_CLERK_PUBLISHABLE_KEYClerk publishable key (client)
VITE_TITLE_SHORTNEXT_PUBLIC_TITLE_SHORTBranding (client)
VariableRequiredDefaultDescription
CLICKHOUSE_HOSTYesClickHouse URL(s), comma-separated
CLICKHOUSE_USERNodefaultUsername(s), same count as HOST
CLICKHOUSE_PASSWORDNo""Password(s), same count as HOST
CLICKHOUSE_NAMENoFriendly label(s) for host switcher

All four variables must have the same count:

CLICKHOUSE_HOST=https://ch1:8443,https://ch2:8443
CLICKHOUSE_USER=monitoring,monitoring
CLICKHOUSE_PASSWORD=pass1,pass2
CLICKHOUSE_NAME=primary,replica
VariableDefaultDescription
CLICKHOUSE_MAX_EXECUTION_TIME60Query timeout in seconds
CLICKHOUSE_TZTimezone for queries
CLICKHOUSE_DATABASEsystemDefault database
CLICKHOUSE_POOL_SIZE10Connection pool size
CLICKHOUSE_POOL_TIMEOUT300000Pool acquire timeout (ms)
CLICKHOUSE_POOL_CLEANUP_INTERVAL60000Pool cleanup interval (ms)

Add to Vercel env vars:

CHM_DISABLED_FEATURES=peerdb,actions
CHM_AUTH_REQUIRED_FEATURES=agent,settings,mcp
CHM_FEATURE_AGENT_ACCESS=authenticated
CHM_FEATURE_SETTINGS_ENABLED=false

For a config file, set CHM_CONFIG_FILE to a path readable by the Vercel function runtime and include the file in the repo.

Feature ids: overview, agent, insights, health, queries, tables, metrics, dashboard, security, logs, settings, cluster, operations, actions, mcp, docs, about.

None (default):

CHM_AUTH_PROVIDER=none

API key layer:

CHM_API_KEY_SECRET=a-long-random-secret

Clerk:

## Server-side (plain var)
CHM_AUTH_PROVIDER=clerk
CLERK_SECRET_KEY=sk_live_...
## Client-side (NEXT_PUBLIC_ prefix; inlined at build)
NEXT_PUBLIC_AUTH_PROVIDER=clerk
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_live_...

Proxy — Cloudflare Access:

CHM_AUTH_PROVIDER=proxy
CHM_CF_ACCESS_TEAM_DOMAIN=https://yourteam.cloudflareaccess.com
CHM_CF_ACCESS_AUD=<audience-tag>

Proxy — trusted header:

CHM_AUTH_PROVIDER=proxy
CHM_PROXY_AUTH_HEADER=X-Forwarded-User
CHM_PROXY_AUTH_SECRET=a-long-random-secret

Put chmonitor behind a Vercel Edge Middleware or an upstream proxy that sets the header. See Authentication.

LLM_API_KEY=sk-...
LLM_API_BASE=https://openrouter.ai/api/v1
LLM_MODEL=openrouter/free
AGENT_API_TOKEN=bearer-token-for-agent-api
AGENT_ENABLE_CONTROL_TOOLS=false

Never use NEXT_PUBLIC_LLM_API_KEY — keep the key server-side only.

Default: browser localStorage — no server config needed.

On Vercel (Next.js v0.2), use postgres for server-side persistence. D1 and Durable Object stores are Cloudflare-only.

Postgres (recommended on Vercel):

CONVERSATION_STORE_BACKEND=postgres
DATABASE_URL=postgresql://user:pass@host:5432/dbname

Vercel Postgres, Neon, and Supabase all work. Add DATABASE_URL in the Vercel dashboard.

The health sweep endpoint is GET /api/cron/health-sweep. Trigger it from a Vercel Cron Job or an external cron:

In vercel.json:

{
"crons": [
{
"path": "/api/cron/health-sweep",
"schedule": "*/5 * * * *"
}
]
}
HEALTH_ALERT_ENABLED=true
HEALTH_ALERT_WEBHOOK_URL=https://hooks.slack.com/services/...
HEALTH_ALERT_MIN_SEVERITY=warning
CRON_SECRET=a-random-secret
NEXT_PUBLIC_TITLE_SHORT=MyCluster
NEXT_PUBLIC_LOGO=/logo.png
NEXT_PUBLIC_MEASUREMENT_ID=G-XXXXXXXXXX
NEXT_PUBLIC_POSTHOG_KEY=phc_...
  1. Push to main (or merge a PR). Vercel auto-deploys.
  2. For environment variable changes, update them in the dashboard and trigger a redeploy (Deployments → Redeploy).

For breaking changes between major versions, see Migrating to v0.3.

  • No D1 / Durable Objects: Cloudflare-only. Use postgres or clickhouse for conversation store.
  • Function timeout: Vercel Hobby plan limits function duration to 10 s. Use Pro or set CLICKHOUSE_MAX_EXECUTION_TIME below that limit.
  • Cold starts: Vercel serverless functions have cold starts. Set CLICKHOUSE_POOL_SIZE appropriately.