nextjs
vercel
deployment
devops

Deploying Your Next.js App with Vercel

EL FAKIR Ismail
June 27, 2025
3 min read

You’ve built a beautiful Next.js application—now it’s time to put it live on the internet.

Luckily, Vercel (the creators of Next.js) offers the easiest and most optimized way to deploy Next.js apps.

In this guide, we’ll walk you through the process of deploying your app to Vercel step-by-step, along with pro tips for performance, environment variables, and custom domains.


Why Choose Vercel?

Vercel is the official platform for deploying Next.js applications. Here’s why it’s a top choice:

  • One-click GitHub integration
  • Automatic CI/CD for every push
  • Serverless functions + edge support
  • Global CDN for lightning-fast performance
  • First-class support for App Router & RSC


Step 1: Prepare Your Next.js Project

Make sure your project is ready for production:

npm run build

This will generate an optimized production version of your app in the .next/ directory.

Pro tip: Run npm run lint and npm run test (if applicable) to catch issues before deploying.

Step 2: Push Your Code to GitHub

If your project isn’t on GitHub yet:

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

Make sure your main branch has your latest code.


Step 3: Deploy to Vercel

  1. Go to https://vercel.com
  2. Sign in with GitHub/GitLab/Bitbucket
  3. Click "Add New Project"
  4. Select your Next.js repo
  5. Accept defaults or configure build settings if needed
  6. Click “Deploy”

That’s it! Vercel will:

  • Detect your Next.js app
  • Build and deploy it
  • Give you a live URL like https://your-app.vercel.app


Step 4: Add Environment Variables

Need environment variables for API keys or secrets?

  1. Go to your project dashboard on Vercel
  2. Click Settings > Environment Variables
  3. Add your variables (e.g., NEXT_PUBLIC_API_URL)
  4. Redeploy to apply changes
✅ Use NEXT_PUBLIC_ prefix for variables used in the browser.

Step 5: Connect a Custom Domain

  1. In your Vercel dashboard, go to Settings > Domains
  2. Add your domain (e.g., myapp.com)
  3. Update your DNS settings with your domain provider (Namecheap, GoDaddy, etc.)
  4. Vercel will issue a free SSL certificate automatically
You can also use subdomains like blog.mysite.com.

Bonus: Vercel CLI for Power Users

Install the CLI:

npm install -g vercel

Then deploy from the terminal:

vercel

You’ll be prompted to link your project and deploy instantly.


Tips for a Smooth Deployment

  • Use next.config.js for custom headers, redirects, rewrites
  • Set images.domains for external images (e.g., CDN images)
  • Use ISR (Incremental Static Regeneration) for dynamic + static content
  • Monitor performance with Vercel Analytics
  • Set up Preview Deployments for each Git branch or PR


Final Thoughts

Deploying a Next.js app with Vercel is fast, seamless, and incredibly powerful. Whether you’re building a portfolio, startup MVP, or enterprise app, Vercel gives you production-grade deployment with zero config and blazing performance.

Start small, scale instantly—your Next.js app is just one click away from being live.

Last updated: July 3, 2025