Skip to main content

Environment variables

Two files exist on purpose — they are not duplicates you both fill with secrets.

FileRole
.env.exampleSafe template committed to git. Shows names and placeholders. No real secrets.
.envYour real local or production secrets. Gitignored. The app reads only this.

Workflow: copy once (cp .env.example .env), then edit only .env. Leave .env.example as the shared checklist.

The official OSS / Docker image is always self-hosted and payment-free. Do not set Stripe, billing, or credit-related variables for self-host — they are unused.

Required for local development

VariablePurpose
DATABASE_URLPostgres connection string (Docker defaults work out of the box)
REDIS_URLRedis for BullMQ and rate limiting
NEXTAUTH_URLPublic app URL, e.g. http://localhost:3000 or https://songs2vid.example.com
NEXTAUTH_SECRETLong random string (e.g. openssl rand -base64 32)
GOOGLE_CLIENT_IDGoogle OAuth client ID
GOOGLE_CLIENT_SECRETGoogle OAuth client secret

Create OAuth credentials in Google Cloud Console. Guide: Setting up OAuth 2.0. Enable YouTube Data API v3.

Optional

VariablePurpose
TOKEN_ENCRYPTION_KEYEncrypts YouTube tokens at rest; falls back to NEXTAUTH_SECRET if unset
UPLOAD_DIRUpload storage path; defaults to ./uploads (Compose uses /app/uploads)
FFMPEG_PATHOverride FFmpeg binary (image defaults to system ffmpeg)
S2VID_PORTHost port for the optional root docker-compose.yml example (default 3000)
NEXT_PUBLIC_GITEA_URLFooter / open-source link
NEXT_PUBLIC_GITEA_ISSUES_URLBug report link
NEXT_PUBLIC_DOCKER_HUB_URLDocker image link
NEXT_PUBLIC_DOCS_URLDocs site URL (production default https://docs.songs2vid.com)
ADMIN_API_KEYOptional Bearer token for internal admin HTTP routes. Not required for normal self-hosted operation

Notes

  • User API keys are generated in Dashboard → Settings → API key (hashed at rest). They are not env vars.
  • Full entitlements (layouts, API, playlists, unlimited allowance) are always on in the OSS image — there is no edition flag or paywall to enable.
  • In production, NEXTAUTH_URL must match the public HTTPS URL users open in the browser, and the same origin must be listed as an OAuth redirect URI (…/api/auth/callback/google). See Production notes.
  • Never commit .env or put production secrets in .env.example.