Master Code
On The Go

Learn. Practice. Build.

Home › How-To › Deploy Next.js to Vercel

Next.js Guide

How to Deploy Next.js to Vercel

Vercel is the platform built by the creators of Next.js. Zero-config deploys, edge network, automatic HTTPS. Your app goes live in under 5 minutes.

Quick answer: Push your code to GitHub, sign up at vercel.com with GitHub, click Add New → Project, import your repo, add environment variables, and click Deploy. Every future push auto-deploys.

📋 What You'll Need

✅ Vercel's Hobby plan is free forever for personal projects.

1

Push Your Project to GitHub

git init
git add .
git commit -m "Initial commit"
git branch -M main
git remote add origin https://github.com/USERNAME/REPO.git
git push -u origin main

Make sure .env.local is in .gitignore. Never commit secrets.

2

Import to Vercel

  1. Go to vercel.com and click Sign Up
  2. Choose Continue with GitHub
  3. From the dashboard, click Add New → Project
  4. Find your repo in the list and click Import

Vercel auto-detects Next.js and fills in the build settings. Leave the defaults.

3

Add Environment Variables

Before clicking Deploy, expand the Environment Variables section. Add everything from your .env.local:

DATABASE_URL=postgres://...
AUTH_SECRET=your-production-secret
AUTH_GITHUB_ID=...
AUTH_GITHUB_SECRET=...
OPENAI_API_KEY=sk-...

💡 Tip: Vercel stores environment variables securely. They're available as process.env.KEY at build time and runtime.

4

Deploy

Click the blue Deploy button. Vercel:

  • Clones your repo
  • Installs dependencies
  • Builds your Next.js app
  • Deploys to the global edge network
  • Gives you a URL like your-project.vercel.app

First deploy takes 1–3 minutes. Every push after that takes 30–60 seconds.

5

Add a Custom Domain

  1. Project → Settings → Domains
  2. Click Add and enter your domain
  3. Vercel shows DNS records to add at your registrar
  4. Add the records and wait 5–60 minutes for propagation
  5. Vercel auto-issues an SSL certificate

See our Free Domain guide for cheap domain options.

6

CLI Deployment (Alternative)

Prefer the terminal? Install the Vercel CLI:

npm install -g vercel

# From your project root:
vercel           # deploy to preview
vercel --prod    # deploy to production

The CLI is useful for CI pipelines and when you want to build locally before uploading:

vercel build
vercel deploy --prebuilt

⚡ Free Plan Limits (2026)

ResourceHobby (Free)Pro ($20/mo)
Bandwidth100 GB/mo1 TB/mo
BuildsUnlimitedUnlimited
Serverless functions100 GB-hrs1000 GB-hrs
Custom domainsUnlimitedUnlimited
SSLFreeFree
Edge networkGlobalGlobal
Commercial useNoYes

For personal projects, the free tier is generous. Switch to Pro when you launch commercially.

🔧 Troubleshooting

❓ Frequently Asked Questions

Is Vercel free for Next.js?;

Yes for personal projects — 100GB bandwidth, unlimited deploys, SSL, and global CDN. Commercial use requires Pro.

How long does a deploy take?

First deploy: 1–3 minutes. Subsequent deploys: 30–60 seconds, thanks to caching.

Does Vercel auto-deploy?

Yes. Every push to main deploys to production. Pull requests get their own preview URLs.

Can I deploy elsewhere?

Yes — Netlify, Railway, or any Node.js host. But Vercel is the recommended choice because it's built by the Next.js team.

How do I set environment variables?

Project → Settings → Environment Variables. Add each key and value, then redeploy.

🎯 What's Next?

← All How-To Guides