Reference

Environment variables

The variables from .env.example, grouped by service.

Convex

VariablePurposeRequired
CONVEX_DEPLOYMENTDeployment slug used by Convex CLI tooling (e.g. dev:my-project-123). Set automatically by npx convex dev.Yes
NEXT_PUBLIC_CONVEX_URLWebSocket/HTTP URL for the Convex deployment. Used by the browser client and must be publicly reachable.Yes
NEXT_PUBLIC_CONVEX_SITE_URLBase URL for Convex HTTP actions (e.g. the SSE chat endpoint). Distinct from the query/mutation URL.Yes

Clerk

VariablePurposeRequired
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEYClerk publishable key embedded in the browser bundle. Safe to expose — starts with pk_.Yes
CLERK_SECRET_KEYServer-side Clerk secret key. Never expose this in a NEXT_PUBLIC_ variable. Starts with sk_.Yes
CLERK_JWT_ISSUER_DOMAINIssuer URL from the Clerk JWT template named convex. Convex verifies incoming tokens against this domain in auth.config.ts.Yes
NEXT_PUBLIC_CLERK_SIGN_IN_URLPath Clerk redirects to for sign-in. Set to /sign-in.Yes
NEXT_PUBLIC_CLERK_SIGN_UP_URLPath Clerk redirects to for sign-up. Also /sign-in since sign-up is colocated.Yes
NEXT_PUBLIC_CLERK_SIGN_IN_FALLBACK_REDIRECT_URLWhere Clerk sends the user after sign-in when no redirectUrl param is present. Set to /dashboard.Yes
NEXT_PUBLIC_CLERK_SIGN_UP_FALLBACK_REDIRECT_URLWhere Clerk sends the user after sign-up when no redirectUrl param is present. Set to /dashboard.Yes
  • Use dev keys (pk_test_ / sk_test_) for local development.
  • Switch to live keys (pk_live_ / sk_live_) for production. The JWT template must also be configured in the production Clerk instance.

Site URLs

VariablePurposeRequired
SITE_URLServer-side canonical origin (e.g. http://localhost:3000). Used in server-only code and must not be prefixed NEXT_PUBLIC_.Yes
NEXT_PUBLIC_SITE_URLBrowser-readable canonical origin. Must match SITE_URL. Clerk callback URLs and the Convex site URL must also match this value.Yes

Mistral (OCR)

VariablePurposeRequired
MISTRAL_API_KEYMistral API key used to call the OCR endpoint. Every PDF upload triggers an OCR job that uses this key.Yes
MISTRAL_OCR_MODELOCR model identifier. Default is mistral-ocr-4-0. Change only if Mistral releases a newer model you want to test.Yes

OpenAI

VariablePurposeRequired
OPENAI_API_KEYOpenAI API key for both embedding and chat generation. Used in Convex server functions — never exposed to the browser.Yes
OPENAI_EMBEDDING_MODELModel for creating 1536-dim chunk embeddings. Default is text-embedding-3-small.Yes
OPENAI_CHAT_MODELModel for routing, per-page summaries, document summaries, and grounded answer generation. Default is gpt-5.4-mini.Yes
OPENAI_CHAT_REASONING_EFFORTReasoning effort for chat answers on reasoning models (minimal | low | medium | high). Lower effort makes tokens start streaming sooner; clamped to what the model supports. Default is low.Yes

Analytics (optional)

VariablePurposeRequired
NEXT_PUBLIC_POSTHOG_PROJECT_TOKENPostHog project token. Omit to disable analytics entirely. NEXT_PUBLIC_POSTHOG_KEY is supported as a fallback alias.Optional
NEXT_PUBLIC_POSTHOG_HOSTPostHog ingest endpoint. Default is https://us.i.posthog.com.Optional