Deploy to Vercel
Deploy your WhatsApp Team Inbox frontend to Vercel for optimal Next.js performance, automatic HTTPS, and global CDN.TL;DR - Quick Deploy
Import to Vercel
webSet Env Variables
NEXT_PUBLIC_API_BASE_URL (your backend URL) and NEXT_PUBLIC_WS_URLDeploy
Overview
Next.js Optimized
Global CDN
Auto HTTPS
Free Tier
Architecture
For a complete deployment, use Vercel for frontend + Railway for backend:Prerequisites
Quick Deploy
Option 1: Deploy Button
Option 2: Manual Deployment
Fork Repository
- Go to WhatsApp Team Inbox repository
- Click Fork to create your copy
Import to Vercel
- Log in to Vercel
- Click Add New… → Project
- Click Import next to your forked repository
Configure Project
webBuild Command: npm run build (default)Output Directory: .next (default)Install Command: npm install (default)Set Environment Variables
Environment Variables
Configure these in Vercel dashboard → Project → Settings → Environment Variables:Required Variables
https://api.your-domain.com or https://your-app.railway.appNote: Must use HTTPS in productionwss://api.your-domain.com or wss://your-app.railway.appNote: Must use WSS (secure WebSocket) in productionOptional Variables
production, staging, developmenttrue to enable built-in analyticsEnvironment-Specific Variables
Vercel supports different variables per environment:- Production
- Preview
- Development
Custom Domain
Add Your Domain
Access Domain Settings
Add Domain
app.your-domain.com(recommended for subdomain)your-domain.com(for root domain)
Configure DNS
Verify Domain
Update Backend CORS
Deployment Settings
Build & Development Settings
Configure in Project → Settings → General:Framework Preset
Framework Preset
Root Directory
Root Directory
web if your Next.js app is in a subdirectoryLeave blank if Next.js is at repository rootBuild Command
Build Command
npm run buildCustom: Can override for monorepos or special casesOutput Directory
Output Directory
.nextNote: Don’t change unless using custom Next.js configInstall Command
Install Command
npm installAlternative: Use pnpm install or yarn installGit Configuration
Set Production Branch
main or masterEnable Auto-Deploy
Configure Preview Deployments
Preview Deployments
Vercel automatically creates preview deployments for every push and pull request:How Preview Works
Create Pull Request
Automatic Deployment
Test Changes
Merge to Production
Share Preview with Team
Every preview deployment gets a unique URL you can share:- Go to your project dashboard
- Click on the preview deployment
- Click Visit to open preview
- Share URL with team for review
Performance Optimization
Next.js Configuration
Optimize your Next.js app for Vercel:Image Optimization
Use Next.js Image component for automatic optimization:Bundle Analysis
Analyze your bundle size:Install Analyzer
Update next.config.js
Run Analysis
Monitoring
Analytics
Vercel provides built-in analytics:Enable Analytics
View Metrics
- Page views
- Unique visitors
- Top pages
- Referrers
- Countries
Speed Insights
Monitor real user performance:Enable Speed Insights
Add to App
View Reports
Serverless Functions
Vercel supports Next.js API routes as serverless functions:Example API Route
https://your-app.vercel.app/api/health
Function Configuration
CI/CD Integration
GitHub Integration
Vercel integrates seamlessly with GitHub:Automatic Deploys
PR Previews
Status Checks
Rollbacks
Deployment Protection
Enable deployment protection for production:Access Protection Settings
Configure Rules
- ✅ Vercel Authentication - Require login to view previews
- ✅ Password Protection - Add password to previews
- ✅ Trusted IPs - Whitelist IP addresses
Troubleshooting
Build Failed
Build Failed
- TypeScript errors
- Missing environment variables
- Build timeout
- Check build logs in deployment details
- Fix TypeScript errors locally first
- Verify all NEXT_PUBLIC_ variables are set
- Contact support if timeout persists
Can't Connect to Backend
Can't Connect to Backend
- NEXT_PUBLIC_API_BASE_URL incorrect
- CORS not configured on backend
- Backend not deployed
- Verify NEXT_PUBLIC_API_BASE_URL uses HTTPS
- Check backend CORS_ORIGIN includes Vercel domain
- Test backend health endpoint directly
WebSocket Connection Failed
WebSocket Connection Failed
- Using WS instead of WSS
- Backend WebSocket not accessible
- Firewall blocking WebSocket
- Ensure NEXT_PUBLIC_WS_URL uses
wss://(notws://) - Test WebSocket endpoint with wscat
- Check backend WebSocket server is running
Environment Variables Not Working
Environment Variables Not Working
- Variable name doesn’t start with NEXT_PUBLIC_
- Not redeployed after adding variables
- Using wrong environment
- Client-side variables must start with
NEXT_PUBLIC_ - Redeploy after adding/changing variables
- Check you’re using correct environment (Production/Preview/Development)
Cost Optimization
Free Tier Limits
- 100 GB bandwidth/month
- 100 deployments/day
- Unlimited preview deployments
- 6,000 build minutes/month
- Analytics (100k data points)
Upgrade to Pro
Consider Pro plan ($20/month) when you need:- More bandwidth (1 TB)
- Priority support
- Team collaboration
- Advanced analytics
- Password protection
Production Checklist
Vercel + Railway Complete Setup
For a complete production setup:Deploy Backend to Railway
Get Railway URLs
Deploy Frontend to Vercel
Configure Custom Domains
- Frontend: app.your-domain.com (Vercel)
- Backend: api.your-domain.com (Railway)
Update CORS