The complete beginner-to-intermediate guide — from creating your first Next.js app to going live with a custom domain, environment variables, and automatic CI/CD deployments.
G-Tech Blog | 2026 | 15 min readDeploying a website used to mean wrestling with servers, configuring nginx, managing SSL certificates, and dealing with hosting bills. Vercel changed all of that. Built by the same team that created Next.js, Vercel is a cloud platform designed specifically for frontend and full-stack web applications — and for Next.js projects in particular, the deployment experience is as close to magic as web development gets. In this guide, you will go from zero to a live, production-ready Next.js website, completely free, with automatic deployments every time you push code to GitHub.
Vercel was founded by Guillermo Rauch, who also created Next.js. This means the platform is not just compatible with Next.js — it is built around it. Features that require significant server configuration on other hosting platforms work automatically on Vercel: server-side rendering (SSR), static site generation (SSG), incremental static regeneration (ISR), API routes, edge functions, image optimization, and middleware all work out of the box with zero configuration.
For a student, developer building a portfolio, or team launching an MVP, Vercel's free Hobby plan provides everything needed to run a production-quality website. You do not need a credit card to sign up, and the free tier does not expire after a trial period.
Before you start, make sure you have the following in place. Don't skip this section — each item is genuinely required to follow the steps below.
Node.js is the JavaScript runtime that powers Next.js development. npm (Node Package Manager) is included with Node.js and is used to install packages and run project scripts. You need both installed before you can create or run a Next.js project.
Open your terminal (Terminal on macOS/Linux, Command Prompt or PowerShell on Windows) and run:
node -v
If you see a version number like v20.11.0, Node.js is installed. Also check npm:
npm -v
If you see a version number for both, skip to Step 2. If you get a "command not found" error, continue below.
Go to nodejs.org and download the LTS (Long Term Support) version — this is
the stable, recommended version for most users. Run the installer and follow the prompts. Once installation
finishes, close and reopen your terminal, then verify with node -v and npm -v again.
Alternatively, if you use a package manager:
# macOS with Homebrew
brew install node
# Ubuntu / Debian Linux
sudo apt update
sudo apt install nodejs npm
# Windows with winget
winget install OpenJS.NodeJS.LTS
nvm install 20 then nvm use 20.
Next.js provides an official scaffolding tool called create-next-app that sets up a complete,
production-ready project structure in seconds. You do not need to install it separately — npx
(included with npm) downloads and runs it automatically.
In your terminal, navigate to the folder where you want to create the project (e.g. your Desktop or a Projects folder), then run:
npx create-next-app@latest my-website
The installer will ask you several setup questions. Here are the recommended answers for a beginner:
Would you like to use TypeScript? ⬺ No (or Yes if you know TypeScript)
Would you like to use ESLint? ⬺ Yes
Would you like to use Tailwind CSS? ⬺ Yes (optional, but very useful)
Would you like to use the `src/` directory? ⬺ No
Would you like to use App Router? ⬺ Yes (recommended)
Would you like to customize the default import alias? ⬺ No
Navigate into your new project folder and start the local development server:
cd my-website
npm run dev
Open your browser and go to http://localhost:3000. You should see the default Next.js welcome
page with an animated logo — your project is running locally. The development server supports hot
reloading, meaning changes you save in your code editor appear instantly in the browser without
refreshing.
npm run dev again each time you want to work on your project locally. The server only needs to
run when you are actively developing — you do not need it running for your deployed Vercel site to work.
Before pushing to GitHub, take a few minutes to understand what create-next-app generated. Knowing
your project structure makes it much easier to customize your site and debug problems later.
app/page.tsx
is your homepage. app/about/page.tsx would be /about.public/logo.png — /logo.png)..mjs) — Configuration file for Next.js. You can enable
experimental features, configure image domains, set redirects, and more here.node_modules folder and
.env.local file are excluded by default — this is correct and important.
npm install.Vercel deploys from Git repositories. GitHub is the most popular option and integrates most smoothly with Vercel. You need to create a GitHub repository for your project and push your code to it before Vercel can deploy it.
GitHub will show you a page with setup instructions. Copy the URL of your new repository — it will look like
https://github.com/yourusername/my-website.git.
Open your terminal inside your project folder and run these commands one at a time:
# Initialize a Git repository (if not already initialized)
git init
# Stage all files for the first commit
git add .
# Create your first commit
git commit -m "Initial commit"
# Rename the default branch to 'main'
git branch -M main
# Connect your local repo to the GitHub repo
git remote add origin https://github.com/yourusername/my-website.git
# Push your code to GitHub
git push -u origin main
Replace the URL with your actual GitHub repository URL. After running these commands, refresh your GitHub repository page — your project files should now appear there.
.env.local file to GitHub. It contains sensitive credentials like API keys
and database passwords. The .gitignore file created by create-next-app excludes it
automatically — but always double-check before pushing. If you accidentally expose a secret key, revoke and
regenerate it immediately.With your code on GitHub, deploying to Vercel takes under two minutes. The platform detects Next.js automatically and configures the build and deployment settings without any input from you.
next build or npm run build.nextnpm installYour URL will look like: https://my-website-yourusername.vercel.app. Click it — your website is
live on the internet.
.vercel.app domain). Share the production URL — it always reflects the latest deployment.
Most real-world Next.js applications use environment variables to store sensitive configuration — API keys,
database connection strings, authentication secrets, and third-party service credentials. You define these in a
.env.local file when developing locally, but for your Vercel deployment you add them through the
dashboard, where they are stored securely and injected into your build and runtime environment.
DATABASE_URL)Access variables in your server-side code (API routes, Server Components, getServerSideProps)
using process.env:
// In an API route or Server Component
const dbUrl = process.env.DATABASE_URL;
const apiKey = process.env.OPENAI_API_KEY;
To expose a variable to the browser (client-side code), prefix its name with NEXT_PUBLIC_:
# .env.local
NEXT_PUBLIC_GOOGLE_MAPS_KEY=your-maps-api-key-here
// In client-side code
const mapsKey = process.env.NEXT_PUBLIC_GOOGLE_MAPS_KEY;
NEXT_PUBLIC_ prefix for variables that are safe to expose to the browser.
Standard environment variables (without this prefix) are server-only and are never included in the JavaScript
bundle sent to users. Never prefix database passwords, secret keys, or private API credentials with
NEXT_PUBLIC_.
One of Vercel's most powerful features is its automatic CI/CD pipeline. Every time you push code to your GitHub repository's main branch, Vercel automatically runs a new build and deploys the updated version. No manual steps required — your live site updates within about a minute of your push.
Edit your code in your text editor, then run these commands to push and trigger a deployment:
# Stage all changed files
git add .
# Commit with a descriptive message
git commit -m "Add contact page and update homepage hero"
# Push to GitHub (triggers Vercel deployment automatically)
git push
After pushing, open your Vercel dashboard — you will see a new deployment appear immediately in the Deployments list, changing from Building to Ready within a minute or two. The live production URL automatically points to the new version as soon as the build succeeds.
If a deployment introduces a bug or breaks your site, Vercel makes it easy to instantly roll back to a previous working version. In your Vercel dashboard, go to the Deployments tab, find the last working deployment, click the three-dot menu next to it, and select Promote to Production. Your site reverts to that version in seconds — no code changes required.
The default .vercel.app URL works perfectly for development and portfolio projects, but for a
professional website you will want a custom domain like yourname.com or
yourstartup.co.ke. Vercel supports custom domains on the free Hobby plan, and the setup process is
straightforward.
mywebsite.com) and click Add.76.76.19.19) for apex
domains like mywebsite.comcname.vercel-dns.com for subdomains like
www.mywebsite.com
mywebsite.com (apex domain) and www.mywebsite.com in Vercel, then
configure one to redirect to the other. This ensures visitors who type either version reach the same site.
Vercel handles the redirect automatically once both domains are added.One of the features that makes Vercel exceptional for professional development workflows is preview
deployments. Every time you push to any branch other than main, Vercel automatically
builds and deploys that branch to a unique temporary URL. This lets you test changes in a real production
environment before merging them into your main site — without affecting what visitors see on your live
production URL.
Create a new branch for a feature you are building:
# Create and switch to a new branch
git checkout -b feature/new-homepage
# Make your changes, then push
git add .
git commit -m "Redesign homepage hero section"
git push -u origin feature/new-homepage
Vercel automatically builds this branch and gives it a URL like
https://my-website-git-feature-newhomepage-yourusername.vercel.app. Share this URL with a
colleague, client, or tester — they can review the live feature without seeing your production site.
When you are happy with the changes, merge the branch into main on GitHub. Vercel automatically
promotes the new build to production.
The Vercel dashboard is your control center for all deployed projects. Understanding its key sections helps you monitor, configure, and troubleshoot your deployments efficiently.
Shows every deployment in reverse chronological order with status (Ready, Building, Error), the commit message that triggered it, the branch, and the deployment URL. Click any deployment to view full build logs — key for diagnosing build failures.
Shows visitor data including page views, unique visitors, top pages, and traffic sources. The free plan includes basic analytics. Vercel Web Analytics can be enabled in your Next.js app with a few lines of code for more detailed real-user metrics.
Shows Core Web Vitals (LCP, CLS, FID/INP) measured from real user visits. These metrics directly affect your site's Google search ranking. Vercel's Speed Insights helps you identify and fix performance issues on specific pages.
Shows real-time runtime logs from serverless functions and API routes. If your API routes are returning errors, this is the first place to look — you can filter by log level (error, warning, info) and by function name.
Configure serverless function settings including region (choose the region closest to your users or database), memory allocation, and maximum execution duration. The free plan supports functions up to 10 seconds of execution time.
Configure which branches trigger production deployments, set up ignored build steps, and manage the GitHub integration. You can also connect Vercel to GitLab or Bitbucket repositories here.
Getting your site live is the first milestone. Making it fast and production-ready is the next. Next.js and Vercel together offer powerful optimization tools — here are the most impactful ones to implement before sharing your site with the world.
Use Next.js's built-in Image component instead of regular HTML <img> tags. It
automatically optimizes images — resizing, converting to modern formats (WebP, AVIF), and lazy-loading them. On
Vercel, image optimization runs serverlessly with no configuration required.
import Image from 'next/image';
export default function Hero() {
return (
<Image
src="/hero-photo.jpg"
alt="Hero image"
width={1200}
height={630}
priority // load above-the-fold images eagerly
/>
);
}
Next.js App Router provides a structured way to define page metadata for SEO. Add a metadata
export to any page:
// app/page.tsx
export const metadata = {
title: 'My Website — Home',
description: 'Welcome to my personal portfolio and blog.',
openGraph: {
title: 'My Website',
description: 'Personal portfolio built with Next.js and deployed on Vercel',
url: 'https://mywebsite.com',
images: [{ url: '/og-image.png', width: 1200, height: 630 }],
},
};
Next.js App Router defaults to static rendering (pre-built at deploy time) for maximum performance. Pages that need real-time data use dynamic rendering. Choose the right approach for each page: use static rendering for pages whose content does not change frequently (home page, about page, blog posts), and server rendering or client-side data fetching for pages showing live data (dashboards, user profiles).
Vercel's Hobby (free) plan is genuinely generous for personal projects, portfolios, and small applications. However, it does have limits that you should be aware of so you are not surprised if your project exceeds them.
| Feature | Hobby (Free) | Pro ($20/month per user) |
|---|---|---|
| Projects | Unlimited personal projects | Unlimited |
| Bandwidth | 100 GB / month | 1 TB / month |
| Serverless Function Duration | 10 seconds max | 300 seconds max |
| Build Minutes | 6,000 minutes / month | 24,000 minutes / month |
| Deployments per day | 100 | 6,000 |
| Team Members | 1 (personal only — no teams) | Up to 10 included |
| Custom Domains | Unlimited | Unlimited |
| Preview Deployments | Yes | Yes |
| Commercial Use | Not permitted | Permitted |
Vercel is the best choice for most Next.js projects, but it is not the only option. Here is how it compares to the main alternatives.
| Platform | Best For | Next.js Support | Free Tier |
|---|---|---|---|
| Vercel | Next.js (built by the same team) | Native, all features | Generous — 100GB bandwidth |
| Netlify | Static sites, JAMstack | Good — SSR via Netlify Functions | 100GB bandwidth, 300 build minutes |
| Render | Full-stack apps, APIs, databases | Good — Node.js web service | Free tier (cold starts on free plan) |
| Railway | Full-stack with databases | Good — containerized deployment | $5/month free credits |
| GitHub Pages | Purely static sites only | Partial — static export only | Free, no bandwidth limits |
| AWS / GCP / Azure | Enterprise, complex infrastructure | Manual configuration required | Complex free tiers |
A package used in your code is not installed. Run npm install locally, then push again. Also
check that the package is listed in package.json under dependencies (not just
devDependencies if it is needed at runtime).
Next.js treats TypeScript type errors and ESLint errors as build failures by default. Fix the errors in
your code, or temporarily add typescript: { ignoreBuildErrors: true } and
eslint: { ignoreDuringBuilds: true } in next.config.js to unblock the deployment
while you fix them.
Variables added to Vercel require a new deployment to take effect. After adding or
changing variables in the dashboard, go to Deployments and click Redeploy. Also confirm
that client-side variables use the NEXT_PUBLIC_ prefix.
Check the Vercel dashboard — if the latest deployment shows a build error, the production URL stays on the last successful deployment. Fix the error in your code, push again, and the new deployment will promote to production automatically when it succeeds.
DNS records have not propagated yet or were entered incorrectly. Double-check the A record and CNAME values in your registrar's DNS panel against what Vercel shows in Settings — Domains. Use a tool like dnschecker.org to verify propagation.
Check the Logs tab in your Vercel dashboard and filter by Error level. The most common causes are missing environment variables, database connection errors (wrong credentials or IP allowlist), and unhandled promise rejections. Add proper try/catch error handling to your API routes.
If you are using the Pages Router (not App Router), check that your page files are in the
pages/ directory. For App Router, each route needs a page.tsx or
page.js file inside its folder. Also check that dynamic routes use the correct
[param] folder naming.
The first request to a serverless function after a period of inactivity triggers a cold start (typically 200—500ms extra latency). Optimize function startup time by reducing imports, avoiding heavy initialization at module level, and considering Vercel's Edge Functions for latency-sensitive endpoints.
Next.js is built on top of React, so a basic understanding of React components, props, and state is very helpful. However, for simple websites (a portfolio, a blog, a landing page), you can get a long way with just HTML, CSS, and basic JavaScript inside Next.js's file-based routing system. If you are completely new to React, completing a React tutorial first (the official React docs at react.dev are excellent) will make your Next.js experience much smoother.
Vercel's Hobby plan is free and does not require a credit card to sign up. You'll not be billed unless you explicitly upgrade to a paid plan. However, the Hobby plan has usage limits (100GB bandwidth, 6,000 build minutes per month) — if you exceed these, Vercel will restrict your deployments rather than charge you. For the vast majority of personal projects, portfolios, and student projects, these limits are never approached.
Yes — and it works very well. Vercel has native integrations with several databases including Vercel Postgres (powered by Neon), Vercel KV (Redis), Vercel Blob (file storage), PlanetScale, Supabase, and MongoDB Atlas. You can also connect to any external database by adding the connection string as an environment variable. For serverless deployments, use a database that supports connection pooling (like Neon or PlanetScale) to avoid exhausting connection limits.
Vercel's infrastructure auto-scales. Your site will not go down from a traffic spike — Vercel spins up additional serverless function instances automatically. On the Hobby plan, the 100GB monthly bandwidth limit is the primary constraint. If you genuinely expect high traffic, upgrading to the Pro plan gives you 1TB of bandwidth and removes the commercial use restriction.
Yes — Vercel also supports GitLab and Bitbucket repositories. You can also deploy directly from the command
line using the Vercel CLI: install it with npm install -g vercel, then run vercel
inside your project folder and follow the prompts. This is useful for quick deployments without setting up a Git
repository, though the Git-based workflow is recommended for production projects because it gives you automatic
deployments and a full deployment history.
Deploying a Next.js website on Vercel is one of the smoothest experiences in modern web development. What used to require server configuration, SSL certificate management, and complex CI/CD pipelines now happens automatically in under two minutes — for free. From the moment you push your code to GitHub, Vercel handles the build, deployment, CDN distribution, HTTPS, and automatic updates without any intervention from you.
As your project grows, Vercel grows with it. Start with the free Hobby plan for your portfolio, personal projects, or learning experiments. Add a custom domain, set up environment variables, explore preview deployments for testing features, and use the built-in analytics to understand your visitors. When your project becomes a business, the upgrade path to Vercel Pro is smooth.
The best time to deploy your Next.js project is right now — before it is "finished," before it is perfect, before every feature is built. Get it live, share the URL, and iterate from there. That's how modern web development works, and Vercel makes it easier than it has ever been.