Skip to main content

Vercel

Could decentralized blockchain tech eventually outcompete?

Develop Preview Ship: Our platform enables product teams to do their best work. Vercel combines the best developer experience with an obsessive focus on end-user performance.

Environment Strategy

Vercel deploys into three scopes. Mismatched env vars are the #1 cause of preview crashes.

Three Scopes

ScopeBranchPurposeEnv vars
ProductionmainLive usersReal API keys, prod databases
PreviewAll other branchesPR review, QASandbox keys, test databases
DevelopmentLocal onlyvercel devPulled via vercel env pull

Solo Setup

Minimum viable config for a single developer:

  • main branch deploys to Production
  • All other branches deploy to Preview
  • Production env vars: real keys, prod DB connection
  • Preview env vars: sandbox keys, test DB connection
  • Local: run vercel env pull .env.local — never commit .env
  • Each API key scoped to the environments that need it

Growth Triggers

Add a dedicated staging environment when:

TriggerWhy
Team QA neededReviewers need a stable target, not per-PR previews
Risky migrationsDatabase schema changes need a pre-prod gate
Compliance requiredAudit trail demands a named environment
External integrationsThird-party webhooks need a fixed URL

Env Var Rules

RuleReason
Real keys in Production onlyLimits blast radius of leaked secrets
Sandbox keys in PreviewPreview deploys are semi-public (URL is guessable)
vercel env pull for localSingle source of truth, no manual .env management
Never commit .env filesGit history is permanent — secrets in commits are leaked
Scope every var explicitlyUnscoped vars default to all environments — over-exposes secrets

Env Validation

Preview deploys crash when code expects env vars that only exist in Production. Guard against this:

PatternWhen
Check VERCEL_ENV before requiring keysNon-critical integrations (analytics, email)
Provide fallback behaviorFeature works without the integration
Fail fast with clear errorCritical dependency missing — better than a cryptic crash

The fix: read VERCEL_ENV (production, preview, or development) and relax validation for non-prod. Skip optional integrations rather than crashing the deploy.

Context

Features

Competitors

Articles

Questions

When does a preview environment need its own secrets instead of sandbox keys?

  • What env vars should fail the build versus degrade gracefully?
  • At what team size does a dedicated staging environment pay for itself?
  • How do you audit which secrets are exposed to which Vercel scope?