How to Deploy a React App to Vercel in 5 Minutes (2026 Guide)

Vercel makes deploying React apps ridiculously easy. No servers to manage, no complex configuration, and automatic deployments every time you push to Git. In this guide, I'll show you how to deploy your React app to Vercel in under 5 minutes.

This works for Create React App, Vite, Next.js, and any other React framework.

Prerequisites

💡 Don't have a React app yet?

Create one quickly with:

# Using Vite (recommended)
npm create vite@latest my-app -- --template react
cd my-app
npm install

# Or using Create React App
npx create-react-app my-app
cd my-app

Step-by-Step Deployment

1 Push Your Code to GitHub

If you haven't already, push your React app to GitHub:

# Initialize git (if not already done)
git init
git add .
git commit -m "Initial commit"

# Create a new repository on GitHub, then:
git remote add origin https://github.com/yourusername/your-repo.git
git branch -M main
git push -u origin main

2 Sign Up for Vercel

Go to vercel.com and sign up with your GitHub account. It's free for personal projects and open source.

Vercel's free tier includes:

  • Unlimited deployments
  • 100 GB bandwidth per month
  • Automatic HTTPS
  • Preview deployments for pull requests

3 Import Your Repository

Once logged in to Vercel:

  1. Click "Add New..." → "Project"
  2. You'll see your GitHub repositories listed
  3. Find your React app repository and click "Import"

4 Configure Build Settings

Vercel automatically detects most React frameworks. Here are the settings for common setups:

For Create React App:

  • Framework Preset: Create React App
  • Build Command: npm run build (auto-detected)
  • Output Directory: build (auto-detected)

For Vite:

  • Framework Preset: Vite
  • Build Command: npm run build (auto-detected)
  • Output Directory: dist (auto-detected)

For Next.js:

  • Framework Preset: Next.js
  • Build Command: npm run build (auto-detected)
  • Output Directory: .next (auto-detected)

💡 Pro Tip

If Vercel doesn't auto-detect your framework, select it manually from the "Framework Preset" dropdown. This enables framework-specific optimizations.

5 Add Environment Variables (If Needed)

If your app uses environment variables (API keys, database URLs, etc.), add them in the "Environment Variables" section:

  1. Click "Add" for each variable
  2. Enter the name (e.g., REACT_APP_API_KEY)
  3. Enter the value
  4. Select environments (Production, Preview, Development)

⚠️ Important

For Create React App, prefix variables with REACT_APP_. For Vite, use VITE_. Variables without these prefixes won't be available in your app.

6 Deploy!

Click "Deploy" and wait 30-60 seconds. Vercel will:

  1. Clone your repository
  2. Install dependencies
  3. Build your app
  4. Deploy to their global CDN

Once complete, you'll get a URL like https://your-app.vercel.app. Your app is now live!

Setting Up a Custom Domain

Want to use your own domain instead of .vercel.app?

  1. Go to your project settings in Vercel
  2. Click "Domains"
  3. Enter your domain (e.g., myapp.com)
  4. Vercel will show you DNS records to add
  5. Add these records to your domain registrar
  6. Wait for DNS propagation (usually 5-30 minutes)

Common DNS Configurations

For apex domain (example.com):

Type: A
Name: @
Value: 76.76.21.21

For www subdomain (www.example.com):

Type: CNAME
Name: www
Value: cname.vercel-dns.com

💡 Automatic HTTPS

Vercel automatically provisions and renews SSL certificates for your custom domain. No need to use Let's Encrypt or Certbot!

Automatic Deployments

One of Vercel's best features: every time you push to your Git repository, Vercel automatically deploys your changes.

# Make changes to your code
git add .
git commit -m "Update homepage"
git push

# Vercel automatically deploys! 🚀

Preview Deployments

When you create a pull request, Vercel creates a preview deployment with a unique URL. This lets you test changes before merging to production.

Preview URLs look like: https://your-app-git-feature-branch.vercel.app

Configuring Build and Output Directories

If Vercel doesn't auto-detect your build settings, you can configure them manually:

In the Vercel Dashboard:

  1. Go to Project Settings → General
  2. Update "Build Command" and "Output Directory"
  3. Click "Save"
  4. Redeploy your project

Using vercel.json:

Create a vercel.json file in your project root:

{
  "buildCommand": "npm run build",
  "outputDirectory": "dist",
  "framework": "vite",
  "rewrites": [
    { "source": "/(.*)", "destination": "/index.html" }
  ]
}

💡 SPA Routing Fix

If you're using React Router and getting 404 errors on page refresh, add the "rewrites" configuration above. This tells Vercel to serve index.html for all routes.

Environment Variables

Managing environment variables in Vercel:

Adding Variables:

  1. Go to Project Settings → Environment Variables
  2. Add variables for Production, Preview, and Development
  3. Use the same variable names as in your local .env file

Accessing Variables in Code:

Create React App:

// .env file
REACT_APP_API_URL=https://api.example.com

// In your code
const apiUrl = process.env.REACT_APP_API_URL;

Vite:

// .env file
VITE_API_URL=https://api.example.com

// In your code
const apiUrl = import.meta.env.VITE_API_URL;

⚠️ Security Note

Never commit sensitive API keys to your repository. Always use environment variables, and only expose keys that are safe to be public (like frontend API keys).

Troubleshooting Common Issues

Build Fails with "Module not found"

This usually means a dependency is missing. Check:

  1. All dependencies are in package.json
  2. You're not importing from node_modules directly
  3. Try deleting node_modules and package-lock.json, then reinstall
rm -rf node_modules package-lock.json
npm install
git add .
git commit -m "Reinstall dependencies"
git push

404 Errors on Page Refresh (SPA)

If you're using React Router and get 404 errors when refreshing or directly accessing routes:

Create vercel.json in your project root:

{
  "rewrites": [
    { "source": "/(.*)", "destination": "/index.html" }
  ]
}

Environment Variables Not Working

Check:

  1. Variables are prefixed correctly (REACT_APP_ or VITE_)
  2. Variables are added to the correct environment (Production/Preview/Development)
  3. You've redeployed after adding variables
  4. You're accessing them correctly in code

Build Takes Too Long

If your build is slow:

Advanced Configuration

Custom Build Scripts

If you need custom build logic, update your package.json:

{
  "scripts": {
    "build": "npm run lint && npm run test && vite build",
    "preview": "vite preview"
  }
}

Monorepo Support

If your React app is in a subdirectory of a monorepo:

  1. In Vercel, set "Root Directory" to your app's folder
  2. Example: If your app is in apps/web, set Root Directory to apps/web

Serverless Functions

Vercel supports serverless functions for backend logic:

Create api/hello.js:

export default function handler(req, res) {
  res.status(200).json({ message: 'Hello from Vercel!' });
}

Access it at https://your-app.vercel.app/api/hello

Monitoring and Analytics

Vercel provides built-in analytics:

Enable analytics in Project Settings → Analytics.

Rolling Back Deployments

If a deployment breaks your app:

  1. Go to your project's "Deployments" page
  2. Find the last working deployment
  3. Click the three dots → "Promote to Production"
  4. Your app is instantly rolled back

Summary

You've successfully deployed your React app to Vercel! Here's what you accomplished:

Your app is now live on Vercel's global CDN, with automatic HTTPS and instant rollbacks. Every time you push to Git, your changes will be live in under a minute.

Next Steps

W

Wivrix Team

We write practical deployment guides to help developers ship faster. No theory, just proven workflows.