Master Code
On The Go

Learn. Practice. Build.

How-To Guide

How to Deploy with Vercel

Vercel offers free hosting with automatic HTTPS, a global CDN, and GitHub integration. Here's how to deploy any project in under 10 minutes.

📋 What You'll Need

✅ Vercel's Hobby plan is free forever for personal projects.

1

Push Your Code to GitHub

Open a terminal in your project folder and run:

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

If you've never used Git, see our Install Git guide first.

2

Sign Up at Vercel

Go to the official website:

👉 vercel.com

Click Sign Up and choose "Continue with GitHub". This authorises Vercel to read your repositories.

3

Import Your Repository

From the Vercel dashboard:

  • Click Add New → Project
  • Find your GitHub repo in the list
  • Click Import

Vercel auto-detects your framework. For plain HTML sites, leave everything default.

4

Deploy

Click the blue Deploy button. Vercel will:

  • Install dependencies
  • Build your project
  • Deploy to a global CDN
  • Give you a URL like your-project.vercel.app

The whole process takes about 30 seconds. 🎉

💡 Auto-deploys: Every push to main triggers a new production deploy. Every pull request gets its own preview URL. You never manually deploy again.

🌐 Adding a Custom Domain

  1. Go to Settings → Domains in your Vercel project
  2. Click Add and enter your domain
  3. Vercel shows DNS records to add at your registrar
  4. Add them and wait 5–60 minutes
  5. Vercel auto-issues an SSL certificate

Custom domains are optional. The free .vercel.app subdomain works fine for personal projects.

🔑 Environment Variables

If your app uses API keys, add them in Vercel rather than hardcoding them:

Access them in your code:

const apiKey = process.env.MY_API_KEY;

🔧 Troubleshooting

Build fails on Vercel but works locally

Usually a case-sensitive file path. Vercel's Linux build is case-sensitive; Windows and macOS are not. Check your imports.

404 on routes that work locally

Client-side routing (React Router, Vue Router) needs a rewrite rule. Add a vercel.json file with a wildcard rewrite to /index.html.

Site is slow on first load

Static sites on Vercel have no cold start. Serverless functions might. For static sites, this isn't an issue.

🎯 What's Next?

Now that your site is live, here are the next steps:

← All How-To Guides