Doppler Integration
readyInject encrypted secrets seamlessly into nextdeploy plan, build, and ship using Doppler across local development, staging branches, and automated CI/CD pipelines.
Source reference: shared/secrets/, shared/config/
Why Use Doppler with NextDeploy
NextDeploy is designed with a Zero-Secrets-on-Disk security philosophy. Storing plaintext .env or .env.production files on developer laptops or remote servers risks accidental Git commits and secret leakage.
By integrating Doppler:
- Secrets are fetched just-in-time into process memory during
nextdeploy planandnextdeploy ship. nextdeploy.ymlnatively interpolates${ENV_VAR}placeholders from the injected Doppler environment.- On VPS deployments, secrets are written directly to systemd environment files with
chmod 600permissions or injected via the NextDeploy encrypted vault. - On Cloudflare and AWS, secrets are automatically synchronized to Worker environment variables or AWS Secrets Manager.
The -- Syntax Rule
When invoking NextDeploy through Doppler CLI, always include the -- argument separator:
# Correct: doppler passes all flags directly to nextdeploy
doppler run -- nextdeploy plan
doppler run -- nextdeploy ship
doppler run -- nextdeploy status
# Incorrect: Doppler attempts to parse nextdeploy flags
doppler run nextdeploy ship --env prod # Doppler might intercept --env!
Configuration Example
Declare your secret bindings in nextdeploy.yml using ${VARIABLE_NAME} syntax:
version: "1.0"
target_type: serverless
app:
name: saas-web
domain: app.example.com
environment: production
serverless:
provider: cloudflare
cloudflare:
compatibility_date: "2026-05-01"
compatibility_flags:
- nodejs_compat
resources:
hyperdrive:
- name: primary-db
binding: HYPERDRIVE
origin_env: DATABASE_URL
r2:
- name: saas-uploads
binding: UPLOADS
Any runtime secrets injected by doppler run -- (such as STRIPE_SECRET_KEY and AUTH_SECRET) are automatically folded into the Worker upload as secret_text bindings and mirrored onto process.env — no need to duplicate them in nextdeploy.yml.
Multi-Environment Workflows (Dev, Staging, Prod)
Doppler provides first-class environment configurations (dev, stg, prd). You can target specific configurations using Doppler's --config flag:
# Deploy to Staging using Staging credentials
doppler run --config stg -- nextdeploy ship
# Deploy to Production using Production credentials
doppler run --config prd -- nextdeploy ship
Integrating Doppler in GitHub Actions CI/CD
Store a single DOPPLER_TOKEN service token in GitHub Actions Repository Secrets:
name: Deploy Next.js to Cloudflare via NextDeploy & Doppler
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Install Doppler CLI
uses: dopplerhq/cli-action@v3
- name: Install NextDeploy
run: curl -fsSL https://nextdeploy.org/install.sh | bash
- name: Run NextDeploy Preflight Plan
env:
DOPPLER_TOKEN: ${{ secrets.DOPPLER_TOKEN_PROD }}
run: doppler run -- nextdeploy plan --detailed-exitcode
- name: Deploy Production Release
env:
DOPPLER_TOKEN: ${{ secrets.DOPPLER_TOKEN_PROD }}
run: doppler run -- nextdeploy ship
Troubleshooting Doppler Invocations
DOPPLER_TOKEN not found: Ensuredoppler loginhas been run locally, orDOPPLER_TOKENis exported in your environment.Variable ${NAME} is empty: Check your Doppler dashboard for the active project/config to ensure the variable is defined and unlocked.- Token Scope: Ensure the Doppler service token has read access to the relevant Doppler Project and Config.