Skip to Content
Configuration

Configuration

One .env file at the repository root serves the whole stack. Bun auto-loads it for the server and the CLI, and prisma.config.ts loads it explicitly for the Prisma CLI.

Server

VariableRequiredNotes
DATABASE_URLyesPostgres connection string
CLERK_SECRET_KEYyesClerk OAuth. Missing keys throw at import time in packages/server/src/lib/auth.ts
CLERK_PUBLISHABLE_KEYyesClerk OAuth
OPENROUTER_API_KEYyesRoutes chat models through OpenRouter
POLAR_ACCESS_TOKENyesCredits and billing via Polar
POLAR_PRODUCT_IDyesPolar product for credit packs
POLAR_CREDITS_METER_IDyesMeter used to record per-message usage
POLAR_SERVERnoDefaults to the Polar sandbox

CLI

VariableRequiredNotes
API_URLnoDefaults to http://localhost:3000
CLERK_FRONTEND_APIyesClerk frontend API URL
CLERK_OAUTH_CLIENT_IDyesClerk OAuth client

Gotchas

  • packages/server/src/lib/auth.ts throws at import time if Clerk keys are missing — the server will not start without them.
  • The 401 handler clears the CLI’s stored auth token (clearAuth) in both the RPC client and the chat transport, so an expired session silently returns you to the sign-in flow.
Last updated on