Add these in your Vercel dashboard under Settings > Environment Variables:
NEXT_PUBLIC_API_URL=https://your-app-name.vercel.app/api
Add these in Vercel dashboard:
REDIS_URL=redis://your-redis-url:6379/0
CELERY_BROKER_URL=redis://your-redis-url:6379/1
CELERY_RESULT_BACKEND=redis://your-redis-url:6379/2
JWT_SECRET=your-super-secret-jwt-key-change-this-in-production
OUTPUTS_DIR=/tmp/outputs
MODELSCOPE_CACHE_DIR=/tmp/cache
HUGGINGFACE_CACHE_DIR=/tmp/cache/.huggingface
RATE_LIMIT_REQUESTS=100
RATE_LIMIT_WINDOW=3600
ALLOWED_ORIGINS=https://your-app-name.vercel.app
- Upstash Redis: Free tier available
- Redis Cloud: Free tier available
- Redis Labs: Free tier available
Since Vercel doesn't support long-running processes like Celery workers, you'll need:
- Railway: For Celery worker
- Render: For Celery worker
- Heroku: For Celery worker
- DigitalOcean App Platform: For Celery worker
- Go to Vercel Dashboard
- Click "Add New Project"
- Import your GitHub repository:
okeylili/AstraVideo-AI - Select the Next.js framework
- Set Root Directory to
frontend - Set Build Command to
npm run build - Set Output Directory to
.next
- In Vercel project settings, add all environment variables above
- Make sure to use Vercel's built-in Redis or external Redis URL
- Create separate Vercel project for backend
- Set Root Directory to
backend - Set Build Command to empty (Python doesn't need build)
- Set Runtime to Python 3.9+
Deploy the Celery worker to a service that supports long-running processes:
Railway Example:
# Install Railway CLI
npm install -g @railway/cli
# Login and deploy
railway login
railway new
railway set PYTHON_VERSION=3.9
railway set REDIS_URL=your-redis-url
railway deployFor a complete deployment with all services, consider using Docker:
version: '3.8'
services:
frontend:
build: ./frontend
ports:
- "3000:3000"
environment:
- NEXT_PUBLIC_API_URL=http://backend:8000
depends_on:
- backend
backend:
build: ./backend
ports:
- "8000:8000"
environment:
- REDIS_URL=redis://redis:6379/0
- CELERY_BROKER_URL=redis://redis:6379/1
- CELERY_RESULT_BACKEND=redis://redis:6379/2
depends_on:
- redis
worker:
build: ./worker
environment:
- REDIS_URL=redis://redis:6379/0
- CELERY_BROKER_URL=redis://redis:6379/1
- CELERY_RESULT_BACKEND=redis://redis:6379/2
depends_on:
- redis
redis:
image: redis:alpine
ports:
- "6379:6379"- AWS ECS: Full container orchestration
- Google Cloud Run: Serverless containers
- Azure Container Instances: Simple container deployment
- DigitalOcean App Platform: Managed containers
- No long-running processes: Celery worker cannot run on Vercel
- Serverless timeout: Maximum 10-30 seconds for API calls
- File storage: No persistent file system for video outputs
- Cold starts: May cause delays for first API calls
- Video Storage: Use AWS S3, Cloudinary, or Vercel Blob
- Worker Service: Deploy to Railway/Render/Heroku
- Database: Use managed Redis service
- File Uploads: Use temporary storage with CDN
- Use HTTPS everywhere
- Implement proper JWT authentication
- Add rate limiting
- Validate all inputs
- Use CDN for static assets
- Implement caching strategies
- Monitor API response times
- Optimize video processing
- Horizontal scaling for backend
- Multiple worker instances
- Load balancing
- Auto-scaling based on demand
- Error tracking (Sentry)
- Performance monitoring
- Log aggregation
- Health checks
For local development, use the .env.example file:
cp .env.example .env
# Edit .env with your local settings
npm run devIf you encounter issues:
- Check Vercel deployment logs
- Verify environment variables
- Test Redis connection
- Monitor worker service logs
- Check CORS settings