How to Deploy a Website on Vercel (Next.js, React or HTML), Step by Step
To deploy a website on Vercel, push your project to GitHub, go to vercel.com/new, import the repository, confirm the framework preset and click Deploy. Vercel builds it and gives you a .vercel.app URL; add your own domain under Settings, Domains. Every later push to the main branch redeploys automatically.
- Before you start
- Method 1: Deploy from GitHub (recommended)
- Method 2: Deploy from the command line
- Settings by project type
- Add your own domain
- Environment variables and secrets
- Common deployment errors and fixes
- Important: free plan limits for businesses
- Should you deploy it yourself?
- Other places to deploy
Vercel is the platform behind Next.js and one of the simplest ways to put a site online. We use it to host our own site and client builds, so this is the process as we actually run it, including the parts the quick-start pages skip.
Before you start
You need three things:
- Your project working locally (
npm run devshows it in the browser). - A free GitHub account, with the project pushed to a repository.
- A Vercel account (sign up with GitHub for the shortest route).
Check that a production build works on your machine first, because Vercel runs the same command:
npm install
npm run build
If this fails locally it will fail on Vercel. Fix it here, where the error is easier to read.
Method 1: Deploy from GitHub (recommended)
- Push your code to a GitHub repository.
- Go to
vercel.com/newand choose Import next to your repository. Grant access if asked. - Vercel detects the framework (Next.js, Vite, Create React App, Astro, plain HTML). Leave the preset as detected.
- Open Environment Variables and add any secrets your app needs, such as a database URL or an email key. Never commit these to the repository.
- Click Deploy. In a minute or two you get a URL like
your-project.vercel.app.
From now on every push to your main branch deploys to production, and every other branch or pull request gets its own preview URL. That is the whole deployment pipeline.
Method 2: Deploy from the command line
Useful for projects that are not on GitHub:
npm install -g vercel
vercel login
vercel # creates a preview deployment
vercel --prod # deploys to production
The first run asks a few questions (project name, directory) and links the folder to a Vercel project.
Settings by project type
| Project | Build command | Output |
|---|---|---|
| Next.js | next build (detected) | Handled automatically |
| Vite or React | npm run build | dist |
| Create React App | npm run build | build |
| Plain HTML, CSS, JS | none | project root |
Add your own domain
- Open the project, then Settings → Domains, and enter your domain.
- Vercel shows the DNS records to add at your registrar. Use the exact values it displays for your project.
- Add the records at your registrar (GoDaddy, Hostinger, Namecheap and so on). Our domain connection guide walks through this.
- Wait for the check to turn green. HTTPS is issued automatically.
Pick one version as primary (usually the non-www or the www) and let Vercel redirect the other, so search engines see a single address.
Environment variables and secrets
Variables set in the dashboard are available at build time and runtime. Remember:
- Anything prefixed
NEXT_PUBLIC_is exposed to the browser. Never put a secret there. - Add variables to the right environment (Production, Preview, Development).
- After changing a variable, redeploy, because running builds keep the old value.
Common deployment errors and fixes
- "Module not found" only on Vercel. Vercel runs on Linux, where file names are case sensitive.
import Header from './header'works on Windows if the file isHeader.jsx, and fails on Vercel. Match the case exactly. - Build passes locally, fails online. Usually a missing environment variable or a different Node.js version. Set the Node version under Settings, or in
package.jsonunderengines. - 404 on refresh in a React single-page app. Add a
vercel.jsonrewrite sending all routes toindex.html. - API route times out. Serverless functions have time limits on each plan. Move long tasks to a queue or background job.
- Images do not load. Check paths are relative to
public/, and that remote image domains are allowed in your Next.js config. - Site works but changes do not appear. You may be looking at a preview deployment, or a cached page. Check the Deployments tab for the Production badge.
Important: free plan limits for businesses
Vercel's free Hobby plan is meant for personal, non-commercial use. If the website is for a business, read the current terms and plan to use a paid plan, or choose a host whose free tier allows commercial sites, such as Cloudflare Pages. Check the latest terms before you decide, because plans change.
Should you deploy it yourself?
If you are comfortable with GitHub and a terminal, the steps above take under an hour. If the site is a business asset and you would rather not manage DNS, SSL, environment variables and deploys, we set up the whole pipeline, with the accounts in your name, as part of every web development project.
Other places to deploy
Vercel is not the only option. The same idea applies everywhere: connect the repository, set the build command and output folder, add environment variables, deploy.
| Host | Good for | Notes |
|---|---|---|
| Netlify | Static sites, Next.js, React | Connect GitHub, set build command and publish directory, deploy |
| Cloudflare Pages | Static and edge sites | Free tier is open to commercial use at the time of writing; check current terms |
| Render | Sites with a backend service | Web service plus managed database |
| AWS (Amplify or EC2) | Teams already on AWS | Amplify is closest to the Vercel flow; EC2 means you manage the server |
| A VPS | Full control | You install Node, run the app and secure the server yourself |
To run a Next.js app on your own server, build it and keep it running behind a web server:
npm ci
npm run build
npm install -g pm2
pm2 start npm --name site -- start
Then put Nginx in front to serve it on port 80 and 443, and add a free certificate with Certbot. This is where most of the extra work sits, which is why many businesses prefer a managed host.