Why Vercel?
Vercel is the recommended platform for deploying your portfolio because:- Zero Configuration: Automatically detects Astro projects
- Instant Deployments: Changes go live in seconds
- Global CDN: Fast loading times worldwide
- Free SSL: Automatic HTTPS certificates
- Environment Variables: Secure credential management
- Deploy Hooks: Enable scheduled rebuilds for fresh content
Prerequisites
Before deploying, ensure you have:Completed API Setup
All API credentials configured in your
.env file. See the API Setup guide for details.Vercel Account
A free account at vercel.com
Deploying to Vercel
Import Your Repository
- Log in to Vercel
- Click Add New… → Project
- Select your Git provider (GitHub, GitLab, or Bitbucket)
- Authorize Vercel to access your repositories
- Select the
jowy-portfoliorepository
Configure Project Settings
Vercel automatically detects Astro projects, but verify these settings:
- Framework Preset: Astro
- Build Command:
astro build(ornpm run build) - Output Directory:
dist - Install Command:
npm install
These settings are usually auto-detected from your
package.json. The build command comes from package.json:7.Add Environment Variables
This is the most critical step. Add all your API credentials:
- In the Vercel project settings, scroll to Environment Variables
- Add each variable from your
.envfile:
| Variable | Description |
|---|---|
SPOTIFY_CLIENT_ID | Your Spotify app client ID |
SPOTIFY_CLIENT_SECRET | Your Spotify app client secret |
SPOTIFY_ARTIST_ID | Your Spotify artist ID |
SOUNDCLOUD_CLIENT_ID | Your SoundCloud app client ID |
SOUNDCLOUD_CLIENT_SECRET | Your SoundCloud app client secret |
SOUNDCLOUD_AUTHORIZATION | Your SoundCloud OAuth token |
SOUNDCLOUD_USER_ID | Your SoundCloud user ID (numeric) |
YOUTUBE_API_KEY | Your YouTube Data API key |
YOUTUBE_PLAYLIST_SET_ID | Your YouTube playlist or channel ID |
GOOGLE_CALENDAR_SRC | Your public Google Calendar ID |
Custom Domain Setup
To use your own domain instead of the Vercel-provided URL:Add Domain in Vercel
- Go to your project’s Settings → Domains
- Enter your domain (e.g.,
jowysound.com) - Click Add
Configure DNS
Vercel will provide DNS records to add to your domain registrar:For root domain (
jowysound.com):- Type:
A - Name:
@ - Value:
76.76.21.21
www.jowysound.com):- Type:
CNAME - Name:
www - Value:
cname.vercel-dns.com
DNS propagation can take up to 48 hours, but usually completes within minutes.
Deployment Configuration
The portfolio includes several optimizations for production:Build Optimizations
Configured inastro.config.mjs:
- Sitemap Generation: Automatically creates
sitemap.xmlfor SEO (astro.config.mjs:19) - Asset Compression: Minifies HTML, CSS, and JS (astro.config.mjs:19)
- Image Optimization: Uses Sharp for responsive images (package.json:23)
Analytics Integration
The portfolio includes:- Vercel Analytics: User engagement tracking (package.json:14)
- Vercel Speed Insights: Performance monitoring (package.json:15)
Caching Strategy
The server-side cache system (src/server/services/cache.ts) optimizes API calls:
- Token Caching: Spotify and SoundCloud tokens are cached for ~1 hour
- Response Caching: API responses are cached to respect rate limits
- Build-time Fetching: Content is fetched during build, not on every page load
The in-memory cache resets with each build. This is intentional to ensure fresh content during weekly rebuilds.
Verifying Your Deployment
Check Build Logs
In the Vercel dashboard, click on your deployment to view detailed logs. Look for:
- Successful dependency installation
- No errors during
astro build - Confirmation of static file generation
Test API Integrations
Visit your deployed site and verify:
- Spotify tracks load correctly
- SoundCloud content appears
- YouTube videos display
- Calendar events are visible
Troubleshooting Common Issues
Build Fails
Error:Missing environment variables
Solution: Double-check all environment variables are added in Vercel settings with correct names (case-sensitive).
Error:
Command "astro build" exited with 1
Solution: Run npm run build locally to reproduce the error. Check for:
- TypeScript errors
- Missing dependencies
- Syntax errors in
.astrofiles
API Content Not Loading
Error: Spotify/SoundCloud/YouTube sections are empty Solution:- Check Vercel function logs for API authentication errors
- Verify environment variables are correctly set
- Ensure API credentials haven’t expired
- Check API quotas haven’t been exceeded
Domain Not Working
Error: Domain shows “This site can’t be reached” Solution:- Verify DNS records are correct in your registrar
- Wait for DNS propagation (can take up to 48 hours)
- Use DNS Checker to verify propagation
Alternative Deployment Platforms
While Vercel is recommended, you can also deploy to:Netlify
- Connect your Git repository to Netlify
- Set build command:
npm run build - Set publish directory:
dist - Add environment variables in Netlify dashboard
Cloudflare Pages
- Connect repository to Cloudflare Pages
- Framework preset: Astro
- Build command:
npm run build - Output directory:
dist - Add environment variables in Pages settings
Self-Hosted
For self-hosting on a VPS:Deployment Checklist
Before going live, verify:- All environment variables are set in Vercel
- Build completes successfully without errors
- All API integrations are loading content
- Custom domain is configured (if applicable)
- SSL certificate is active (automatic on Vercel)
- Analytics are tracking (check Vercel Analytics dashboard)
- Lighthouse performance score is acceptable
- Site is responsive on mobile devices
- All links work correctly
- Social media meta tags are correct
Next Steps
Now that your portfolio is live:- Set up automated weekly rebuilds to keep content fresh
- Monitor Vercel Analytics to understand your audience
- Consider setting up a custom 404 page
- Optimize images for even better performance