Prerequisites:
- A Vercel account (free tier available)
- Project repository on GitHub, GitLab, or Bitbucket
- Node.js 19+ for local builds
Vercel Configuration
The project includes avercel.json configuration file that handles client-side routing:
vercel.json
This rewrite rule ensures all routes are handled by React Router, enabling client-side navigation for paths like
/projects or /about without 404 errors.Deploy to Vercel
Connect your repository
- Go to vercel.com and sign in
- Click Add New Project
- Import your Git repository (GitHub, GitLab, or Bitbucket)
- Select the repository containing your portfolio
Grant Vercel access to your repository when prompted. You can limit access to specific repositories for security.
Configure project settings
Vercel automatically detects Vite projects. Verify these settings:
- Framework Preset: Vite
- Build Command:
npm run build(orvite build) - Output Directory:
dist - Install Command:
npm install - Node.js Version: 20.x (recommended)
Deploy
Click Deploy to start your first deployment.Vercel will:
- Clone your repository
- Install dependencies with
npm install - Run
npm run buildto create production bundle - Deploy to Vercel’s global CDN
- Assign a production URL (e.g.,
https://your-project.vercel.app)
Verify deployment
Once deployed, Vercel provides:
- Production URL: Your live site (e.g.,
pirsondev.vercel.app) - Deployment logs: Full build output for debugging
- Analytics: Traffic and performance metrics
- ✓ All pages load correctly
- ✓ Navigation works (React Router)
- ✓ Language switching functions (EN, ES, FR)
- ✓ Theme toggle works (light/dark mode)
- ✓ Vercel Analytics tracks pageviews
Automatic Deployments
Vercel automatically deploys your site when you push to Git:Production Deployments
Pushing to your main or master branch triggers a production deployment:- Detect the push via webhook
- Start a new build automatically
- Deploy to your production URL
- Update DNS records instantly
Production deployments typically complete in 1-2 minutes. Your site will show the new version once deployment finishes.
Preview Deployments
Pushing to any other branch or opening a pull request creates a preview deployment:https://your-project-git-feature-new-design.vercel.app.
Benefits of preview deployments:
- Test changes before merging to main
- Share work-in-progress with others
- Each commit gets its own URL
- No impact on production site
Environment Variables
If your portfolio uses environment variables, configure them in Vercel:Open project settings
Go to your Vercel project dashboard and click Settings → Environment Variables.
Add variables
For each environment variable:
- Enter the Key (e.g.,
VITE_API_URL) - Enter the Value (e.g.,
https://api.example.com) - Select environments: Production, Preview, Development
- Click Save
Accessing Environment Variables
In your Vite application, access variables viaimport.meta.env:
Custom Domains
Add a custom domain to your Vercel project:Add domain
- Enter your domain (e.g.,
pirsondev.com) - Click Add
- Vercel will show DNS configuration instructions
Configure DNS
At your domain registrar (GoDaddy, Namecheap, Cloudflare, etc.), add:For apex domain (
pirsondev.com):- Type:
A - Name:
@ - Value:
76.76.21.21
www.pirsondev.com):- Type:
CNAME - Name:
www - Value:
cname.vercel-dns.com
Vercel provides free SSL certificates for all domains with automatic renewal.
Vercel Analytics
The portfolio includes Vercel Analytics via@vercel/analytics:
src/main.jsx
- Real-time pageviews: See traffic as it happens
- Top pages: Understand which pages are most popular
- Referrer tracking: Know where visitors come from
- Device breakdown: Desktop vs mobile traffic
Analytics are available in your Vercel project dashboard under the Analytics tab. The free tier includes 100k events per month.
Performance Optimization
Vercel automatically provides several performance optimizations:Global CDN
Your site is distributed across 100+ edge locations worldwide, ensuring fast load times regardless of visitor location.Automatic Compression
Vercel applies Brotli and Gzip compression to all assets, reducing transfer sizes by up to 90%.Image Optimization
While this portfolio doesn’t use Next.js Image, you can optimize images by:- Using WebP format for photos
- Compressing images before committing
- Using SVG for icons and logos
Cache Headers
Vercel automatically sets optimal cache headers:- Static assets (
/assets/*): cached for 1 year - HTML (
index.html): no cache (always fresh)
Deployment Monitoring
Monitor your deployments in the Vercel dashboard:Build Logs
View complete build output for each deployment:- Go to Deployments
- Click on any deployment
- View Building and Function Logs tabs
Deployment Status
Each deployment shows:- ✓ Ready: Successfully deployed and live
- ⏳ Building: Currently building
- ✗ Error: Build failed (check logs)
- Canceled: Manually canceled
Build Time
Typical build times for this portfolio:- Cold build: 60-90 seconds (first build or after dependency changes)
- Warm build: 30-45 seconds (subsequent builds)
Troubleshooting
Build fails with 'command not found: npm'
Build fails with 'command not found: npm'
Vercel couldn’t find npm to install dependencies.Solution:
- Check Node.js version in project settings (should be 20.x)
- Verify
package.jsonexists in repository root - Ensure build command is set to
npm run build
Site loads but routing returns 404
Site loads but routing returns 404
The
vercel.json rewrite rule isn’t working.Solution:- Verify
vercel.jsonexists in repository root - Check that the rewrite rule matches:
{ "source": "/(.*)", "destination": "/" } - Redeploy after adding/fixing
vercel.json
Environment variables not working
Environment variables not working
Variables may not be prefixed correctly or not exposed to client.Solution:
- Ensure all client-side variables start with
VITE_ - Verify variables are added in Vercel dashboard
- Select correct environments (Production, Preview, Development)
- Redeploy after adding variables
Deploy succeeds but site shows old version
Deploy succeeds but site shows old version
Browser caching may be showing a stale version.Solution:
- Hard refresh:
Ctrl+Shift+R(Windows/Linux) orCmd+Shift+R(Mac) - Check deployment URL shows as “Current” in Vercel dashboard
- Verify correct Git branch is deployed
- Clear browser cache and cookies
CI/CD Integration
Vercel’s automatic Git integration provides complete CI/CD:Next Steps
Build Process
Learn about the Vite build process and optimization.
Development
Set up local development environment.
Need help? Visit Vercel Documentation or check your deployment logs in the Vercel dashboard.