Environment Variables Complete reference of all environment variables required to run OptStuff, organized by category.
This page documents all environment variables used by the OptStuff dashboard. Copy the .env.example file as a starting point:
cp apps/optstuff-dashboard/.env.example apps/optstuff-dashboard/.env
Variable Required Description Example NEXT_PUBLIC_APP_URLYes Public URL of your OptStuff deployment https://optstuff.example.comNEXT_PUBLIC_DOCS_URLYes URL of the documentation site https://docs.optstuff.example.com
Variable Required Description Example CRON_SECRETYes (production) Bearer token used to authorize internal cron routes such as daily maintenance. Generate with openssl rand -hex 32
Variable Required Description Default REQUEST_LOG_SUCCESS_SAMPLE_RATENo Success request log sampling rate (0.0 to 1.0). Error, policy-denied, and rate-limited logs are always recorded. 0.2 in production, 1.0 otherwise
The dashboard reads a single PostgreSQL connection string.
Variable Required Description Example DATABASE_URLYes Primary connection string (pooled recommended) postgresql://user:pass@host/db
Redis is required for rate limiting, config caching, usage buffering, and write throttling.
Variable Required Description Example UPSTASH_REDIS_REST_URLYes Upstash Redis REST endpoint https://example.upstash.ioUPSTASH_REDIS_REST_TOKENYes Upstash Redis REST token AXxxxxx...
Variable Required Description Example CLERK_SECRET_KEYYes Clerk server-side secret key sk_test_xxxx...NEXT_PUBLIC_CLERK_PUBLISHABLE_KEYYes Clerk client-side publishable key pk_test_xxxx...NEXT_PUBLIC_CLERK_SIGN_IN_FORCE_REDIRECT_URLYes Redirect after sign-in /dashboardNEXT_PUBLIC_CLERK_SIGN_UP_FORCE_REDIRECT_URLYes Redirect after sign-up /dashboardNEXT_PUBLIC_CLERK_SIGN_IN_FALLBACK_REDIRECT_URLYes Fallback redirect after sign-in /dashboardNEXT_PUBLIC_CLERK_SIGN_UP_FALLBACK_REDIRECT_URLYes Fallback redirect after sign-up /dashboard
Variable Required Description Example API_KEY_ENCRYPTION_SECRETYes Master key for AES-256-GCM encryption of API secret keys. Must be 32+ characters. Generate with openssl rand -base64 32
This is the most sensitive configuration value. If compromised, all stored API secret keys can be decrypted. There is no automatic rotation mechanism — rotating requires re-encrypting all keys.
Variable Required Description Default SKIP_ENV_VALIDATIONNo Set to a truthy value only for Docker/build contexts where env validation must be deferred. Do not use for normal production runtime. unset
These variables are used in your application code (not the OptStuff dashboard) to interact with the API:
Variable Description Example OPTSTUFF_BASE_URLOptStuff API base URL https://optstuff.example.comOPTSTUFF_PROJECT_SLUGYour project identifier my-blogOPTSTUFF_PUBLIC_KEYAPI public key pk_abc123...OPTSTUFF_SECRET_KEYAPI secret key (server-side only) sk_...
For integration examples using these variables, see the Next.js Integration guide.