# Deploying on Vercel

> Deploy a Next.js app with Git-based deploys, preview URLs per pull request, environment variables and edge caching. Free notes, key concepts, resources and a...

Canonical: https://www.internhack.in/roadmaps/tracks/full-stack/vercel
Last updated: 2026-11-28

Deploy a Next.js app with Git-based deploys, preview URLs per pull request, environment variables and edge caching.

Intermediate · about 3 hours · difficulty 2/5

Learn first: [Environments, Config and Secrets](https://www.internhack.in/roadmaps/tracks/full-stack/environment-and-config), [Data Fetching and Caching in Next.js](https://www.internhack.in/roadmaps/tracks/full-stack/nextjs-data-and-caching)

**Vercel** is built by the team behind Next.js and is the fastest way to put a Next.js app online. Connect a GitHub repo and every push deploys.

### How it works

- Pushing to main creates a **production** deployment; every pull request gets a **preview URL** you can share with reviewers.
- Pages and route handlers run as serverless or edge functions; static assets are served from a global CDN.
- Environment variables are set per environment (development, preview, production).
- **Instant rollback** to any previous deployment if something breaks.

### Connecting a database

Use a hosted PostgreSQL (Neon, Supabase or another provider) with a **pooled** connection string, because each function instance may open its own connections. Run migrations in a build step or a CI job, not on every function start.

### Know the limits

The free Hobby plan is for personal, non-commercial projects. Functions have execution time limits, and long-running WebSocket servers or heavy background work do not fit. Pair Vercel with a separate worker or service for those.

### Pitfalls

- Exhausting database connections from serverless functions without pooling.
- Forgetting to set environment variables for the preview environment.
- Building commercial products on the Hobby plan.

You are ready to move on when your Next.js portal deploys from GitHub with preview URLs on pull requests, a managed PostgreSQL database and migrations applied automatically.

## Key concepts

- **Git-based deployments**
- **Preview deployments**
- **Environment variables per environment**
- **Serverless and edge functions**
- **Database connection pooling**
- **Rollbacks**
- **Netlify**

## Other options for this step

- [Deploying on Render or Railway](https://www.internhack.in/roadmaps/tracks/full-stack/render): Deploy long-running Node.js servers, background workers and PostgreSQL on a platform-as-a-service from a Git repo or Dockerfile.

## Mini project

Deploy your Next.js placement portal to Vercel with a hosted PostgreSQL database, preview deployments on pull requests, and a CI step that applies migrations before production deploys.

## Check yourself

Your Vercel app works for a few users but starts failing with 'too many connections' during a traffic spike. What is happening and how do you fix it?

## Free resources

- [Vercel Documentation](https://vercel.com/docs) (Vercel)
- [Deploying Next.js](https://nextjs.org/docs/app/getting-started/deploying) (Next.js)

Previous: [Docker for Full-Stack Apps](https://www.internhack.in/roadmaps/tracks/full-stack/docker) · Next: [Deploying on Render or Railway](https://www.internhack.in/roadmaps/tracks/full-stack/render)

## More in Configuration, Containers and Deployment

- [Environments, Config and Secrets](https://www.internhack.in/roadmaps/tracks/full-stack/environment-and-config)
- [Docker for Full-Stack Apps](https://www.internhack.in/roadmaps/tracks/full-stack/docker)
- [Deploying on Vercel](https://www.internhack.in/roadmaps/tracks/full-stack/vercel)
- [Deploying on Render or Railway](https://www.internhack.in/roadmaps/tracks/full-stack/render)
- [Managed Databases, Domains and HTTPS](https://www.internhack.in/roadmaps/tracks/full-stack/managed-postgres-and-domains)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [Full-Stack Developer Roadmap](https://www.internhack.in/roadmaps/tracks/full-stack)
