Deployment Basics

Vercel supports two deployment methods: automatic git-based deployments and manual deployments via the CLI. Both produce optimized builds on Vercel's edge network.

Git-Based Deployments

The most common workflow. Connect your repository and Vercel deploys on every push.

Setup

  1. Go to vercel.com/new
  2. Select your GitHub, GitLab, or Bitbucket repository
  3. Vercel detects the framework and applies default build settings
  4. Click Deploy to trigger the first production build

Branch Behavior

BranchDeployment TypeURL
main / masterProductionyour-app.vercel.app
Any other branchPreviewyour-app-git-branch-name.vercel.app
Pull requestPreviewyour-app-pr-123.vercel.app

Manual Deployments with the CLI

Deploy directly from your terminal without a git push:

# Deploy to preview
vercel

# Deploy to production
vercel --prod

This is useful for quick tests or when your project is not connected to a Git provider.

Build Configuration

Vercel auto-detects Next.js, but you can customize the build in the project settings or in a vercel.json file:

{
  "buildCommand": "npm run build",
  "outputDirectory": ".next",
  "installCommand": "npm install",
  "framework": "nextjs"
}

Common Build Settings

SettingDefault (Next.js)Override When
Build Commandnext buildCustom build steps needed
Output Directory.nextUsing a monorepo with custom output
Install Commandnpm installUsing pnpm, yarn, or bun
Root Directory/Project is in a subdirectory

Custom Domains

Add a custom domain in your project settings:

# Via CLI
vercel domains add example.com

Vercel automatically provisions SSL certificates and configures DNS if you use Vercel's nameservers.

Deployment Protection

Protect preview deployments from public access:

  • Vercel Authentication — Require login with a Vercel account
  • Password Protection — Set a shared password for team reviews
  • Trusted IPs — Restrict access to specific IP ranges (Enterprise)

Production deployments are always public by default. Use Vercel Authentication on preview deployments to keep work-in-progress private.