Dirework

Environment Variables

All environment variables used by Dirework

All environment variables are defined in apps/web/.env. The app validates them at startup using t3-env.

Required Variables

VariableDescription
DATABASE_URLPostgreSQL connection string
BETTER_AUTH_SECRETSecret key for Better Auth session encryption (min 32 characters)
BETTER_AUTH_URLFull URL of the web app (e.g. http://localhost:3001)
CORS_ORIGINAllowed CORS origin, typically the same as BETTER_AUTH_URL
TWITCH_CLIENT_IDTwitch application client ID from dev.twitch.tv
TWITCH_CLIENT_SECRETTwitch application client secret

Optional Variables

VariableDefaultDescription
ALLOWED_TWITCH_IDS"" (allow all)Comma-separated list of Twitch user IDs allowed to sign in. Leave empty to allow any Twitch user.
PRIVACY_POLICY_URL(unset)URL to your Privacy Policy page. When set, a link appears in the app footer.
TERMS_OF_SERVICE_URL(unset)URL to your Terms of Service page. When set, a link appears in the app footer.
NODE_ENV"development"Set to "production" for production deployments

Example .env

# Database
DATABASE_URL="postgresql://postgres:password@localhost:5432/dirework"

# Better Auth
BETTER_AUTH_SECRET="<your-secret-here>"
BETTER_AUTH_URL="http://localhost:3001"
CORS_ORIGIN="http://localhost:3001"

# Twitch OAuth (from dev.twitch.tv)
TWITCH_CLIENT_ID="your_client_id_here"
TWITCH_CLIENT_SECRET="your_client_secret_here"

# User allowlist (comma-separated Twitch user IDs, empty = allow all)
ALLOWED_TWITCH_IDS=""

# Legal page URLs (set to show links in footer, leave empty to hide)
# PRIVACY_POLICY_URL="https://example.com/privacy"
# TERMS_OF_SERVICE_URL="https://example.com/terms"

Production Notes

For production deployments:

  • Generate a strong BETTER_AUTH_SECRET with openssl rand -base64 32
  • Set BETTER_AUTH_URL and CORS_ORIGIN to your public domain (e.g. https://dirework.example.com)
  • Use a production PostgreSQL instance instead of the Docker development database
  • Update the Twitch OAuth redirect URLs to match your production domain (see Twitch OAuth Setup)

On this page