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_URLNo 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/forbidden/rate-limited logs are always recorded. 0.2 in production, 1.0 otherwise
You need at least one database connection string. The specific variables depend on your provider.
Variable Required Description Example DATABASE_URLYes Primary connection string (pooled recommended) postgresql://user:pass@host/dbDATABASE_URL_UNPOOLEDNo Direct connection (for migrations) postgresql://user:pass@host/db
If using Neon or Vercel Postgres, these additional variables may be set automatically:
Variable Description PGHOSTDatabase host PGHOST_UNPOOLEDDirect (unpooled) database host PGUSERDatabase user PGDATABASEDatabase name PGPASSWORDDatabase password POSTGRES_URLFull connection URL POSTGRES_URL_NON_POOLINGDirect connection URL
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_URLYes Sign-in page path /sign-inNEXT_PUBLIC_CLERK_SIGN_UP_URLYes Sign-up page path /sign-upNEXT_PUBLIC_CLERK_SIGN_IN_FORCE_REDIRECT_URLNo Redirect after sign-in /dashboardNEXT_PUBLIC_CLERK_SIGN_UP_FORCE_REDIRECT_URLNo Redirect after sign-up /dashboardNEXT_PUBLIC_CLERK_SIGN_IN_FALLBACK_REDIRECT_URLNo Fallback redirect after sign-in /dashboardNEXT_PUBLIC_CLERK_SIGN_UP_FALLBACK_REDIRECT_URLNo 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 MFE_DEBUGNo Enable microfrontend debug mode 0
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.