Skip to main content

Prerequisites

  • Know which features you plan to enable
  • Access to your deployment environment for setting secrets

Steps

  1. Copy apps/api/example.env to apps/api/.env
  2. Add required base vars (DATABASE_URL, BETTER_AUTH_SECRET)
  3. Add provider vars only for enabled features
  4. Restart the API server to load changes

Required Variables (Base API)

VariableDescriptionExample
DATABASE_URLPostgreSQL connection stringpostgresql://user:pass@host:5432/db
DATABASE_ORMORM adapter (prisma or drizzle)prisma
BETTER_AUTH_SECRETSecret for session encryption (32+ chars)long-random-string
BETTER_AUTH_URLAPI base URL for OAuth callbacks (recommended)http://localhost:3001
MOBILE_APP_URLApp URL scheme for mobile auth originslaunch://

Server & Logging

VariableDescriptionDefault
PORTAPI server port3001
HOSTAPI server hostlocalhost
NODE_ENVEnvironment (development/production)development
LOG_LEVELLogging level (debug/info/warn/error)info

Authentication Providers

Apple Sign In

VariableDescription
APPLE_CLIENT_IDApple Services ID (matches iOS bundle ID)
APPLE_TEAM_IDApple Developer Team ID
APPLE_KEY_IDApple Key ID
APPLE_PRIVATE_KEYPrivate key contents (PEM)
APPLE_PRIVATE_KEY_BASE64Base64-encoded private key (alternative)
Use either APPLE_PRIVATE_KEY or APPLE_PRIVATE_KEY_BASE64.

Google Sign In

VariableDescription
GOOGLE_WEB_CLIENT_IDOAuth web client ID
GOOGLE_CLIENT_SECRETOAuth client secret

Email & SMS

VariableDescription
RESEND_API_KEYResend API key (email OTP)
TWILIO_ACCOUNT_SIDTwilio account SID (SMS OTP)
TWILIO_AUTH_TOKENTwilio auth token
TWILIO_SERVICE_SIDTwilio Verify service SID
SKIP_TWILIO_OTP_VERIFICATIONSkip SMS verification in dev (true/false, ignored in production)

Payments (Stripe)

VariableDescription
STRIPE_SECRET_KEYStripe API secret key
STRIPE_PUBLISHABLE_KEYStripe publishable key
STRIPE_WEBHOOK_SECRETStripe webhook signing secret

AI Providers

VariableDescription
OPENAI_API_KEYOpenAI API key
OPENAI_ORGANIZATIONOpenAI organization ID (optional)
ANTHROPIC_API_KEYAnthropic API key (optional)

File Uploads (S3)

VariableDescriptionDefault
S3_BUCKETS3 bucket name(none)
S3_REGIONAWS regionus-east-1
S3_ACCESS_KEY_IDAWS access key ID(none)
S3_SECRET_ACCESS_KEYAWS secret access key(none)

Push Notifications

APNS (iOS)

VariableDescription
APNS_TEAM_IDApple Team ID
APNS_KEY_IDAPNS key ID
APNS_BUNDLE_IDiOS bundle identifier
APNS_PRODUCTIONtrue for production APNS
APNS_KEYAPNS private key contents (PEM)
APNS_KEY_BASE64Base64-encoded APNS key (alternative)

FCM (Android)

VariableDescription
FCM_PROJECT_IDFirebase project ID
FCM_SERVICE_ACCOUNT_BASE64Base64-encoded service account JSON

Push Campaign API

VariableDescription
PUSH_TOKEN_ADMIN_SECRETBearer token for push campaigns

Notes

  • The API reads env vars directly at startup. Missing required values will cause runtime errors, so prefer setting envs before boot.
  • If you don’t need a feature, you can leave its env vars unset and disable the corresponding mobile feature flag.
  • DATABASE_ORM=drizzle expects a Postgres-compatible database (Neon works well).

Troubleshooting

  • Server fails on boot: confirm required vars exist
  • OAuth callbacks fail: verify BETTER_AUTH_URL
  • File uploads fail: check S3 vars and bucket permissions

Next Steps