# Vercel Deployment

Deployment discipline for Vercel-hosted applications.

## Rules

1. **Environment variables per environment.** Production, preview, and development get separate values. Secrets never live in the repo — configure them in the Vercel dashboard or via CLI.

2. **Preview deployments for every PR.** Every pull request gets a unique URL. Test against preview before merging to production.

3. **Serverless functions have cold starts and timeouts.** Keep functions lean. Heavy initialization belongs in cached module scope, not per-request setup.

4. **Edge vs. Node runtime is a deliberate choice.** Edge for low-latency redirects and lightweight logic. Node for full npm ecosystem and longer execution. Don't default blindly.

5. **Caching headers are explicit.** Static assets get long cache. Dynamic pages get appropriate `Cache-Control`. Vercel's CDN respects what you tell it.

6. **Roll back from the dashboard.** Every deployment is immutable. Promoting a previous deployment is the fastest rollback — know how before you need it.

## What This Replaces

Deploying to Vercel like it's generic hosting — ignoring preview environments, misconfiguring runtimes, and discovering rollback options during an incident.

## Official Source

Distilled from Vercel's official engineering skills.
Full upstream: https://officialskills.sh/vercel-labs/skills/next-best-practices
