Why Vercel?
This template is optimized for Vercel deployment:- Zero Configuration: The included
vercel.jsonprovides optimal settings - Built-in Analytics: Vercel Analytics and Speed Insights are pre-integrated
- Automatic Deployments: Every push to your repository triggers a deployment
- Preview URLs: Get unique URLs for every pull request
- Edge Network: Global CDN for fast content delivery
- Custom Domains: Free HTTPS with custom domain support
Prerequisites
Vercel Account
Create a free account at vercel.com
Deployment Methods
Method 1: Deploy with Vercel Dashboard (Recommended)
Import Repository
- Log in to Vercel Dashboard
- Click Add New → Project
- Import your Git repository

Configure Project
Vercel will auto-detect the Astro framework. The
vercel.json file provides these settings:No manual configuration needed! Vercel reads these settings automatically.
Deploy
Click Deploy and wait for the build to complete (usually 1-2 minutes).Vercel will:
- Install dependencies with pnpm
- Run the build command
- Deploy to the edge network
- Provide a production URL (e.g.,
your-project.vercel.app)
Method 2: Deploy with Vercel CLI
For advanced users who prefer command-line deployment:Post-Deployment Configuration
Custom Domain
Add Domain
- Go to your project settings on Vercel
- Navigate to Domains
- Click Add and enter your domain
Configure DNS
Point your domain to Vercel:
- A Record:
76.76.21.21 - CNAME:
cname.vercel-dns.com
Vercel provides specific DNS instructions based on your domain registrar.
Environment Variables
If you add features requiring environment variables:- Go to Project Settings → Environment Variables
- Add your variables (e.g.,
PUBLIC_API_KEY) - Redeploy for changes to take effect
Analytics Configuration
The template includes Vercel Analytics out of the box:Automatic Deployments
Production Deployments
Every push to your main branch triggers a production deployment:- Build your site
- Run any configured checks
- Deploy to production
- Send you a notification
Preview Deployments
Every pull request gets a unique preview URL:- Create a new branch
- Push changes
- Open a pull request
- Vercel comments with the preview URL
Preview deployments are perfect for testing changes before merging to production.
Deployment Configuration
Thevercel.json file controls deployment behavior:
- installCommand: Uses pnpm (as specified in
package.json) - buildCommand: Runs Astro build
- outputDirectory: Points to the build output
- github.silent: Reduces GitHub comment notifications
Troubleshooting
Build Failures
pnpm not found
pnpm not found
Vercel auto-detects pnpm from
packageManager in package.json. If issues persist, explicitly set it in vercel.json:Image optimization errors
Image optimization errors
Ensure Sharp is installed in dependencies:Sharp is required for Astro’s image optimization.
Build timeout
Build timeout
If your build takes longer than 15 minutes, consider:
- Optimizing large images before committing
- Reducing the number of pages generated
- Upgrading to a Vercel Pro account for longer build times
Deployment Issues
404 errors on routes
404 errors on routes
Astro generates static HTML files. Ensure your routes match the file structure in
src/pages/.Assets not loading
Assets not loading
Check that your
site configuration in astro.config.ts matches your deployment URL.Performance Optimization
Vercel provides built-in optimizations:- Edge Caching: Automatic caching at 100+ edge locations
- Compression: Brotli and gzip compression
- HTTP/2: Multiplexed connections
- Image Optimization: Automatic format and size optimization
Rollback Deployments
If something goes wrong:- Go to Deployments in your Vercel dashboard
- Find a previous successful deployment
- Click the three dots → Promote to Production
Next Steps
Custom Domain
Configure a custom domain for your portfolio
Vercel Analytics
Learn more about built-in analytics
Environment Variables
Manage sensitive configuration
Vercel CLI
Advanced CLI usage and commands