47 model prices

    Guide

    How to Deploy on Vercel: From Git Push to Live URL

    Deploy a Git repo to Vercel step by step: pre-deploy checks, env var scopes, custom domains and DNS, preview deployments, plus the CLI commands.

    9 min read

    TL;DR. Vercel turns a Git push into a production URL. You import a repo, set environment variables per scope, attach a domain, and use preview deployments as your review step. This guide covers the full path plus the parts that break first: env var scopes, build settings, function runtimes, and rollbacks.

    If you searched for how to deploy vercel projects and want the real workflow instead of a signup walkthrough, this is it. Vercel is the default host for Next.js and works well for Vite, Astro, SvelteKit, Remix and plain static sites. It suits vibe-coded projects because the loop is short: your AI tool writes code, you push, you get a URL in minutes.

    Before you deploy: what to check locally

    Most failed first deploys come from the local setup, not from Vercel. Run these before you import anything:

    • Run the production build locally. npm run build (or pnpm build) must pass on a clean checkout. Vercel runs the same command on a fresh machine with no cache.
    • Commit your lockfile. Vercel picks the package manager from the lockfile. A missing lockfile means unpinned versions and builds you can't reproduce.
    • Pin the Node version. Set engines.node in package.json, or choose the version in Project Settings. "Works on my machine" is usually a Node mismatch.
    • Keep secrets out of the repo. Add .env* to .gitignore. Code generated by Cursor or Claude Code sometimes hardcodes keys, so grep for them before the first push.
    • Fix case-sensitive imports. macOS ignores letter case in file paths and Linux build machines don't. import Header from './header' against Header.tsx passes locally and fails on Vercel.

    If an AI tool generated most of the code, run the type check and linter as well. Vercel fails the build on TypeScript errors in many framework presets, and you want to see them before you push.

    Step-by-step: from git push to live URL

    1. Sign in with your Git provider. Go to vercel.com and sign in with GitHub, GitLab or Bitbucket. Grant access only to the repos you need, not the whole account.
    2. Import the repository. Click New Project on your dashboard and select the repo. Vercel detects the framework and fills in the build command and output directory. For a monorepo, set the Root Directory to the app's folder.
    3. Check the detected settings. Confirm the framework preset, the install command and the Node version. Override only when you have a reason.
    4. Add environment variables before the first deploy. The first build runs immediately, so add them on the import screen. Otherwise the first build fails or ships with broken config.
    5. Deploy. Vercel builds, uploads the output and gives you a *.vercel.app URL. Open it and test the real flows (login, checkout, forms), not just the homepage.
    6. Check the production branch. Vercel picks main when it exists, then master, then the repository's default branch. Pushes to it deploy to production, and pushes to any other branch deploy as previews. You can change it under the project's Environments settings.

    You can also deploy from the terminal:

    npm i -g vercel
    vercel login
    vercel link          # connect the local folder to a project
    vercel               # preview deployment
    vercel --prod        # production deployment
    

    Git-based deploys are the better default because every deploy ties to a commit. Use the CLI for one-off tests or when a repo isn't connected.

    Environment variables without the footguns

    Vercel lets you scope each variable to Production, Preview or Development (teams can also define custom environments). Most deploy bugs come from getting this wrong.

    • Use separate values per scope. Point Preview at a staging database or a Supabase branch, not production. Otherwise a QA click on a preview URL writes to real user data.
    • Know what ships to the browser. In Next.js, only variables prefixed NEXT_PUBLIC_ reach client code (Vite uses VITE_). Anything with that prefix is public, so never put a service-role key or a Stripe secret key behind it.
    • Redeploy after changing a variable. Existing deployments keep the values they were built with. Editing a variable doesn't touch them. Trigger a redeploy to apply the change.
    • Pull variables for local dev. vercel env pull .env.local syncs the Development scope so your machine matches the project.
    • Use the Secret type for credentials. Vercel's variables come in two types: Config values stay readable to team members with access, while Secret values are write-only after saving. In the CLI, vercel env add takes --type secret (or --sensitive).

    A quick audit: list every variable your code reads (grep -r "process.env" src) and confirm each exists in all three scopes where it's needed.

    Custom domains, DNS and SSL

    Open Settings → Domains and add your domain. Vercel then shows the exact records to create. Use those values rather than copying an IP from a blog post, because the dashboard is the source of truth for your project.

    • Apex domain (example.com): add the A record Vercel shows, or move nameservers to Vercel.
    • Subdomain (app.example.com): add a CNAME to the target Vercel gives you.
    • www vs apex: pick one as canonical and redirect the other. Vercel can do this from the Domains panel.
    • SSL: certificates are issued and renewed automatically once DNS resolves. If the domain stays on "Invalid Configuration", check that no old AAAA record or proxy is overriding your records.

    If Cloudflare manages your DNS, set the Vercel records to DNS only (grey cloud) at first. Proxying a Vercel-hosted domain through another CDN adds caching layers that make debugging harder. If you're weighing the two platforms for the whole stack, Vercel vs Cloudflare 2026 covers the tradeoffs.

    Preview deployments as your QA process

    Every push to a non-production branch gets its own URL, and pull requests get a bot comment with the link. That makes review a click instead of a local checkout.

    What to do with them:

    • Test the preview, not localhost. The preview runs the production build with your Preview-scoped environment variables, so it exposes differences your dev server hides.
    • Protect previews. Open Settings → Deployment Protection. Standard Protection is available on all plans and covers every deployment except production domains, and Vercel Authentication limits access to Vercel users with the right access. Shareable links let outside reviewers in. Without protection, anyone with a preview URL can open it.
    • Gate merges on the preview. Require the Vercel deployment check to pass before merging, so a failing build can't reach main.
    • Share links with non-developers. Designers and clients can open a preview and leave comments with Vercel's comments feature, subject to your protection settings.

    For vibe coding this is the safety net. When an AI tool rewrites half a feature, the preview shows you the result before it touches production. Best AI Coding Tools 2026 compares the tools that feed this loop.

    Serverless functions, edge runtime and next.js hosting

    Vercel's next.js hosting is the most complete of the framework integrations, since the same company builds both. Server rendering, route handlers, middleware and image optimization work with no extra config. If you're on the newest App Router features, Next.js 16 Complete 2026 and React 19 Complete 2026 cover the framework side.

    Choosing a runtime per route:

    Runtime Good for Watch out for
    Node.js (serverless) Database drivers, SDKs, most API routes Cold starts on rarely hit routes
    Edge Lightweight request handling where you need the Edge runtime Subset of Node APIs (no filesystem); many libraries won't run; Vercel recommends migrating to Node.js
    Static / ISR Marketing pages, docs, blog posts Stale content until revalidation

    Practical rules:

    • Default to Node.js unless you have a concrete reason for the edge. Vercel's own docs recommend migrating from Edge to Node.js, and recent Next.js releases no longer support runtime = 'edge'. Compatibility problems cost more than a few milliseconds saved.
    • Keep functions near your database. New projects default to Washington, D.C. (iad1); change the region under Settings → Functions or in vercel.json to match your database region. A fast edge function that makes three slow cross-ocean queries is still slow.
    • Mind execution limits. Functions have maximum durations that depend on your plan. Long jobs (video, big imports, LLM pipelines) belong in a queue or background worker, not in a request handler.
    • Cache deliberately. Use revalidate or cache headers for data that can be a little stale, and don't cache anything user-specific at the CDN layer.

    Costs, limits and rollbacks

    The Hobby plan is free with included monthly usage, and exceeding it pauses the feature until the period resets, while Pro bills extra usage on demand. Before putting a product that takes payments or serves clients on Hobby, read Vercel's current terms and fair use guidelines rather than relying on a guide. Bandwidth, function execution time and image optimization are the usual sources of surprise bills.

    To keep usage predictable:

    • Set up usage notifications in the dashboard. Spend Management is configurable on Pro and not available on Hobby.
    • Serve large media from object storage or a dedicated CDN rather than through your app.
    • Watch function logs for loops and retry storms, since a bad cron or webhook can burn through quota overnight.

    Rollbacks are one of the platform's strengths. Every deployment is immutable and kept, so recovery is quick:

    1. Open the Deployments tab and find the last good production deployment.
    2. Use Instant Rollback on it, or run vercel rollback [deployment-id or url]. On Hobby you can only roll back to the previous production deployment; going further needs Pro.
    3. Fix the bug on a branch, verify it on a preview, then merge. Run vercel promote [deployment-id or url] to undo a rollback, which also re-enables auto-assignment of your production domains.

    Roll back first and debug afterwards. If the break involves a database migration, remember a rollback restores code and not your schema, so keep migrations backward compatible.

    Next Steps

    • Deploy a throwaway repo first and walk through the env var scopes, so a mistake costs nothing.
    • Add the Vercel check as a required status on your main branch.
    • Decide where your stack should live long-term with Vercel vs Cloudflare 2026.
    • If AI tools write most of your code, compare options in Best AI Coding Tools 2026 and wire your favorite into this deploy loop.

    Newsletter

    The week in AI and developer tools, in one email.

    New models, tool releases and price changes. Once a week.