π Vercel Deployment Guide
β Your Project is Ready for Vercel!
All files have been created and pushed to GitHub. You now have:
- β
Serverless API functions in
/api - β Frontend with relative API calls
- β Support for 5 AI models (including 10s videos!)
- β package.json with dependencies
π Quick Deploy (5 minutes)
Method 1: Vercel Dashboard (Easiest)
Go to Vercel
- Visit: https://vercel.com
- Sign in with GitHub
Import Project
- Click "Add New" β "Project"
- Select "Import Git Repository"
- Choose:
LakshmiSravya123/VideoAI
Configure Project
- Root Directory:
hailuo-cloneβ οΈ IMPORTANT! - Framework Preset: None
- Build Command: (leave empty)
- Output Directory: (leave empty)
- Root Directory:
Add Environment Variable
- Click "Environment Variables"
- Key:
REPLICATE_API_TOKEN - Value:
r8_YOUR_TOKEN_HERE(from https://replicate.com/account/api-tokens) - Apply to: Production, Preview, Development
Deploy
- Click "Deploy"
- Wait 1-2 minutes
- You'll get a URL like:
https://video-ai-xyz.vercel.app
Test
- Visit:
https://your-url.vercel.app/index_enhanced.html - Try generating a video!
- Visit:
Method 2: Vercel CLI (Advanced)
# Install Vercel CLI
npm install -g vercel
# Navigate to project
cd /Users/sravyalu/VideoAI/hailuo-clone
# Deploy
vercel
# Follow prompts:
# - Link to existing project or create new
# - Confirm settings
# - Add REPLICATE_API_TOKEN when prompted
# Deploy to production
vercel --prod
π¬ Available Models After Deployment
Your deployed app will have:
- Runway Gen-3 - 10 seconds β (longest!)
- Hailuo Video-01 - 6 seconds (best quality/price)
- CogVideoX-5B - 6 seconds (good balance)
- HunyuanVideo - 5+ seconds (SOTA)
- Luma Dream Machine - 5 seconds (cinematic)
π§ Post-Deployment Setup
1. Set Custom Domain (Optional)
- Vercel Dashboard β Your Project β Settings β Domains
- Add:
video.yourdomain.com - Update DNS as instructed
2. Make index_enhanced.html the Homepage
Option A: Rename file
cd /Users/sravyalu/VideoAI/hailuo-clone
mv index_enhanced.html index.html
git add -A && git commit -m "Make enhanced UI the homepage" && git push
Option B: Add vercel.json
{
"rewrites": [
{ "source": "/", "destination": "/index_enhanced.html" }
]
}
3. Enable Analytics (Optional)
- Vercel Dashboard β Your Project β Analytics
- Enable Web Analytics
- Track usage and performance
π API Endpoints
Your deployed app will have:
GET /api/health- Check API statusGET /api/models- List available modelsPOST /api/generate-video- Generate videos
Example API Call:
curl -X POST https://your-url.vercel.app/api/generate-video \
-H "Content-Type: application/json" \
-d '{
"prompt": "A golden retriever running through flowers at sunset",
"model": "runway"
}'
π° Cost Estimation
Vercel Costs:
- Hobby Plan: FREE
- 100GB bandwidth/month
- Unlimited requests
- Serverless functions included
Replicate Costs (per video):
- Runway Gen-3 (10s): ~$0.20
- Hailuo (6s): ~$0.08
- CogVideoX (6s): ~$0.05
- HunyuanVideo (5s): ~$0.10
- Luma (5s): ~$0.10
Example Monthly Cost:
- 100 videos with Hailuo: ~$8
- 100 videos with Runway: ~$20
- Vercel hosting: FREE
π Troubleshooting
Issue: 404 on /api/generate-video
Solution:
- Ensure Root Directory is set to
hailuo-clone - Check that
package.jsonexists in that directory - Redeploy
Issue: 500 "Missing REPLICATE_API_TOKEN"
Solution:
- Add environment variable in Vercel Dashboard
- Settings β Environment Variables
- Redeploy after adding
Issue: Functions timeout
Solution:
- Video generation can take 30-120 seconds
- Vercel Hobby: 10s timeout (may fail for long videos)
- Upgrade to Pro for 60s timeout
- Or use webhook/polling pattern
Issue: CORS errors
Solution:
- Should not happen (same-origin)
- If using custom domain, ensure it's properly configured
Issue: Slow first request
Solution:
- Cold start is normal (2-5 seconds)
- Subsequent requests are faster
- Consider keeping functions warm with cron job
π Security Best Practices
β Already Implemented:
- API token in environment variables (not in code)
- .gitignore excludes .env files
- Serverless functions are isolated
π― Recommended:
- Rate Limiting: Add rate limiting to prevent abuse
- Authentication: Add user auth for production
- Input Validation: Already implemented in API
- Monitoring: Enable Vercel Analytics
π Scaling
Current Setup:
- β Serverless (auto-scales)
- β No server management
- β Pay per use
For High Traffic:
- Add Caching: Cache model metadata
- Add Queue: Use queue for video generation
- Add Database: Store generation history
- Add CDN: Serve videos via CDN
π― Next Steps After Deployment
Test All Models
- Try each model (runway, hailuo, cogvideox, etc.)
- Test different prompts
- Verify video quality
Share Your App
- Share the Vercel URL
- Add to your portfolio
- Share on social media
Monitor Usage
- Check Vercel Analytics
- Monitor Replicate costs
- Track popular models
Iterate
- Add more features
- Improve UI
- Add user accounts
π Deployment Checklist
Before deploying:
- API functions created (
/api/*.js) - package.json with dependencies
- Frontend updated to use
/apiendpoints - .gitignore excludes sensitive files
- All changes pushed to GitHub
- Replicate API token ready
- Vercel account created
- Project imported to Vercel
- Environment variable added
- Deployment successful
- Test video generation works
π You're Ready!
Your project is fully prepared for Vercel deployment with:
- β 5 AI models (up to 10s videos)
- β Beautiful animated UI
- β Serverless architecture
- β Complete documentation
- β GitHub repository
Just deploy and start generating videos! πβ¨
π Support
If you encounter issues:
- Check this guide's troubleshooting section
- Review Vercel logs in Dashboard
- Check GitHub Issues
- Vercel Discord: https://vercel.com/discord
Your deployment URL will be:
https://video-ai-[random].vercel.app
(You can customize this in Vercel settings)