WORLDBOOK

vercel | Worldbooks | WebMCP | Search | Submit

vercel

Category: Unknown Author: Unknown Version: 1.0.0 Updated: Unknown
0

Vercel CLI

Website: https://vercel.com CLI Tool: vercel Authentication: Vercel account

Description

Vercel CLI is the command-line interface for Vercel, the platform for frontend frameworks and static sites. Deploy projects, manage domains, configure environment variables, and view logs. Essential for modern web development and deployment workflows with Next.js, React, Vue, and other frameworks.

Commands

Authentication

Login

vercel login
vercel login --github
vercel login --gitlab
vercel login --bitbucket

Authenticate with Vercel account.

Logout

vercel logout

Remove authentication credentials.

Whoami

vercel whoami

Show current user.

Deployment

Deploy Project

vercel
vercel deploy
vercel --prod
vercel --yes
vercel --public

Deploy project to Vercel. Default is preview, use --prod for production.

Deploy to Production

vercel --prod
vercel deploy --prod

Deploy directly to production domain.

Deploy with Build

vercel --build-env KEY=value
vercel --prod --build-env NODE_ENV=production

Deploy with custom build environment variables.

Project Management

vercel link
vercel link --project my-project

Link local directory to Vercel project.

Initialize Project

vercel init
vercel init next-app
vercel init react-app

Create new project from template.

List Projects

vercel list
vercel ls
vercel list --next 10

List all projects.

Project Info

vercel inspect
vercel inspect --wait

Display project details and deployment URLs.

Remove Project

vercel remove <project>
vercel rm <project> --yes

Delete project from Vercel.

Deployments

List Deployments

vercel list
vercel ls <project>
vercel list --all

List deployments.

Inspect Deployment

vercel inspect <url>
vercel inspect https://my-app-abc123.vercel.app

View deployment details.

Remove Deployment

vercel remove <url>
vercel rm <deployment-url> --yes

Delete specific deployment.

Promote Deployment

vercel promote <url>
vercel alias <deployment-url> production-domain.com

Promote preview to production.

Domains

List Domains

vercel domains ls
vercel domains list

List all domains.

Add Domain

vercel domains add example.com
vercel domains add example.com --force

Add custom domain to account.

Remove Domain

vercel domains rm example.com
vercel domains remove example.com --yes

Remove domain from account.

Buy Domain

vercel domains buy example.com

Purchase domain through Vercel.

Verify Domain

vercel domains verify example.com

Check domain verification status.

Aliases

Set Alias

vercel alias <deployment> <domain>
vercel alias https://my-app-abc123.vercel.app example.com

Point domain to deployment.

List Aliases

vercel alias ls
vercel alias list

Show all domain aliases.

Remove Alias

vercel alias rm <alias>

Remove domain alias.

Environment Variables

List Env Variables

vercel env ls
vercel env list
vercel env ls production
vercel env ls preview
vercel env ls development

List environment variables by environment.

Add Env Variable

vercel env add <name>
vercel env add API_KEY
vercel env add API_KEY production
vercel env add SECRET production preview

Add environment variable interactively.

Remove Env Variable

vercel env rm <name>
vercel env remove API_KEY
vercel env rm API_KEY production

Remove environment variable.

Pull Env Variables

vercel env pull
vercel env pull .env.local
vercel env pull --environment=production

Download env variables to .env file.

Secrets

Add Secret

vercel secrets add <name> <value>
vercel secrets add api-key "secret-value"

Store secret (accessible as @secret-name).

List Secrets

vercel secrets ls
vercel secrets list

List all secrets.

Rename Secret

vercel secrets rename <old> <new>

Rename secret.

Remove Secret

vercel secrets rm <name>
vercel secrets remove api-key

Delete secret.

Logs

View Logs

vercel logs <url>
vercel logs https://my-app.vercel.app
vercel logs <url> --follow
vercel logs <url> -f

View deployment logs. Use --follow for real-time.

Function Logs

vercel logs <url> --output raw
vercel logs <url> --since 1h

View function execution logs.

DNS

List DNS Records

vercel dns ls <domain>
vercel dns list example.com

List DNS records for domain.

Add DNS Record

vercel dns add <domain> <name> <type> <value>
vercel dns add example.com www A 192.0.2.1
vercel dns add example.com @ MX mail.example.com

Add DNS record.

Remove DNS Record

vercel dns rm <record-id>

Delete DNS record.

Certificates

List Certificates

vercel certs ls
vercel certs list

List SSL certificates.

Issue Certificate

vercel certs issue <domain>
vercel certs issue example.com www.example.com

Request SSL certificate.

Remove Certificate

vercel certs rm <domain>

Remove certificate.

Teams

List Teams

vercel teams ls
vercel teams list

List teams.

Switch Team

vercel switch <team>

Switch to different team.

Add to Team

vercel teams add

Invite user to team.

Development

Dev Server

vercel dev
vercel dev --port 3001
vercel dev --listen 0.0.0.0

Start local development server with Vercel's runtime.

Build Locally

vercel build
vercel build --prod

Build project locally.

Git Integration

Git Connect

vercel git connect

Connect Git repository.

Git Disconnect

vercel git disconnect

Disconnect Git repository.

Examples

First Deployment

