Raypx

Environment Variables

Complete reference for all environment variables.

Raypx uses environment variables for all external configuration. Values are validated at startup by @raypx/env using Zod schemas. Copy .env.example to .env and fill in your values.

cp .env.example .env

Variable Prefix Convention

Variables prefixed with VITE_PUBLIC_ are exposed to the browser bundle by Vite. These are accessible via import.meta.env.VITE_PUBLIC_* on the client. All other variables are server-only and never sent to the browser.

Never store secrets in VITE_PUBLIC_ variables. They are embedded in the JavaScript bundle and visible to anyone who inspects network traffic.

Application

VariableRequiredDefaultDescription
APP_KEYYesRandom string for application-level encryption. Generate with openssl rand -base64 48.
VITE_PUBLIC_WEB_URLYeshttp://localhost:3000Public URL of the application, used in emails and OAuth redirects.
VITE_PUBLIC_PROJECT_NAMENoRaypxDisplay name shown in the UI.
VITE_PUBLIC_BASE_URLYeshttp://localhost:3000Base URL for API calls from the browser.

Database

VariableRequiredDefaultDescription
DATABASE_URLYesPostgreSQL connection string. Format: postgres://user:password@host:5432/dbname.
DATABASE_POOL_MAXNo10Maximum number of connections in the pool.
DATABASE_IDLE_TIMEOUTNo20Seconds before an idle connection is released.

Authentication

VariableRequiredDefaultDescription
AUTH_SECRETYesBetter Auth secret. Must be at least 32 characters. Generate with openssl rand -base64 48.
AUTH_URLNoVITE_PUBLIC_BASE_URLServer-side auth callback URL. Defaults to the base URL.
ADMIN_EMAILSNoComma-separated list of admin email addresses.

Google OAuth

VariableRequiredDefaultDescription
VITE_PUBLIC_AUTH_GOOGLE_IDNoGoogle OAuth client ID (public).
AUTH_GOOGLE_SECRETYes (if Google enabled)Google OAuth client secret (server-only).
VITE_PUBLIC_AUTH_GOOGLE_ENABLEDNotrueEnable or disable Google sign-in.
VITE_PUBLIC_AUTH_GOOGLE_ONE_TAP_ENABLEDNofalseEnable Google One Tap sign-in.

GitHub OAuth

VariableRequiredDefaultDescription
AUTH_GITHUB_IDNoGitHub OAuth application ID (server-only).
AUTH_GITHUB_SECRETNoGitHub OAuth application secret (server-only).
VITE_PUBLIC_AUTH_GITHUB_ENABLEDNotrueEnable or disable GitHub sign-in.

Email

VariableRequiredDefaultDescription
AUTH_RESEND_KEYNoResend API key for sending transactional emails.
RESEND_FROMNoSender email address, e.g. noreply@yourdomain.com.
MAIL_HOSTNoCustom SMTP host (overrides Resend).
MAIL_PORTNoCustom SMTP port.
MAIL_USERNoCustom SMTP username.
MAIL_PASSWORDNoCustom SMTP password.
MAIL_SECURENoUse TLS for custom SMTP (true/false).

Storage

VariableRequiredDefaultDescription
STORAGE_DRIVERNolocalStorage driver: local or s3.
STORAGE_LOCAL_ROOTNo.storageRoot directory for local file storage.
STORAGE_REDIS_URLNoRedis URL for signed URL storage.
STORAGE_REDIS_BASENoRedis key prefix for storage entries.
STORAGE_REDIS_TTL_SECONDSNoTTL for Redis storage entries.
REDIS_URLNoGeneral-purpose Redis connection string.

UI

VariableRequiredDefaultDescription
VITE_PUBLIC_DEFAULT_THEMENodarkDefault color theme: light, dark, or system.
VITE_PUBLIC_LOCALE_DETECTIONNofalseEnable automatic locale detection from browser headers.
VITE_PUBLIC_AUTH_URLNoVITE_PUBLIC_BASE_URLClient-side auth URL for redirects.

AI Providers

All AI provider keys are optional. Set only the ones you plan to use.

VariableRequiredDefaultDescription
OPENAI_API_KEYNoOpenAI API key.
OPENAI_PROXY_URLNoCustom proxy URL for OpenAI requests.
DEEPSEEK_API_KEYNoDeepSeek API key.
DEEPSEEK_PROXY_URLNoCustom proxy URL for DeepSeek requests.
ZHIPU_API_KEYNoZhipu AI (ChatGLM) API key.

Analytics

VariableRequiredDefaultDescription
VITE_PUBLIC_GOOGLE_ANALYTICS_IDNoGoogle Analytics measurement ID (e.g. G-XXXXXXXXXX).

Validation

All environment variables are validated on server startup by @raypx/env. If a required variable is missing or has an invalid format, the server logs a detailed error and exits. Check the console output after starting the server to catch configuration issues early.

On this page