100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace

Vercel Deployment Cheat Sheet

Vercel Deployment Cheat Sheet

Deploy and manage frontend apps on Vercel using the CLI, project configuration, environment variables, and serverless functions.

2 PagesBeginnerFeb 5, 2026

Vercel CLI Basics

Install and use the Vercel CLI to deploy projects.

bash
npm i -g vercel              # Install CLIvercel login                 # Authenticatevercel                       # Deploy current dir (preview)vercel --prod                # Deploy to productionvercel dev                   # Run local dev server matching prodvercel ls                    # List deploymentsvercel rm <deployment-url>   # Remove a deploymentvercel logs <deployment-url> # Tail deployment logsvercel env pull .env.local   # Pull env vars locally

vercel.json Config

Customize builds, routes, and headers.

json
{  "buildCommand": "npm run build",  "outputDirectory": "dist",  "framework": "nextjs",  "rewrites": [    { "source": "/api/(.*)", "destination": "/api/$1" }  ],  "headers": [    {      "source": "/(.*)",      "headers": [        { "key": "X-Frame-Options", "value": "DENY" }      ]    }  ]}

Serverless Function

Add an API route deployed as a Vercel serverless function.

javascript
// api/hello.jsexport default function handler(req, res) {  const { name = 'world' } = req.query;  res.status(200).json({ message: `Hello, ${name}!` });}// Edge function variant:export const config = { runtime: 'edge' };export default function handler(req) {  return new Response('Hello from the edge');}

Environment Variables & Domains

Manage secrets and custom domains per environment.

  • Production/Preview/Development- three scopes for env vars, set independently in Project Settings or via `vercel env add`
  • vercel env add <NAME>- adds an environment variable and prompts for target environments
  • NEXT_PUBLIC_*- prefix required for Next.js env vars exposed to the browser
  • vercel domains add- attaches a custom domain to a project
  • vercel alias- points a stable URL/domain at a specific deployment
  • Git integration- pushing to a connected GitHub/GitLab repo triggers automatic preview deployments per branch/PR
  • vercel.json redirects- define permanent or temporary redirects declaratively
Pro Tip

Use Vercel's Preview Deployments (one per pull request) to share working URLs with reviewers before merging — combine with branch-specific env vars to test against staging APIs safely.

Was this cheat sheet helpful?

Explore Topics

#VercelDeployment#VercelDeploymentCheatSheet#CloudComputing#Beginner#VercelCLIBasics#VercelJsonConfig#ServerlessFunction#EnvironmentVariablesDomains#Functions#WebDevelopment#DevOps#CommandLine#CheatSheet#SkillVeris