Deployments
Every deploy produces an immutable, content-addressed artifact. Traffic moves between artifacts; artifacts themselves never change. That one property is what makes previews cheap and rollbacks instant.
Deploy to production
Section titled “Deploy to production”vega deployCompiling api/index.ts…✓ Built in 1.2s✓ Deployed to 28 regions→ https://acme-api.vega.dev (dpl_8f3k29)The new deployment receives traffic only after it passes health checks in every target region, so a broken build never takes down a working one.
Preview deployments
Section titled “Preview deployments”Deploy any branch to an isolated URL without touching production:
vega deploy --preview✓ Built in 1.1s→ https://acme-api-git-rate-limits.preview.vega.dev (dpl_2c7d41)Previews run the same runtime and regions as production, with their own cache namespace. They expire after 30 days of no traffic.
If a preview looks good, promote the exact artifact you tested instead of rebuilding:
vega promote dpl_2c7d41Rollbacks
Section titled “Rollbacks”vega rollback # back to the previous deploymentvega rollback dpl_8f3k29 # or to a specific onePrevious artifacts stay warm in every region, so a rollback is a routing change, not a redeploy — it takes effect in under 10 seconds globally.
List recent deployments with vega deployments ls.
Environment variables and secrets
Section titled “Environment variables and secrets”Secrets are set per project and injected into the handler context as env:
vega secrets set STRIPE_KEYvega secrets lsapi.post('/charges', async ({ request, env }) => { const stripe = createClient(env.STRIPE_KEY); // ...});Changing a secret triggers a new deployment automatically; running code never sees a half-updated environment.
Deploying from CI
Section titled “Deploying from CI”Create a deploy token with vega tokens create --scope deploy and expose it as VEGA_TOKEN:
name: Deployon: push: branches: [main]jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 22 - run: npm ci - run: npx @vega/cli deploy env: VEGA_TOKEN: ${{ secrets.VEGA_TOKEN }}The same command with --preview on pull requests gives every PR its own URL.
Region pinning
Section titled “Region pinning”By default apps deploy to all 28 regions. Pin specific regions in code when data residency requires it:
export const api = vega.app({ region: ['fra', 'lhr', 'ams'] });