# Navigate to project
cd my-next-app

# Login to Vercel
vercel login

# Deploy (creates project automatically)
vercel

# Deploy to production
vercel --prod

Project Setup

# Link existing project
vercel link

# Pull environment variables
vercel env pull .env.local

# Start dev server
vercel dev

# Deploy preview
vercel

# Deploy production
vercel --prod

Environment Variables

# Add production API key
vercel env add API_KEY production
# Enter value when prompted

# Add secret for all environments
vercel secrets add db-password "mysecret"
vercel env add DB_PASSWORD production preview
# Enter: @db-password

# Pull env vars for development
vercel env pull

# List all env vars
vercel env ls

Domain Management

# Add custom domain
vercel domains add example.com

# Point deployment to domain
vercel alias https://my-app-xyz.vercel.app example.com

# Verify domain
vercel domains verify example.com

# List all domains
vercel domains ls

Continuous Deployment

# Connect Git repository
vercel git connect

# Push to git triggers auto-deploy
git add .
git commit -m "Update feature"
git push origin main

# Or manual deploy
vercel --prod

Development Workflow

# Start local dev with Vercel runtime
vercel dev

# Make changes to code

# Test build locally
vercel build

# Deploy preview for testing
vercel

# After testing, deploy production
vercel --prod

Multi-Environment Setup

# Add env vars per environment
vercel env add API_URL production
# Enter: https://api.example.com

vercel env add API_URL preview
# Enter: https://api-staging.example.com

vercel env add API_URL development
# Enter: http://localhost:3001

# Pull for local dev
vercel env pull .env.local

Logs and Debugging

# View deployment logs
vercel logs https://my-app.vercel.app

# Follow logs in real-time
vercel logs https://my-app.vercel.app --follow

# View recent logs
vercel logs https://my-app.vercel.app --since 1h

# View function logs
vercel logs https://my-app.vercel.app --output raw

Team Collaboration

# List teams
vercel teams ls

# Switch to team
vercel switch my-team

# Deploy to team
vercel --prod

# Add team member
vercel teams add

Rollback Deployment

# List recent deployments
vercel list

# Promote previous deployment to production
vercel alias https://my-app-old-deployment.vercel.app production-domain.com

# Or using promote
vercel promote https://my-app-old-deployment.vercel.app

Monorepo Deployment

# Deploy specific package
cd packages/web
vercel

# Set root directory
vercel --cwd packages/web

# Deploy all packages
for dir in packages/*; do
  cd $dir && vercel --prod && cd ../..
done

DNS Management

# Add A record
vercel dns add example.com @ A 192.0.2.1

# Add CNAME
vercel dns add example.com www CNAME example.com

# Add MX record
vercel dns add example.com @ MX "10 mail.example.com"

# List records
vercel dns ls example.com

CI/CD Integration

# GitHub Actions
- name: Deploy to Vercel
  run: vercel --token ${{ secrets.VERCEL_TOKEN }} --prod
  env:
    VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
    VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}

# GitLab CI
deploy:
  script:
    - npm install -g vercel
    - vercel --token $VERCEL_TOKEN --prod

Cleanup

# Remove old deployments
vercel list --meta githubCommitRef=old-branch | \
  grep -v production | \
  awk '{print $1}' | \
  xargs -I {} vercel rm {} --yes

# Remove unused domains
vercel domains ls | grep unused | \
  awk '{print $1}' | \
  xargs -I {} vercel domains rm {} --yes

Notes

  • Deployment: Automatic from Git or manual via CLI
  • Previews: Every push creates preview deployment
  • Production: Linked to production domain
  • Build Step: Automatic framework detection
  • Functions: Serverless functions support
  • Edge Functions: Deploy to Vercel Edge Network
  • Environment: Production, Preview, Development
  • Domains: Custom domains and SSL included
  • Secrets: Encrypted environment variables
  • Teams: Collaboration features
  • Monorepo: Turborepo integration
  • Analytics: Web analytics built-in
  • Speed Insights: Performance monitoring
  • Edge Config: Global configuration
  • Blob Storage: File storage service
  • Postgres: Managed PostgreSQL
  • KV: Key-value storage
  • Cron Jobs: Scheduled functions
  • Redirects: URL redirects in vercel.json
  • Rewrites: Proxy requests
  • Headers: Custom HTTP headers
  • CORS: Cross-origin configuration
  • Rate Limiting: API rate limits
  • DDoS Protection: Built-in protection
  • Git Integration: GitHub, GitLab, Bitbucket
  • Framework Support: Next.js, React, Vue, Svelte, etc.
  • Build Cache: Speeds up deployments
  • Output Caching: ISR and SSG caching
  • Image Optimization: Automatic image optimization
  • Best Practices:
  • Use environment variables for secrets
  • Link Git for automatic deployments
  • Test with preview deployments
  • Use vercel dev for local testing
  • Set up proper domains early
  • Use secrets for sensitive data
  • Monitor logs for errors
  • Enable analytics
  • Use edge functions for performance
  • Optimize images
  • Configure caching properly
  • Use redirects for SEO
  • Set up proper error pages
  • Monitor usage and limits

Get this worldbook via CLI

worldbook get vercel

Comments (0)

Add a Comment

No comments yet. Be the first to comment!