OptStuff

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

Application

VariableRequiredDescriptionExample
NEXT_PUBLIC_APP_URLYesPublic URL of your OptStuff deploymenthttps://optstuff.example.com
NEXT_PUBLIC_DOCS_URLNoURL of the documentation sitehttps://docs.optstuff.example.com

Scheduling & Maintenance

VariableRequiredDescriptionExample
CRON_SECRETYes (production)Bearer token used to authorize internal cron routes such as daily maintenance.Generate with openssl rand -hex 32

Observability

VariableRequiredDescriptionDefault
REQUEST_LOG_SUCCESS_SAMPLE_RATENoSuccess request log sampling rate (0.0 to 1.0). Error/forbidden/rate-limited logs are always recorded.0.2 in production, 1.0 otherwise

Database (PostgreSQL)

You need at least one database connection string. The specific variables depend on your provider.

Standard Connection

VariableRequiredDescriptionExample
DATABASE_URLYesPrimary connection string (pooled recommended)postgresql://user:pass@host/db
DATABASE_URL_UNPOOLEDNoDirect connection (for migrations)postgresql://user:pass@host/db

Neon / Vercel Postgres

If using Neon or Vercel Postgres, these additional variables may be set automatically:

VariableDescription
PGHOSTDatabase host
PGHOST_UNPOOLEDDirect (unpooled) database host
PGUSERDatabase user
PGDATABASEDatabase name
PGPASSWORDDatabase password
POSTGRES_URLFull connection URL
POSTGRES_URL_NON_POOLINGDirect connection URL

Authentication (Clerk)

VariableRequiredDescriptionExample
CLERK_SECRET_KEYYesClerk server-side secret keysk_test_xxxx...
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEYYesClerk client-side publishable keypk_test_xxxx...
NEXT_PUBLIC_CLERK_SIGN_IN_URLYesSign-in page path/sign-in
NEXT_PUBLIC_CLERK_SIGN_UP_URLYesSign-up page path/sign-up
NEXT_PUBLIC_CLERK_SIGN_IN_FORCE_REDIRECT_URLNoRedirect after sign-in/dashboard
NEXT_PUBLIC_CLERK_SIGN_UP_FORCE_REDIRECT_URLNoRedirect after sign-up/dashboard
NEXT_PUBLIC_CLERK_SIGN_IN_FALLBACK_REDIRECT_URLNoFallback redirect after sign-in/dashboard
NEXT_PUBLIC_CLERK_SIGN_UP_FALLBACK_REDIRECT_URLNoFallback redirect after sign-up/dashboard

Encryption

VariableRequiredDescriptionExample
API_KEY_ENCRYPTION_SECRETYesMaster 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.

Debug

VariableRequiredDescriptionDefault
MFE_DEBUGNoEnable microfrontend debug mode0

Client SDK Variables

These variables are used in your application code (not the OptStuff dashboard) to interact with the API:

VariableDescriptionExample
OPTSTUFF_BASE_URLOptStuff API base URLhttps://optstuff.example.com
OPTSTUFF_PROJECT_SLUGYour project identifiermy-blog
OPTSTUFF_PUBLIC_KEYAPI public keypk_abc123...
OPTSTUFF_SECRET_KEYAPI secret key (server-side only)sk_...

For integration examples using these variables, see the Next.js Integration guide.

Last updated on

On this page