Every environment variable a self-hosted Mogplex reads, grouped by feature, with required, build-time, and default values marked.
.env.example in the repository is the starting template. Copy it to
.env.local for local development, or to .env for Docker.
NEXT_PUBLIC_* values are build-time
Next.js compiles every NEXT_PUBLIC_* value into the client bundle when it
builds. Changing one at runtime has no effect. Rebuild after each change. With
Docker, pass them as --build-arg.
Trigger.dev tasks need the same server variables as the app. See
Background jobs.
neon. Must match MOGPLEX_DATA_BACKEND. Build-time.
APP_URL or NEXT_PUBLIC_APP_URL
Public URL of the deployment, such as https://mogplex.example.com. APP_URL wins and is read at runtime, so one image serves any domain.
DATABASE_URL
Owner connection. Migrations use it, and the app falls back to it.
DATABASE_URL_UNPOOLED
Direct connection, for pg LISTEN.
BETTER_AUTH_SECRET
openssl rand -base64 32.
CRON_SECRET
Bearer token for /api/cron/* and machine-only routes.
INTERNAL_API_SECRET
Server-to-server sandbox actions.
CONNECTIONS_ENCRYPTION_KEY
32-byte hex key (openssl rand -hex 32) that encrypts saved connection credentials. Do not rotate without a plan: see Operations.
EMAIL_UNSUBSCRIBE_SECRET
Signs unsubscribe links. The app throws in production without it.
One sign-in provider
AUTH_GITHUB_*, AUTH_GOOGLE_*, AUTH_MICROSOFT_*, or Resend for email and password.
pnpm setup:doctor checks these and the optional services below.
PEM. Write newlines as \n in single-line env files.
GITHUB_WEBHOOK_SECRET
Must match the App's webhook secret.
GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET
Classic GitHub OAuth app for user identity, org membership, and reauthorization. Without a GitHub App, it also lists repositories. The GitHub App's own client credentials do not work here.
GITHUB_APP_CLIENT_ID, GITHUB_APP_CLIENT_SECRET
Optional. The App's own OAuth client credentials, used only to create repositories in personal accounts. App service only; Trigger.dev does not need them. Callback: /api/auth/github/app-user/callback. See GitHub App.
MOGPLEX_SETUP_ENABLED
1 enables /admin/setup/github in production while the GitHub App is unconfigured. Remove it after setup.