Deploy a Next.js Site to Vercel in 10 Minutes
Step by step: push your Next.js project to GitHub, import it into Vercel, add environment variables, connect a custom domain, and know the Hobby plan limits.
By UndieGravity, , 2 min read
Vercel is made by the team behind Next.js, so a Next.js project deploys there with almost no configuration. Every push to GitHub becomes a new deployment, and every pull request gets its own preview link.
Before you start
- Your project builds locally: run
npm run buildand fix any errors first. - The code is pushed to a GitHub, GitLab, or Bitbucket repository.
- You know which environment variables the project needs (check
.env.example).
1. Import the repository
- Sign in at vercel.com with your Git provider.
- Click Add New, Project and pick your repository.
- Vercel detects Next.js and fills in the build settings. Leave them as they are unless your app lives in a subfolder; then set Root Directory.
2. Add environment variables
Open Environment Variables before the first deploy and add each value from .env.example. You can set different values for Production, Preview, and Development. Remember that variables starting with NEXT_PUBLIC_ are built into the browser code, so changing them requires a new deployment.
3. Deploy
Click Deploy. The build log shows each step; if it fails, the error is near the end of the log and is usually the same one npm run build shows locally. You get a URL like my-site.vercel.app when it finishes.
4. Connect your domain
- Open the project's Domains settings and add your domain.
- Vercel shows the DNS records to create at your domain registrar.
- Once DNS updates, Vercel issues an HTTPS certificate automatically.
Add both example.com and www.example.com and redirect one to the other, so visitors and search engines see a single address.
How updates work
- Push to the main branch: a new production deployment.
- Open a pull request: a preview deployment with its own URL, perfect for showing a client before going live.
- Something broke: promote a previous deployment back to production with one click.
Know the plan limits
Vercel's free Hobby plan is for personal, non-commercial projects. A business website, client work, or a site with ads needs the paid Pro plan. Hobby also has monthly usage limits; check the current numbers on Vercel's pricing page before launch.
Deploying an HTML template or a commercial site on a budget? Netlify's free plan allows commercial use, and GitHub Pages is free for static personal and project sites.