Skip to main content
Back to Vibe Coder Toolkit
Environment

Env Sync

Never lose an env var again

npx promptreports-cli env sync

Compares your local .env.local against Vercel production variables. Finds drift before it breaks prod.

env-sync queries the Vercel API for every environment variable in your linked project, compares against your local .env.local, and shows 4 states: healthy (both match), MISSING LOCAL (Vercel has it, you don't), missing remote (you have it, Vercel doesn't), and DRIFT (both have it but values differ). Optionally merges missing local vars from Vercel with --merge.

Prerequisites

  • VERCEL_TOKEN environment variable
  • .vercel/project.json (run `vercel link` first)

Flags & Options

FlagDescriptionDefault
--diffShow differences without writing anything
--backupCreate .env.local.backup before any writes
--mergeWrite missing local vars from Vercel into .env.local
--jsonJSON output
--quietSuppress output

Examples

See drift

npx promptreports-cli env sync --diff

Read-only — just show what's different.

Sync missing

npx promptreports-cli env sync --merge --backup

Pull missing vars from Vercel, back up first.

CI check

npx promptreports-cli env sync --json

Exit non-zero if drift exists.

Output

Table with Key, Local status, Vercel status, and sync status. Summary line counts issues.

  Key                      Local    Vercel   Status
  DATABASE_URL            set      set      healthy
  STRIPE_SECRET_KEY       —        set      MISSING LOCAL
  OPENROUTER_API_KEY      set      —        missing remote
  NEXTAUTH_SECRET         set      set      DRIFT
  SENTRY_DSN              set      set      healthy

  1 issues found: 1 missing local, 0 missing remote, 1 drift
  Added 1 missing vars to .env.local
  Backup saved to .env.local.backup

What it reads and writes

Reads

  • .env.local
  • .vercel/project.json

Writes

  • .env.local (with --merge)
  • .env.local.backup (with --backup)

API calls

  • GET https://api.vercel.com/v9/projects/{projectId}/env (10s timeout)

Free vs Pro usage

Free tier

  • Catch missing env vars before deploy day
  • Onboard new team members — tell them to run env-sync --merge
  • CI guard against drift

Pro tier

Upgrade
  • Team-wide env policy enforcement
  • Auto-rotate secrets across machines via push notifications
  • Drift history (who changed what, when) via dashboard
  • Integration with 1Password, Vault, AWS Secrets Manager

Pro tips

  • Always use --backup the first time you --merge
  • Drift is usually a dev changing something locally — use it as a trigger to rotate
  • Run weekly in CI to catch silent drift
Free to try

Install the whole toolkit.

One command unlocks all 23 tools.