Doppler Environment Variable Setup
Quick guide for setting up APP_ENV in Doppler
Understanding Naming
Doppler uses short config names but contains standard environment values:
| Doppler Config | APP_ENV Value | NODE_ENV Value | 
|---|---|---|
| dev | development | development | 
| stg | staging | production | 
| prd | production | production | 
Why different?
- Config names (dev,stg,prd) are organizational labels for quick access
- Secret values (development,staging,production) match framework conventions
- This ensures Next.js and other tools work correctly
Automated Setup (Recommended)
Prerequisites
- 
Doppler CLI installed # Check if installed
 doppler --version
 # Install if needed
 brew install dopplerhq/cli/doppler # macOS
 # or
 curl -Ls https://cli.doppler.com/install.sh | sh # Linux/WSL
- 
Authenticated doppler login
- 
Project setup (optional - script will prompt if not set) doppler setup --project tvl-mvp-v0
Run Setup Script
# From workspace root
./scripts/setup-doppler-env.sh
What it does:
- ✅ Validates Doppler CLI installation
- ✅ Checks authentication
- ✅ Sets APP_ENVin all environments (dev,stg,prd)
- ✅ Sets NODE_ENVappropriately
- ✅ Adds NEXT_TELEMETRY_DISABLED=1
- ✅ Shows confirmation of all changes
Example output:
============================================
Doppler Environment Setup
============================================
✓ Doppler CLI installed: v3.75.1
✓ Authenticated as: you@example.com
✓ Using project: tvl-mvp-v0
Environment Variable Mapping:
  Doppler Config → APP_ENV Value
  dev → development
  stg → staging
  prd → production
Do you want to set APP_ENV in all environments? (y/n) y
Setting environment variables...
→ Setting secrets in dev
  ✓ APP_ENV=development
  ✓ NODE_ENV=development
  ✓ NEXT_TELEMETRY_DISABLED=1
→ Setting secrets in stg
  ✓ APP_ENV=staging
  ✓ NODE_ENV=production
  ✓ NEXT_TELEMETRY_DISABLED=1
→ Setting secrets in prd
  ✓ APP_ENV=production
  ✓ NODE_ENV=production
  ✓ NEXT_TELEMETRY_DISABLED=1
============================================
✓ Doppler environment setup complete!
============================================
Manual Setup (Alternative)
If you prefer to set secrets manually:
Development Environment
doppler secrets set \
  NODE_ENV=development \
  APP_ENV=development \
  NEXT_TELEMETRY_DISABLED=1 \
  --project tvl-mvp-v0 \
  --config dev
Staging Environment
doppler secrets set \
  NODE_ENV=production \
  APP_ENV=staging \
  NEXT_TELEMETRY_DISABLED=1 \
  --project tvl-mvp-v0 \
  --config stg
Production Environment
doppler secrets set \
  NODE_ENV=production \
  APP_ENV=production \
  NEXT_TELEMETRY_DISABLED=1 \
  --project tvl-mvp-v0 \
  --config prd
Sync Secrets Locally
After setting secrets in Doppler:
# Download to .env.local
doppler secrets download --no-file --format env > .env.local
# Or run commands with secrets injected
doppler run -- pnpm dev
Verify Setup
Check Local Environment
# Source the .env.local file
set -a; source .env.local; set +a
# Verify variables
echo "NODE_ENV: $NODE_ENV"
echo "APP_ENV: $APP_ENV"
echo "NEXT_TELEMETRY_DISABLED: $NEXT_TELEMETRY_DISABLED"
Expected output:
NODE_ENV: development
APP_ENV: development
NEXT_TELEMETRY_DISABLED: 1
Check Doppler Secrets
# View all secrets for dev environment
doppler secrets --config dev
# View specific secret
doppler secrets get APP_ENV --config dev
Common Issues
Issue: "Config not found"
Solution: Create the config first:
doppler configs create stg --project tvl-mvp-v0
Issue: "Not authenticated"
Solution: Login again:
doppler login
Issue: "Permission denied on script"
Solution: Make script executable:
chmod +x scripts/setup-doppler-env.sh
Issue: "APP_ENV not working in Next.js"
Solution: Rebuild the app to pick up new env vars:
# If using devcontainer
F1 → Dev Containers: Rebuild Container
# Or manually
rm -rf apps/web/.next
pnpm build
Additional Commands
List All Configs
doppler configs --project tvl-mvp-v0
View Current Setup
doppler me
doppler setup --no-interactive
Switch Configs
# Switch to staging
doppler setup --config stg
# Run command with specific config
doppler run --config prd -- pnpm build
Update Multiple Secrets
# Set multiple secrets at once
doppler secrets set \
  SECRET_1=value1 \
  SECRET_2=value2 \
  SECRET_3=value3 \
  --config dev
References
- ADR-0055: Environment Variable Strategy
- ADR-0008: Doppler Secrets Management
- CLAUDE.md: Environment Variables Section
- Doppler Docs: https://docs.doppler.com/
Last Updated: 2025-10-28