Complete guide for deploying Nova-Rewards frontend to Vercel with automated preview and production deployments.
# Run the setup script
bash scripts/setup-vercel.shGitHub Repository
↓
├─ Pull Request → Vercel Preview Deployment
│ ├─ Runs: vercel-preview.yml
│ ├─ Creates: Preview URL
│ ├─ Status Check: Required for merge
│ └─ Comment: PR with deployment link
│
└─ Push to main → Vercel Production Deployment
├─ Runs: vercel-production.yml
├─ Deploys to: app.nova-rewards.xyz
├─ SSL: Automatic via Let's Encrypt
└─ Cache: Edge Network with 1-year immutable assets
# Create feature branch
git checkout -b feature/my-feature
# Make changes and test locally
cd novaRewards/frontend
npm run dev
# Build locally to verify
npm run build# Push changes
git push origin feature/my-feature
# Create PR on GitHub
# This triggers: vercel-preview.ymlWhat happens:
- GitHub Actions runs
vercel-preview.yml - Vercel builds and deploys preview
- PR gets status check: "Vercel Preview Deployment"
- PR gets comment with preview URL
- Preview URL must pass before merging (branch protection)
# Review changes
# Test preview deployment
# Get code review approval
# Merge PR to main
# This triggers: vercel-production.ymlWhat happens:
- GitHub Actions runs
vercel-production.yml - Vercel builds and deploys to production
- Deployment goes to: app.nova-rewards.xyz
- SSL certificate automatically provisioned
- Edge Network caches static assets
Used for pull request deployments and testing.
NEXT_PUBLIC_API_URL=https://api-preview.nova-rewards.xyz
NEXT_PUBLIC_HORIZON_URL=https://horizon-testnet.stellar.org
NEXT_PUBLIC_ISSUER_PUBLIC=<testnet-issuer-public-key>
NEXT_PUBLIC_STELLAR_NETWORK=testnet
NEXT_PUBLIC_MULTISIG_CONTRACT_ID=<testnet-contract-id>Used for main branch deployments.
NEXT_PUBLIC_API_URL=https://api.nova-rewards.xyz
NEXT_PUBLIC_HORIZON_URL=https://horizon.stellar.org
NEXT_PUBLIC_ISSUER_PUBLIC=<mainnet-issuer-public-key>
NEXT_PUBLIC_STELLAR_NETWORK=public
NEXT_PUBLIC_MULTISIG_CONTRACT_ID=<mainnet-contract-id>/static/*
/_next/static/*
Cache Header:
Cache-Control: public, max-age=31536000, immutable
Benefits:
- Hashed filenames ensure cache busting
- 1-year TTL reduces server load
- Immutable flag prevents revalidation
- Vercel Edge Network serves globally
Next.js automatically handles:
- HTML pages: Revalidated on each request
- API routes: No caching by default
- ISR (Incremental Static Regeneration): Configurable per page
-
Deployments Tab
- View all deployments
- Check build logs
- Monitor build times
- View deployment status
-
Analytics Tab
- Page performance metrics
- Core Web Vitals
- Traffic patterns
- Error rates
-
Logs Tab
- Build logs
- Runtime logs
- Error logs
- Request logs
-
Actions Tab
- View workflow runs
- Check job status
- Review logs
- Monitor execution time
-
PR Status Checks
- CI status
- Vercel Preview Deployment status
- Required checks for merge
Check:
- Vercel build logs
- Environment variables are set
npm run buildworks locally- Node.js version (Next.js 14 requires Node 18+)
Fix:
# Test build locally
cd novaRewards/frontend
npm install
npm run buildCheck:
- Vercel deployment status
- Build logs for errors
- Environment variables for Preview
- PR status checks pass
Fix:
- Check Vercel dashboard for deployment errors
- Verify Preview environment variables
- Retry deployment from Vercel dashboard
Check:
- DNS records configured correctly
- DNS propagation status
- SSL certificate provisioned
- Domain registrar settings
Fix:
# Check DNS propagation
nslookup app.nova-rewards.xyz
# Verify SSL certificate
curl -I https://app.nova-rewards.xyzCheck:
- Browser DevTools → Network tab
- Response headers for
Cache-Control - Asset filenames contain hash
vercel.jsonheaders configured
Fix:
- Clear browser cache
- Hard refresh (Ctrl+Shift+R or Cmd+Shift+R)
- Check
vercel.jsonconfiguration - Verify hashed asset filenames
If production deployment has issues:
-
Identify Issue
- Check Vercel dashboard
- Review deployment logs
- Check error tracking
-
Rollback
- Go to Vercel Deployments tab
- Find previous stable deployment
- Click "Promote to Production"
- Verify rollback completed
-
Investigate
- Review changes in failed deployment
- Check environment variables
- Test locally
- Create fix PR
-
Redeploy
- Merge fix PR to main
- Verify new deployment succeeds
- Target: < 2 minutes
- Monitor: Vercel dashboard
- Optimize:
- Minimize dependencies
- Use dynamic imports
- Enable SWC minification
- Target: < 100ms First Contentful Paint
- Monitor: Vercel Analytics
- Optimize:
- Image optimization
- Code splitting
- Lazy loading
- Edge caching
- Target: < 200KB (gzipped)
- Monitor: Build logs
- Optimize:
- Tree shaking
- Remove unused dependencies
- Dynamic imports
- Code splitting
- ✅ Use
NEXT_PUBLIC_*only for public data - ✅ Never commit
.envfiles - ✅ Use GitHub Secrets for sensitive data
- ✅ Rotate tokens regularly
- ✅ Automatic via Let's Encrypt
- ✅ Renewed automatically
- ✅ HTTPS enforced
- ✅ HSTS headers configured
- ✅ Require PR reviews
- ✅ Require status checks
- ✅ Require branches up to date
- ✅ Require code reviews
- Set up Vercel project
- Configure environment variables
- Set up custom domain
- Configure branch protection
- Monitor deployments
- Handle rollbacks
- Follow deployment workflow
- Test preview deployments
- Review deployment logs
- Report deployment issues
- Follow code review process
- Track deployment status
- Communicate deployment schedule
- Coordinate with team
- Document deployment process
# Test build locally
cd novaRewards/frontend
npm run build
# Start production build locally
npm run start
# Check environment variables
vercel env list
# View deployment logs
vercel logs
# Promote deployment to production
vercel promote <deployment-url>
# Rollback to previous deployment
vercel rollbackFor deployment issues:
- Check Vercel dashboard
- Review GitHub Actions logs
- Check VERCEL_SETUP.md
- Contact DevOps team
- ✅ Vercel project configuration
- ✅ Environment variables setup
- ✅ Custom domain configuration
- ✅ GitHub Actions workflows
- ✅ Branch protection rules
- ✅ Edge Network caching
- ✅ Documentation
Last Updated: March 28, 2026 Maintained By: DevOps Team