Skip to content

Deploy to Vercel

Vercel is a cloud platform for static sites and serverless functions. It is the company behind Next.js, and it provides a global edge network with automatic HTTPS, Git integration, and zero-configuration deployment for Astro projects .

For Astro Docus, Vercel is an excellent choice because:

  • Zero configuration required for static Astro sites
  • Automatic deployments on every Git push
  • Preview deployments for every pull request
  • Free Hobby plan suitable for personal projects
  • Auto-detects Astro and configures the build settings correctly

This guide covers two methods:

  1. GitHub Integration (recommended) — Vercel builds and deploys automatically
  2. Vercel CLI — deploy directly from your local machine

Before starting, you need:

  • A Vercel account (free)
  • Your Astro Docus project pushed to GitHub (see the previous guide)
  • A terminal open in your project folder

Method 1 — Deploy via GitHub Integration

Section titled “Method 1 — Deploy via GitHub Integration”

This is the recommended method. Once set up, every push to your main branch triggers an automatic production deploy.

  1. Go to: https://vercel.com/signup
  2. Click Continue with GitHub
  3. Authorize Vercel to access your GitHub account
  4. Complete the onboarding flow

Using GitHub as your sign-in method simplifies the connection later.

  1. After logging in, you land on the Vercel dashboard
  2. Click the Add New… button and select Project
  3. You see a list of your GitHub repositories
  1. Find your Astro Docus repository in the list
  2. Click Import
  3. Vercel now shows the project configuration screen

Vercel auto-detects that this is an Astro project . The default settings are usually correct, but verify:

SettingValue
Framework PresetAstro (auto-detected)
Build Commandnpm run build
Output Directorydist
Install Commandnpm install

If these match, you do not need to change anything.

  1. Click Deploy
  2. Vercel begins building your site
  3. You see a build log with each step
  4. First build takes 1–3 minutes
  5. When complete, you see a success screen with your live URL

After deployment, you receive a unique URL:

https://astrodocus.vercel.app

Open this URL in your browser. Your Astro Docus site is now live.

Once connected, every push to your repository triggers:

ActionResult
Push to mainProduction deploy
Push to another branchPreview deploy with unique URL
Open a pull requestPreview deploy with PR comment

This means you never manually deploy again. Just git push, and Vercel handles the rest.


Use this method if you prefer to deploy from the command line or if your project is not connected to GitHub.

Terminal window
npm install -g vercel

Verify installation:

Terminal window
vercel --version
Terminal window
vercel login

This opens your browser. Log in to Vercel and authorize the CLI .

Navigate to your project folder and run:

Terminal window
vercel

The CLI detects Astro, builds your project, and deploys it .

When prompted “Want to override the settings?” choose N (No) .

The first vercel command creates a preview deployment. To deploy to production:

Terminal window
vercel --prod

This assigns the deployment to your production domain .

After deployment, the CLI outputs your live URL:

https://astrodocus.vercel.app

Every time you want to update the live site:

Terminal window
vercel --prod

Or for a preview first:

Terminal window
vercel
vercel --prod

A *.vercel.app subdomain works, but a custom domain looks more professional.

  1. In the Vercel dashboard, click your project
  2. Go to the Settings tab
  3. Click Domains in the sidebar
  1. Enter your domain (e.g., docs.yourdomain.com)
  2. Click Add

Vercel shows you the required DNS records. Go to your domain registrar (Namecheap, GoDaddy, Cloudflare, etc.) and add:

  • A record pointing to Vercel’s IP (for root domain)
  • CNAME record pointing to cname.vercel-dns.com (for subdomains)

After DNS propagates (usually minutes, sometimes hours), your custom domain works with HTTPS automatically .


The Hobby plan is free and sufficient for most personal projects :

ResourceIncluded
Bandwidth100 GB/month
Fast Origin Transfer10 GB
Edge Requests1,000,000/month
Build Minutes6,000/month
Image Transformations5,000/month
DeploymentsUnlimited
Team Members1

The Hobby plan is for non-commercial, personal use only . If you exceed limits, your project is paused until the next 30-day cycle.


Astro Docus ships as a static site, which means no adapter is required for Vercel .

If you want to use Vercel-specific features (Image Optimization, Web Analytics, Server-Side Rendering), install the Vercel adapter:

Terminal window
npx astro add vercel

This updates astro.config.mjs automatically . For a static Astro Docus site, this is not necessary.


ProblemLikely CauseFix
Build failsWrong Node versionSet NODE_VERSION environment variable
404 errorsWrong output directoryVerify dist is set
Site works locally but not on VercelMissing site URLSet site in astro.config.mjs
CLI authentication failsToken expiredRun vercel login again
Custom domain not workingDNS not propagatedWait, or check DNS records

If your project needs environment variables, set them in:

Vercel Dashboard → Your Project → Settings → Environment Variables

Or via CLI:

Terminal window
vercel env add VARIABLE_NAME

Common variables for Astro Docus:

VariableValuePurpose
NODE_VERSION20Ensures correct Node.js version
PUBLIC_SITE_URLhttps://yourdomain.comCanonical URL

Method 1 — GitHub Integration (recommended):
1. Sign up at vercel.com with GitHub
2. Add New → Project
3. Import your Astro Docus repository
4. Verify settings (auto-detected)
5. Click Deploy
6. Live at *.vercel.app
Method 2 — Vercel CLI:
1. npm install -g vercel
2. vercel login
3. vercel (preview)
4. vercel --prod (production)
5. Live at *.vercel.app
Custom Domain:
- Dashboard → Project → Settings → Domains
- Add domain → Configure DNS
- HTTPS automatic
Free Tier:
- 100 GB bandwidth/month
- 6,000 build minutes/month
- Unlimited deployments

Vercel is zero-config for Astro static sites. Once connected to GitHub, every git push deploys your site globally with preview URLs for every pull request.

👉 Next: docs/deploy-hosting/netlify.md — deploy to Netlify.