Deploy Local Project to Vercel & Connect Domain
In this article
This guide explains how to deploy a project from your local machine to Vercel and connect your own custom domain. You’ll use the Vercel CLI or Git integration to upload your code, then add your domain in the Vercel dashboard and update your DNS records.
Background: What Vercel Does
Vercel is a cloud platform for static sites and serverless functions. It’s built around the Jamstack approach—JavaScript, APIs, and pre-rendered markup—and it’s the company behind the Next.js framework. When you deploy, Vercel builds your project on its servers, assigns a temporary *.vercel.app URL, and then serves it over HTTPS. You can connect a custom domain later, and Vercel will automatically provision an SSL certificate for it.
Vercel supports many frameworks out of the box—React, Vue, Svelte, Astro, and plain static HTML—and it detects the build command and output directory automatically. For projects that need a server, you can add serverless functions in the api/ directory or use a framework like Next.js that handles both frontend and backend.
Prerequisites
Before you start, make sure you have:
- A Vercel account (free tier is fine for most projects).
- Node.js installed locally (version 18 or newer is typical).
- A project that builds successfully on your machine.
- Access to your domain’s DNS settings (where you bought the domain or your DNS provider).
If your project uses environment variables (like API keys), you’ll need to add them in the Vercel dashboard after the first deploy.
Deploying with the Vercel CLI
The quickest way to deploy a local project is with the Vercel CLI. Open a terminal in your project’s root directory and run:
npm i -g vercel(install the CLI globally).vercel login(authenticate with your Vercel account).vercel(start the deployment wizard).
The wizard asks a few questions: the project name, the root directory, and whether to override the build settings. If you’re happy with the defaults, accept them. The CLI then uploads your files, runs the build, and prints a preview URL like https://your-project.vercel.app.
To deploy to production instead of a preview, run vercel --prod. The first deploy is always a preview unless you use the --prod flag. After that, every vercel command creates a preview URL, and vercel --prod updates the production deployment.
Deploying with Git Integration
If you prefer to push from GitHub, GitLab, or Bitbucket, you can import your repository in the Vercel dashboard:
- Go to
vercel.com/newand select your Git provider. - Authorize Vercel to access your repositories.
- Choose the repository you want to deploy.
- Vercel detects the framework and suggests build settings. Adjust if needed, then click Deploy.
After the first import, every push to the main branch triggers a production deployment, and pull requests get their own preview URLs. This is handy for teams because you can test changes before merging.
Connecting Your Own Domain
Once your project is deployed, you can add a custom domain:
- In the Vercel dashboard, go to your project → Settings → Domains.
- Type your domain (e.g.,
example.comorwww.example.com) and click Add. - Vercel shows you the DNS records to create at your registrar. Typically, you’ll add an
Arecord pointing to76.76.21.21for the apex domain, and aCNAMErecord forwwwpointing tocname.vercel-dns.com. - Go to your DNS provider’s dashboard and add those records.
- Wait for propagation (can take a few minutes to a few hours) and then click Refresh in Vercel. Once verified, Vercel automatically issues an SSL certificate.
If you want both example.com and www.example.com to work, add both and set one as the redirect target. Vercel handles the redirect automatically.
Common Problems and How to Fix Them
Here are a few issues you might run into:
- Build fails – Check the build logs. Usually it’s a missing dependency or a syntax error. Run
npm installlocally and make sure the build command works. - Domain not verifying – Double-check that your DNS records are exactly as Vercel shows them. Sometimes there’s a typo or you added AAAA records by mistake. Also, if you have a domain from a registrar that uses its own nameservers, make sure you’re editing the right DNS zone.
- SSL certificate not issued – Vercel issues certificates automatically, but it can take up to 24 hours. If it’s stuck, remove the domain and add it again.
- Environment variables missing – If your site works locally but not on Vercel, you probably forgot to add environment variables in the project settings.
- Redirect loop – If you set up a redirect from
wwwto the apex (or vice versa), make sure you didn’t add both as separate domains without a redirect rule.
Costs and Limits
Vercel’s free tier is generous: unlimited static sites, 100GB bandwidth, and 100 serverless function invocations per day. For most personal projects, that’s enough. Paid plans start at $20 per month and raise those limits, add team features, and allow more concurrent deployments.
Custom domains are free—you only pay for the domain registration itself (usually $10–$15 per year). Vercel doesn’t charge extra for SSL certificates.
Alternatives to Vercel
If Vercel doesn’t fit your needs, consider:
- Netlify – Similar to Vercel, with a focus on static sites and serverless functions. It also offers a drag-and-drop deploy option.
- GitHub Pages – Free for static sites, but no serverless functions and limited to 1GB bandwidth.
- Cloudflare Pages – Free with unlimited bandwidth, and it integrates with Cloudflare’s CDN.
- Render – Good for full-stack apps that need a persistent server, not just serverless functions.
Frequently Asked Questions
Can I deploy a project without using Git?
Yes, the Vercel CLI allows you to deploy directly from your local folder. You don’t need a Git repository. However, you lose automatic deployments on push; you’ll have to run vercel --prod every time you want to update.
How do I deploy a project that isn't a static site?
Vercel supports serverless functions. You can add an api/ folder with JavaScript or TypeScript files that export a function. For example, api/hello.js could export a handler that returns JSON. Frameworks like Next.js handle this automatically.
What if my domain is already in use by another site?
You can’t connect a domain that’s already pointed to another host until you update the DNS records. Once you change the records, the domain will start serving your Vercel site. There’s no lock-in, but you should be aware that changing DNS affects the existing site.
Can I use a subdomain like blog.example.com?
Yes, add the subdomain as a domain in your Vercel project and create a CNAME record pointing to cname.vercel-dns.com. The subdomain will get its own SSL certificate.
How do I remove a deployment?
In the Vercel dashboard, go to your project → Deployments, find the deployment you want to remove, click the three-dot menu, and select Delete. You can also delete the entire project from the project settings.
Can I deploy a private repository?
Yes, Vercel can access private repositories if you grant permission during the Git integration setup. The code stays private; only the built output is public.