How to Deploy to Vercel with AI: From Code to Live in 5 Minutes
Your AI built the app. Now let's get it off your laptop and onto a URL the whole world can visit.
TL;DR: Push your AI-built project to GitHub, connect it to Vercel, add your environment variables, hit deploy. You'll have a live URL with free HTTPS in under five minutes. This guide walks through every click — plus the deployment errors AI won't warn you about.
Why Deployment Is the Scariest Step for AI Coders
You've been in the zone. Claude or Cursor just helped you build something real — a dashboard, a SaaS prototype, a portfolio that actually looks professional. It runs beautifully on localhost:3000. You can click every button, see every page, and it feels done.
Then someone asks: "Can you send me the link?"
And everything stops.
If you come from a construction background, think of it this way: you've built the house, passed rough-in inspections, and the interior looks great. But you still need the final inspection — the part where the inspector walks through and says "this is safe for people to occupy." Deployment is your final inspection. The live URL is your certificate of occupancy.
The problem? Most deployment guides are written for people with DevOps experience. They assume you know what a CI/CD pipeline is, what "build artifacts" means, or why you'd need a .env.production file. If you're a vibe coder who builds with AI, none of that background exists yet — and that's completely fine.
This guide gets your AI-built app from your machine to a live URL in five minutes. No terminal wizardry. No infrastructure degree. Just clear steps, real screenshots in your head, and the exact deployment pitfalls AI doesn't warn you about.
What You'll Build
By the end of this tutorial, you'll have:
- Your Next.js project pushed to a GitHub repository
- A Vercel account connected to that repository
- Environment variables configured so your app works in production — not just on your machine
- A live URL (like
your-app.vercel.app) you can share with anyone - Optionally: a custom domain pointing to your project
Prerequisites: A Next.js (or React) project that runs locally, a GitHub account, and a free Vercel account. That's it. If you don't have a project yet, check out our guide on building a landing page with AI — then come back here to deploy it.
Step 1: Push Your Project to GitHub
Before Vercel can deploy anything, your code needs to live on GitHub. Think of GitHub as the material yard — it's where Vercel picks up the blueprints and supplies to build your site.
If you've been working locally and haven't pushed to GitHub yet, here's the quick version. Open your terminal in your project folder and run:
git init
git add .
git commit -m "Initial commit - ready to deploy"
Now create a new repository on GitHub:
- Go to github.com/new
- Name your repository (match your project name — keep it simple)
- Leave it Public or set it to Private (either works with Vercel)
- Don't initialize with a README — you already have files
- Click Create repository
GitHub will show you commands to push existing code. Copy the two lines that look like this:
git remote add origin https://github.com/YOUR-USERNAME/YOUR-REPO.git
git branch -M main
git push -u origin main
Your code is now on GitHub. If you're fuzzy on what Git actually does, that's a great article to read after this one. For now, just know: your code is backed up online and Vercel can access it.
⚠️ Check your .gitignore before pushing. Your AI might have generated a .env or .env.local file with API keys or database passwords. These should never go to GitHub. Make sure your .gitignore file includes .env* — most Next.js projects include this by default, but double-check.
Step 2: Connect Vercel to Your GitHub Repo
Vercel is like a general contractor that specializes in one thing: taking your project files and turning them into a live, working website. It handles the server, the security certificate (HTTPS), and the global distribution — all the stuff you'd normally need a DevOps team for.
- Go to vercel.com and sign up (use "Continue with GitHub" — it's easiest)
- Click "Add New..." → "Project"
- You'll see a list of your GitHub repositories. Find the one you just pushed and click "Import"
- Vercel will auto-detect that it's a Next.js project and pre-fill the build settings
Don't click Deploy yet. There's one critical step most AI tutorials skip — environment variables. If your app uses any API keys, database URLs, or third-party services, deploying without them means your app will build but immediately break.
In construction terms: this is like passing framing inspection but forgetting to connect the water lines. The house looks done, but nothing works when you turn the faucet.
Step 3: Configure Environment Variables
This is where most first deployments fail. Here's why: when your AI helped you build your app, it probably created a .env.local file with lines like:
NEXT_PUBLIC_API_KEY=sk-abc123...
DATABASE_URL=postgresql://user:pass@localhost:5432/mydb
NEXT_PUBLIC_SITE_URL=http://localhost:3000
These environment variables only exist on your machine. Vercel has no idea they exist. You need to tell Vercel about each one.
On the import screen (before deploying), expand the "Environment Variables" section. For each variable in your .env.local:
- Type the variable name in the left field (e.g.,
DATABASE_URL) - Paste the value in the right field
- Choose which environments it applies to: Production, Preview, Development — for now, select all three
- Click Add
- Repeat for every variable
💡 Pro tip: Some values need to change for production. Your NEXT_PUBLIC_SITE_URL should change from http://localhost:3000 to your actual Vercel URL (like https://your-app.vercel.app). Your DATABASE_URL should point to a production database, not your local one. Go through each variable and ask: "Does this value still make sense when my app isn't on my laptop?"
How many environment variables should you have? A simple portfolio site might have zero. A SaaS app with authentication, a database, and payment processing might have 10-15. There's no wrong number — just make sure every one that exists in your .env.local has a corresponding entry in Vercel.
Step 4: Deploy
You've connected the repo. You've added the environment variables. Now click "Deploy".
Vercel will:
- Clone your code from GitHub
- Install your dependencies (
npm install) - Build your project (
npm run buildornext build) - Deploy the built files to their global edge network
You'll see a real-time build log. This is like watching the inspector walk through the house — they're checking that everything compiles, all the pieces connect, and nothing is missing.
If the build succeeds (green checkmark): Congratulations. You have a live URL. Click it. Share it. Text it to someone. You just deployed a real application to the internet.
If the build fails (red X): Don't panic. Scroll down to the "How to Debug Failed Deploys" section — the fix is almost always one of five common issues.
The whole process takes 30 seconds to 3 minutes, depending on how big your project is. After this first deploy, every time you push code to GitHub, Vercel will automatically rebuild and redeploy. Push code → site updates. That's it. No manual steps.
📌 Your Vercel URL: After a successful deploy, your app lives at your-project-name.vercel.app. This URL is permanent, free, and has HTTPS built in. You can use it forever or add a custom domain (next step).
Step 5: Add a Custom Domain (Optional)
The .vercel.app URL works, but if you want a professional presence — yourname.com or yourapp.io — Vercel makes custom domains straightforward.
- In your Vercel project dashboard, go to Settings → Domains
- Type your domain name (e.g.,
myawesomeapp.com) and click Add - Vercel will show you DNS records you need to add at your domain registrar
If you bought your domain from Namecheap, GoDaddy, Google Domains, or Cloudflare, you'll need to log into that service and add the records Vercel gives you. Usually it's one of two options:
- A Record: Point
@to76.76.21.21 - CNAME Record: Point
wwwtocname.vercel-dns.com
Think of DNS like the mailing address for your building. The building (your app) is already constructed and open for business on Vercel's servers. The domain name is just the address that tells visitors how to find it. Updating DNS records is like filing your new address with the post office — it takes a little time to propagate (5 minutes to 48 hours, usually under 30 minutes).
Vercel automatically generates and renews SSL certificates for custom domains. No configuration needed. Your site will be https:// from day one.
What AI Gets Wrong About Deployment
AI is incredible at generating code. It's not great at understanding the gap between "works on your machine" and "works on the internet." Here are the five most common deployment issues AI won't warn you about:
1. Missing Environment Variables
This is the #1 deployment failure. Your AI builds code that references process.env.DATABASE_URL, creates a .env.local file for you, and never mentions that Vercel doesn't automatically have access to it. The build might succeed, but the app crashes the moment it tries to connect to a database or call an API.
Fix: Before every deploy, compare your .env.local file with what's in Vercel's Environment Variables panel. Every key needs a corresponding entry.
2. Wrong Build Command
Vercel auto-detects most frameworks, but occasionally gets it wrong — especially if your AI set up a custom build process. If Vercel runs npm run build but your package.json has the build script named build:production or uses yarn instead of npm, the deploy will fail.
Fix: Check your package.json → scripts section. Make sure there's a "build" script. In Vercel, you can override the build command in Project Settings → General → Build & Development Settings.
3. Node.js Version Mismatch
Your local machine might be running Node 22. Vercel defaults to Node 18. If your AI used syntax or packages that require a newer Node version, the build will fail with cryptic errors that don't mention "Node version" anywhere.
Fix: In Vercel, go to Project Settings → General → Node.js Version. Set it to match your local version (run node --version in your terminal to check). Or add an "engines" field to your package.json:
{
"engines": {
"node": ">=20.0.0"
}
}
4. _next/static 404 Errors
Everything deploys successfully, the page loads, but all the styling is broken and the console shows 404 errors for files under /_next/static/. This usually happens when your next.config.js has a custom basePath or assetPrefix that doesn't match your deployment URL.
Fix: Open next.config.js. If you see basePath or assetPrefix set to anything other than empty, remove them (or set them to match your actual deployment path). Redeploy.
5. Case-Sensitive Imports
This one is devious. On your Mac, import Header from './header' works even if the file is named Header.js — because macOS file systems are case-insensitive. Vercel runs on Linux, which is case-sensitive. The build fails with "Module not found" for a file that clearly exists.
Fix: Make sure every import statement matches the exact filename, including capitalization. Ask your AI: "Check all my import statements for case sensitivity issues."
How to Debug Failed Deploys
Your deploy failed. The build log is showing red text and error messages that look like a foreign language. Here's a systematic approach to figure out what went wrong — even if you've never debugged a deploy before.
Step 1: Read the Last Error
Scroll to the bottom of the build log. The last error message is usually the most important one. Everything above it is just the cascade of things that broke because of that one root issue. Copy the last error message — the actual text.
Step 2: Ask Your AI
Paste the error into Claude, ChatGPT, or whatever AI tool you use. But don't just paste the error — give context:
I'm deploying a Next.js app to Vercel and the build failed.
Here's the error from the build log:
[paste error here]
My local build works fine with `npm run build`.
I'm using Node 20 locally.
What's causing this and how do I fix it?
Context is what separates a useful AI response from a generic one. For more on working through errors with AI, check out our guide on how to debug AI-generated code.
Step 3: Test Locally First
Before making changes and redeploying (which takes another 1-3 minutes each time), run the build locally:
npm run build
If this fails locally too, the problem isn't Vercel-specific — it's in your code. Fix it locally first, then push to trigger a new deploy.
Step 4: Check the Environment Variables
If the local build succeeds but Vercel's fails, the problem is almost always environment variables. Go to your Vercel dashboard → Project → Settings → Environment Variables. Compare every single variable name and value with your local .env.local file. One typo in a variable name, one missing variable, and the build crumbles.
Step 5: Check the Node Version
Run node --version locally. Then check what Vercel is using in Project Settings → General → Node.js Version. If they don't match, set Vercel's to match yours.
Step 6: Nuclear Option — Redeploy from Scratch
If nothing else works: delete the Vercel project, create a new one, re-import from GitHub, re-add environment variables, and deploy fresh. Sometimes old cached builds cause phantom issues. A fresh start takes 5 minutes and eliminates configuration ghosts.
💡 Build log trick: In your Vercel dashboard, click on any deployment → "Build Logs" tab. You can also see "Function Logs" under the "Logs" tab for runtime errors that happen after the build succeeds — like API routes crashing because of missing environment variables that are only needed at runtime, not build time.
After Your First Deploy: How Automatic Deployments Work
Once you've connected Vercel to GitHub, every future deployment is automatic. Here's the workflow:
- You make changes to your code (or your AI makes changes)
- You push those changes to GitHub:
git add . && git commit -m "update" && git push - Vercel detects the push within seconds
- It builds and deploys the new version automatically
- Your live site is updated with zero downtime
In construction terms: you've set up a conveyor belt from your workshop to the job site. Every time you finish a new piece, it automatically gets installed. No truck, no scheduling, no waiting.
Preview deployments are a bonus feature worth knowing about. If you create a separate branch in Git (like feature/new-header) and push it, Vercel creates a unique preview URL just for that branch. You can test changes without affecting your live site. When you're happy, merge the branch into main, and Vercel deploys the updated version to production.
What to Learn Next
You've deployed. Your app has a live URL. That's a massive milestone — most people who start building with AI never get past localhost. Here's where to go from here:
- What Is Vercel? — Understand the platform you just deployed to, including edge functions, serverless architecture, and why it's free
- What Are Environment Variables? — Deep dive into why they exist, how they work across environments, and security best practices
- What Is Git? — The version control system running behind the scenes every time you push code
- What Is GitHub? — How GitHub, Git, and Vercel work together in the deployment pipeline
- How to Debug AI-Generated Code — Essential skill for when deploys fail and your AI gives you the runaround
The biggest unlock for vibe coders isn't writing code — it's shipping code. Now that you know how to deploy, every project you build with AI can go live in minutes. The gap between "I built this" and "here's the link" just disappeared.
Frequently Asked Questions
Is Vercel free for personal projects?
Yes. Vercel's Hobby plan is completely free and includes unlimited deployments, automatic HTTPS, custom domains, and serverless functions. You only need a paid plan if you exceed 100GB bandwidth per month, need team collaboration features, or require advanced analytics. Most AI-built personal projects and portfolios will never hit these limits.
Can I deploy something other than Next.js to Vercel?
Absolutely. Vercel supports React (Create React App), Vue, Svelte, Nuxt, Astro, plain HTML/CSS/JS, and dozens of other frameworks. It auto-detects the framework and sets the build commands for you. Next.js gets the deepest integration since Vercel created it, but any frontend framework works well on the platform.
Why does my deploy work locally but fail on Vercel?
The three most common reasons: (1) Missing environment variables — Vercel doesn't have access to your local .env file, so you need to add each variable manually. (2) Wrong Node.js version — your local machine may run Node 20 while Vercel defaults to Node 18. Set it in Project Settings → General. (3) Case-sensitive file imports — your Mac treats Header.js and header.js as the same file, but Vercel's Linux servers don't.
How do I connect a custom domain to my Vercel project?
Go to your Vercel project → Settings → Domains → type your domain → click Add. Vercel gives you DNS records (an A record or CNAME). Add those at your domain registrar (Namecheap, GoDaddy, Cloudflare, etc.). SSL certificates are generated automatically. DNS propagation takes 5 minutes to 48 hours, but usually resolves within 30 minutes.
What happens when I push new code to GitHub after deploying?
Vercel automatically rebuilds and redeploys your app every time you push to the connected branch (usually main). This is called continuous deployment. Push code → Vercel detects → builds → swaps live with zero downtime. You can also get preview deployments on pull request branches to test changes before they go to production.