Skip to content

Environment Variables

This page summarizes the env vars used by the backend. Some values in backend/.env.example are recommended deployment examples; code defaults may differ.

Core settings

VariableRequiredDefaultDescription
OPENPOST_PORTNo8080HTTP server port.
OPENPOST_DATABASE_PATHNofile:openpost.db?cache=shared&mode=rwcSQLite database path or DSN.
OPENPOST_APP_URLNo, but set it in real deploymentshttp://localhost:8080Public frontend origin used for CORS and auth flow assumptions.
OPENPOST_PUBLIC_URLNofalls back to OPENPOST_APP_URLCanonical browser origin used when configuring WebAuthn/passkeys. Set this to your real app URL in production.
OPENPOST_EXTRA_CORS_ORIGINSNoemptyExtra comma-separated origins to allow.
OPENPOST_DISABLE_REGISTRATIONSNofalseDisables new self-service signups after setup. The first account on a fresh instance is still allowed and becomes the instance admin automatically.
OPENPOST_JWT_SECRETYesnoneSecret used to sign JWTs. Must be at least 32 characters.
OPENPOST_ENCRYPTION_KEYYesnoneSecret used to encrypt stored OAuth tokens. Must be at least 32 characters.
OPENPOST_MEDIA_PATHNo./mediaLocal directory for uploaded media.
OPENPOST_MEDIA_URLNo, but required for Threads production use/mediaPublic base URL for media files.
OPENPOST_ENVNoemptyOptional deployment label. Secret validation is enforced regardless of environment mode.

X

VariableRequiredDefaultDescription
X_CLIENT_IDYes for XemptyX OAuth client ID.
X_CLIENT_SECRETYes for XemptyX OAuth client secret.
X_REDIRECT_URINohttp://localhost:8080/api/v1/accounts/x/callbackX OAuth 1.0a callback URL override.

Mastodon

VariableRequiredDefaultDescription
MASTODON_REDIRECT_URINohttp://localhost:8080/api/v1/accounts/mastodon/callbackMastodon callback URL override.
MASTODON_SERVERSYes for MastodonemptyJSON array of configured Mastodon apps and instance URLs.

LinkedIn

VariableRequiredDefaultDescription
LINKEDIN_CLIENT_IDYes for LinkedInemptyLinkedIn OAuth client ID.
LINKEDIN_CLIENT_SECRETYes for LinkedInemptyLinkedIn OAuth client secret.
LINKEDIN_REDIRECT_URINohttp://localhost:8080/api/v1/accounts/linkedin/callbackLinkedIn callback URL override.
LINKEDIN_DISABLE_THREAD_REPLIESNofalseDisable LinkedIn comment-style child replies for thread posts.

Threads

VariableRequiredDefaultDescription
THREADS_CLIENT_IDYes for ThreadsemptyMeta app ID.
THREADS_CLIENT_SECRETYes for ThreadsemptyMeta app secret.
THREADS_REDIRECT_URINohttp://localhost:8080/api/v1/accounts/threads/callbackThreads callback URL override.

Notes

  • The preferred names above are what new deployments should use.
  • Backward-compatible aliases still work for existing installs: OPENPOST_DB_PATH, OPENPOST_FRONTEND_URL, OPENPOST_CORS_EXTRA_ORIGINS, JWT_SECRET, ENCRYPTION_KEY, TWITTER_CLIENT_ID, TWITTER_CLIENT_SECRET, TWITTER_REDIRECT_URI, and OPENPOST_DISABLE_LINKEDIN_THREAD_REPLIES.
  • backend/.env.example is still the best copy-paste starting point.
  • Set explicit public URLs in production even when defaults exist.
  • For Threads, treat OPENPOST_MEDIA_URL as mandatory.

Released under the MIT License.