Key Takeaways
- Vercel deploys any git push to a live URL automatically — no server configuration required
- Connect GitHub, import your repo, and your app is live in under 2 minutes
- Every branch gets its own preview URL — perfect for showing work before merging to main
- Environment variables are set in the Vercel dashboard and injected at build time
- Serverless functions in the
/apifolder run on Vercel's infrastructure without managing a server
What Is Vercel?
Vercel is a platform for deploying frontend web applications. You connect your GitHub (or GitLab or Bitbucket) repository, and every push automatically triggers a build and deployment. Your app is live on a global CDN with HTTPS, without you managing a server, a Docker container, or a deployment script.
Vercel was built by the same team that created Next.js. That makes Next.js deployments on Vercel essentially zero-configuration — the platform understands Next.js project structure natively. But Vercel supports dozens of other frameworks too.
The free Hobby tier is real and genuinely generous. Most personal projects and side projects run fine on it. The Pro tier adds team collaboration features and higher usage limits.
Your First Deployment in 3 Steps
Here's exactly how to deploy a Next.js app to Vercel from scratch.
Step 1: Push your code to GitHub
If you don't have a Next.js app yet, create one:
npx create-next-app@latest my-app
cd my-app
git init
git add .
git commit -m "initial commit"
gh repo create my-app --public --push
Step 2: Import the repo on Vercel
- Go to vercel.com and sign up with your GitHub account
- Click "Add New Project"
- Find your repo in the list and click "Import"
- Vercel detects Next.js automatically and sets the correct build command
- Click "Deploy"
Step 3: Get your live URL
Vercel builds your project and gives you a URL — something like my-app-chi.vercel.app. It's live immediately. Every subsequent push to your main branch re-deploys automatically.
Environment Variables
Almost every real app needs environment variables — API keys, database URLs, secret tokens. Hardcoding these in your code is a security disaster. Vercel handles them cleanly.
Setting environment variables
- Go to your project in the Vercel dashboard
- Click "Settings" → "Environment Variables"
- Add each variable with its name and value
- Choose which environments it applies to: Production, Preview, Development
In Next.js, variables prefixed with NEXT_PUBLIC_ are exposed to the browser. Variables without that prefix are server-side only. This matters — never put secret API keys in a NEXT_PUBLIC_ variable.
.env.local file in your project root for local development. Vercel's CLI (npx vercel env pull) can pull your remote environment variables into this file automatically — a huge convenience.
Preview Deployments
Preview deployments are one of Vercel's best features. Every branch you push and every pull request you open gets its own live URL automatically.
This means you can work on a new feature on feature/new-checkout, push it, and send the client a live link to review — without touching production. Feedback comes back, you make changes, push again, and the preview URL updates automatically.
How preview URLs work
Preview URLs follow a pattern like my-app-git-feature-new-checkout-yourteam.vercel.app. They're shareable, have HTTPS, and use your full app with the environment variables you designated for the "Preview" environment.
Comment integrations
On Pro plans, Vercel adds a comment toolbar to preview deployments. Reviewers can click any element on the page and leave a comment that gets posted to your pull request. This closes the loop between design review and code review without Loom videos or screenshots.
Custom Domains
Adding a custom domain to a Vercel project takes about two minutes.
- Go to your project → "Settings" → "Domains"
- Type your domain name and click "Add"
- Vercel shows you the DNS records to add — usually a CNAME pointing to
cname.vercel-dns.com - Add the records in your domain registrar (Namecheap, Cloudflare, Google Domains, etc.)
- Vercel detects the DNS change and issues an SSL certificate automatically (via Let's Encrypt)
If your domain is on Cloudflare, set Cloudflare's proxy to "DNS only" (the gray cloud, not the orange one) for the Vercel record. Cloudflare proxying + Vercel SSL can conflict.
Serverless Functions
Vercel runs backend code without a server. In a Next.js app, any file in /app/api/ (App Router) or /pages/api/ (Pages Router) is a serverless function that runs on Vercel's infrastructure.
Example: A simple API route
// app/api/hello/route.js
export async function GET(request) {
return Response.json({ message: 'Hello from Vercel' })
}
Deploy this and hit https://your-app.vercel.app/api/hello. That function runs on Vercel's servers on demand, scales automatically, and costs nothing on the free tier for reasonable usage.
Edge functions
Vercel also has Edge Functions, which run at the CDN edge — physically closer to your users, with lower latency. Edge Functions have a smaller runtime (no Node.js APIs), but they're powerful for middleware, authentication checks, and geolocation-based routing.
The Edge Network
When you deploy to Vercel, your static assets are distributed to Vercel's global CDN edge network. The exact number of edge locations changes, but Vercel operates in most major regions globally (UNVERIFIED exact count).
This means a user in Tokyo loading your app hosted on Vercel gets the static assets from a server physically near them, not from a data center in Virginia. Load times are faster, especially for content-heavy apps.
Vercel vs Alternatives
Vercel vs Netlify
Both are excellent deployment platforms. Vercel has better native support for Next.js and more powerful edge runtime. Netlify has a slightly longer track record, good form handling, and a strong plugin ecosystem. For Next.js projects, Vercel is the natural pick. For everything else, either works well and the choice often comes down to team preference.
Vercel vs Railway
Different tools for different jobs. Vercel is frontend-first — great for static sites, SSR, and serverless functions. Railway runs full backend servers — databases, Docker containers, background jobs. Many teams use both: Vercel for the frontend, Railway for backend services.
Vercel vs AWS
AWS is more powerful and more complex. Vercel handles the infrastructure so you don't have to. For a startup or solo developer, Vercel's simplicity beats AWS's flexibility until you have a specific reason to need the control. Most apps never reach that point.
FAQ
Is Vercel free?
Vercel has a generous free Hobby tier for personal projects. It includes unlimited deployments, 100GB bandwidth per month, and serverless function execution. The Pro plan ($20/month per user) adds team features, higher limits, and removes the Vercel branding requirement on commercial projects.
Can you deploy anything to Vercel or just Next.js?
Vercel supports any frontend framework — React, Vue, Svelte, Astro, SvelteKit, Nuxt, Angular, and plain HTML/CSS/JS. It was built by the Next.js team so Next.js has the best support, but Vercel works well with most modern frameworks.
What is a preview deployment in Vercel?
Every time you push a branch or open a pull request, Vercel automatically deploys a preview URL — a live version of that branch. This lets you share working links with teammates, clients, or reviewers without touching production.
Vercel vs Netlify — which is better?
Both are excellent. Vercel has better Next.js support and more powerful serverless edge functions. Netlify has a longer-standing edge network and slightly more flexible form/function tooling. For pure Next.js projects, Vercel is the natural choice. For other frameworks, either works well.