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_URLYesURL 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, policy-denied, and rate-limited logs are always recorded.0.2 in production, 1.0 otherwise

Database (PostgreSQL)

The dashboard reads a single PostgreSQL connection string.

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

Redis (Upstash)

Redis is required for rate limiting, config caching, usage buffering, and write throttling.

VariableRequiredDescriptionExample
UPSTASH_REDIS_REST_URLYesUpstash Redis REST endpointhttps://example.upstash.io
UPSTASH_REDIS_REST_TOKENYesUpstash Redis REST tokenAXxxxxx...

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_FORCE_REDIRECT_URLYesRedirect after sign-in/dashboard
NEXT_PUBLIC_CLERK_SIGN_UP_FORCE_REDIRECT_URLYesRedirect after sign-up/dashboard
NEXT_PUBLIC_CLERK_SIGN_IN_FALLBACK_REDIRECT_URLYesFallback redirect after sign-in/dashboard
NEXT_PUBLIC_CLERK_SIGN_UP_FALLBACK_REDIRECT_URLYesFallback 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.

Build-Time Escape Hatch

VariableRequiredDescriptionDefault
SKIP_ENV_VALIDATIONNoSet to a truthy value only for Docker/build contexts where env validation must be deferred. Do not use for normal production runtime.unset

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