📖 Guide
Vercel CLI — Complete Reference
Complete Vercel CLI cheat sheet covering deployment, domains, environment variables, configuration, and edge functions.
64 commands across 9 categories
DeploymentProject ManagementEnvironment VariablesDomainsSecretsLogsConfiguration (vercel.json)Edge FunctionsCommon Patterns
Deployment
| Command | Description |
|---|---|
vercel | Deploy the current directory to Vercel (preview deployment by default) |
vercel --prod | Deploy directly to production |
vercel --prebuilt | Deploy using pre-built output (skip build step on Vercel) |
vercel build | Build the project locally using Vercel's build pipeline |
vercel deve.g. vercel dev --listen 3000 | Start local development server that mimics Vercel's environment |
vercel inspect <deployment-url> | Show detailed information about a deployment |
vercel redeploy <deployment-url> | Redeploy an existing deployment with the same configuration |
vercel rollback <deployment-url> | Roll back production to a previous deployment |
Project Management
| Command | Description |
|---|---|
vercel link | Link the current directory to a Vercel project |
vercel link --yes | Auto-confirm linking with defaults |
vercel project ls | List all projects in your Vercel account/team |
vercel project add <name> | Create a new project |
vercel project rm <name> | Remove a project (destructive — removes all deployments) |
vercel ls | List recent deployments for the current project |
vercel rm <deployment-url> | Remove a specific deployment |
vercel whoami | Show the currently authenticated user |
Environment Variables
| Command | Description |
|---|---|
vercel env ls | List all environment variables for the current project |
vercel env add <name> | Add an environment variable (interactive — prompts for value and environments) |
vercel env add <name> production | Add a variable only for production environment |
vercel env rm <name> | Remove an environment variable |
vercel env pull .env.locale.g. vercel env pull .env.local --environment=preview | Download environment variables to a local .env file |
vercel env pull --environment=production | Pull production-specific environment variables |
Domains
| Command | Description |
|---|---|
vercel domains ls | List all domains across your projects |
vercel domains add <domain> | Add a domain to the current project |
vercel domains rm <domain> | Remove a domain from your account |
vercel domains inspect <domain> | Show DNS and configuration details for a domain |
vercel domains verify <domain> | Verify domain ownership via DNS records |
vercel dns ls <domain> | List DNS records for a domain |
vercel dns add <domain> <type> <value>e.g. vercel dns add example.com A 1.2.3.4 | Add a DNS record |
vercel certs ls | List SSL certificates |
Secrets
| Command | Description |
|---|---|
vercel secrets add <name> <value> | Add a secret (deprecated — use env vars instead) |
vercel secrets ls | List all secrets |
vercel secrets rm <name> | Remove a secret |
vercel secrets rename <old> <new> | Rename a secret |
Note: Secrets are legacy | Vercel recommends using Environment Variables instead of Secrets for new projects |
Logs
| Command | Description |
|---|---|
vercel logs <deployment-url> | View runtime logs for a deployment |
vercel logs <url> --follow | Stream logs in real-time (tail -f style) |
vercel logs <url> --since 1he.g. vercel logs myapp.vercel.app --since 30m | Show logs from the last hour |
vercel logs <url> --output json | Output logs in JSON format for parsing |
vercel logs <url> --limit 100 | Limit the number of log entries returned |
Configuration (vercel.json)
| Command | Description |
|---|---|
"buildCommand": "npm run build" | Override the default build command |
"outputDirectory": "dist" | Set custom build output directory (default: .next, out, public) |
"framework": "nextjs" | Explicitly set the framework (auto-detected by default) |
"rewrites": [{"source": "/api/:path*", "destination": "..."}]e.g. { "source": "/blog/:slug", "destination": "/api/posts?slug=:slug" } | URL rewrites — proxy requests without changing the URL |
"redirects": [{"source": "/old", "destination": "/new", "permanent": true}] | URL redirects with 301 (permanent) or 307 (temporary) |
"headers": [{"source": "/(.*)", "headers": [...]}]e.g. { "key": "X-Frame-Options", "value": "DENY" } | Add custom response headers |
"functions": {"api/**": {"memory": 1024, "maxDuration": 30}} | Configure serverless function memory (MB) and timeout (seconds) |
"crons": [{"path": "/api/cron", "schedule": "0 * * * *"}] | Define cron jobs that hit your API routes on a schedule |
Edge Functions
| Command | Description |
|---|---|
export const runtime = 'edge' | Set a Next.js API route or page to run on the Edge Runtime |
export const config = { runtime: 'edge' } | Alternative edge runtime config for API routes |
Edge middlewaree.g. export function middleware(request: NextRequest) { ... } | Create middleware.ts at project root for edge middleware |
matcher confige.g. export const config = { matcher: ['/api/:path*', '/dashboard/:path*'] } | Limit which routes middleware applies to |
NextResponse.rewrite()e.g. NextResponse.rewrite(new URL('/api/proxy', request.url)) | Rewrite the request URL at the edge |
NextResponse.redirect() | Redirect at the edge before hitting the origin |
geolocation & ip | Access request.geo and request.ip in edge functions for geo-routing |
waitUntil(promise) | Extend function execution after response is sent (background work) |
Common Patterns
| Command | Description |
|---|---|
vercel login | Authenticate with Vercel (opens browser for OAuth) |
vercel logout | Log out of the current session |
vercel switch | Switch between teams/accounts |
vercel --token <TOKEN>e.g. VERCEL_TOKEN=xxx vercel --prod --yes | Use a specific auth token (for CI/CD) |
vercel pull | Pull project settings and env vars from Vercel |
CI/CD deploymente.g. vercel --prod --yes --token=TOKEN | Use --yes flag to skip confirmation prompts in CI |
Monorepo root dir | Set root directory in project settings or vercel.json for monorepos |
vercel bisect | Binary search through deployments to find when a regression was introduced |
📖 Free, searchable command reference. Bookmark this page for quick access.