Vercel
Vercel is the recommended platform for Velocity.
Quick Deploy
Section titled “Quick Deploy”-
Push your code to GitHub, GitLab, or Bitbucket
-
Import project in Vercel Dashboard
-
Set environment variables:
SITE_URL= Your production domain
-
Click Deploy
CLI Deployment
Section titled “CLI Deployment”# Install Vercel CLIpnpm add -g vercel
# Deployvercel
# Deploy to productionvercel --prodServer-Side Features
Section titled “Server-Side Features”For API routes and server-side rendering, add the Vercel adapter:
pnpm add @astrojs/vercelimport vercel from '@astrojs/vercel';
export default defineConfig({ output: 'server', adapter: vercel(),});Environment Variables
Section titled “Environment Variables”Set in Vercel Dashboard → Project → Settings → Environment Variables:
SITE_URL=https://your-project.vercel.appPUBLIC_GA_MEASUREMENT_ID=G-XXXXXXXXXXCustom Domain
Section titled “Custom Domain”- Go to Project → Settings → Domains
- Add your domain
- Update DNS records as instructed
- Update
SITE_URLenvironment variable
Build Settings
Section titled “Build Settings”Vercel auto-detects Astro. Manual configuration if needed:
| Setting | Value |
|---|---|
| Framework Preset | Astro |
| Build Command | pnpm build |
| Output Directory | dist |
| Install Command | pnpm install |
Preview Deployments
Section titled “Preview Deployments”Every push creates a preview deployment:
https://your-project-git-branch-name.vercel.app
Perfect for testing before merging to main.
Edge Functions
Section titled “Edge Functions”With the Vercel adapter, API routes run on the edge:
export const config = { runtime: 'edge',};
export async function GET() { return new Response('Hello from the edge!');}Troubleshooting
Section titled “Troubleshooting”Build Fails
Section titled “Build Fails”Check build logs in Vercel Dashboard for errors.
Environment Variables Not Working
Section titled “Environment Variables Not Working”- Ensure no typos in variable names
- Redeploy after adding/changing variables
- Check if variable should be
PUBLIC_prefixed