Vercel CLI

The Vercel CLI lets you deploy, manage environment variables, and run a local development server from your terminal. It is the fastest way to interact with the Vercel platform without leaving your editor.

Installation

npm install -g vercel

Verify the installation:

vercel --version

Authentication

Log in to your Vercel account:

vercel login

This opens a browser window for authentication. Once complete, your session token is stored locally.

# Check which account is active
vercel whoami

Core Commands

CommandDescription
vercelDeploy the current directory (preview)
vercel --prodDeploy to production
vercel devStart local dev server with Vercel features
vercel envManage environment variables
vercel domainsManage custom domains
vercel logsView deployment logs in real time
vercel inspect <url>Show details about a deployment

Linking a Project

Before deploying, link your local directory to a Vercel project:

vercel link

This creates a .vercel/ directory with the project configuration. The link is stored locally and does not affect your Git repository.

Deploying from the Terminal

# Preview deployment (default)
vercel

# Production deployment
vercel --prod

# Deploy with build output only (skip prompts)
vercel --yes

Deployment Flags

FlagEffect
--prodDeploy to production environment
--yesSkip confirmation prompts
--forceForce a new deployment even if nothing changed
--archive=tgzUpload project as a tarball for faster uploads

Local Development Server

vercel dev runs your project locally with Vercel's serverless function emulation:

vercel dev --listen 3012

This is useful for testing serverless functions and environment variable injection without deploying.

If you use direnv or a .envrc file, you can run vercel commands directly without manually sourcing credentials each time.