A production-grade full-stack AI SaaS platform that transforms text into stunning videos using advanced diffusion models with an async GPU worker architecture.
- Next.js 14 (App Router)
- TailwindCSS for styling
- Framer Motion for animations
- Zustand for state management
- ShadCN UI for components
- Lucide React for icons
- FastAPI (Python)
- Redis for job queue and caching
- Celery for async task processing
- SQLite/Redis for job storage
- ModelScope text-to-video synthesis (damo/text-to-video-synthesis)
- PyTorch for model inference
- FFmpeg for video processing
AstraVideo AI/
/frontend # Next.js frontend application
/backend # FastAPI REST API
/worker # Celery worker for video processing
/outputs # Generated video storage
- Modern SaaS UI with glassmorphism design
- Animated hero section and landing page
- Dashboard with prompt input and advanced controls
- Style selector (cinematic, anime, realistic, 3D render)
- Duration slider (5-30 seconds)
- FPS slider (8-24)
- Seed input for reproducibility
- Job status page with real-time polling
- Gallery page for generated videos
- Theme system (dark, light, neon, glassmorphism)
- Responsive design
- RESTful API with FastAPI
- Async job processing with Celery
- Redis for job queue and storage
- JWT authentication (basic implementation)
- Rate limiting per user
- Video generation with ModelScope
- FFmpeg video processing
- GPU-accelerated video generation
- Prompt enhancement with style templates
- Frame generation and MP4 conversion
- Error handling and fallback demo videos
- Progress tracking and status updates
- Node.js 18+ and npm or yarn
- Python 3.9+ with pip
- Redis Server
- FFmpeg (for video processing)
- CUDA-compatible GPU (optional, for ModelScope)
git clone <repository-url>
cd AstraVideo AIWindows:
# Using WSL or Docker
docker run -d -p 6379:6379 redis:latestmacOS:
brew install redis
brew services start redisLinux:
sudo apt-get install redis-server
sudo systemctl start redisWindows:
# Using Chocolatey
choco install ffmpeg
# Or download from https://ffmpeg.org/download.htmlmacOS:
brew install ffmpegLinux:
sudo apt-get install ffmpegcd backend
# Create virtual environment
python -m venv venv
# Activate virtual environment
# Windows
venv\Scripts\activate
# macOS/Linux
source venv/bin/activate
# Install dependencies
pip install -r requirements.txtcd worker
# Create virtual environment (if not using backend's)
python -m venv venv
# Activate virtual environment
# Windows
venv\Scripts\activate
# macOS/Linux
source venv/bin/activate
# Install dependencies
pip install -r requirements.txtcd frontend
# Install dependencies
npm install
# Or with yarn
yarn installredis-servercd backend
# Activate virtual environment
venv\Scripts\activate # Windows
# or
source venv/bin/activate # macOS/Linux
# Start FastAPI server
python main.pyThe API will be available at http://localhost:8000
Open a new terminal:
cd worker
# Activate virtual environment
venv\Scripts\activate # Windows
# or
source venv/bin/activate # macOS/Linux
# Start Celery worker
celery -A video_processor worker --loglevel=infoOpen a new terminal:
cd frontend
# Start development server
npm run dev
# Or with yarn
yarn devThe frontend will be available at http://localhost:3000
POST /api/generate
Content-Type: application/json
{
"prompt": "A beautiful sunset over mountains",
"style": "cinematic",
"duration": 10,
"fps": 16,
"seed": 42,
"user_id": "user123"
}GET /api/status/{job_id}GET /api/history/{user_id}?limit=50GET /api/health- Hero section with animated gradients
- Feature showcase
- Call-to-action buttons
- Prompt input with history
- Style selector
- Advanced controls (duration, FPS, seed)
- Current job status
- Recent jobs sidebar
- Video grid with thumbnails
- Search and filtering
- Status indicators
- Download and play actions
Backend (.env):
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_DB=0
CELERY_BROKER=redis://localhost:6379/1
CELERY_BACKEND=redis://localhost:6379/2
JWT_SECRET_KEY=your-secret-key
OUTPUTS_DIR=../outputsFrontend (.env.local):
NEXT_PUBLIC_API_URL=http://localhost:8000- User submits prompt via frontend dashboard
- Backend creates job and stores in Redis
- Celery queues task for processing
- Worker enhances prompt with style template
- ModelScope generates video frames
- FFmpeg converts frames to MP4
- Video saved to outputs directory
- Status updated to completed
- Frontend polls for status updates
# Check if Redis is running
redis-cli ping
# Should return: PONG# Check FFmpeg installation
ffmpeg -version
# Add to PATH if not found- The worker includes fallback demo video generation
- Check internet connection for model downloads
- Ensure sufficient disk space (~2GB for models)
- The system works with CPU but is slower
- Install PyTorch with CUDA support:
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu118- Change ports in configuration if 3000/8000/6379 are occupied
- Update frontend
next.config.jsfor API proxy
The worker automatically creates demo videos when ModelScope fails, allowing testing without GPU.
# Monitor Redis in real-time
redis-cli monitor
# Check job storage
redis-cli keys "job:*"
redis-cli get "job:job_id"# Check active workers
celery -A video_processor inspect active
# Monitor tasks
celery -A video_processor eventsCreate docker-compose.yml:
version: '3.8'
services:
redis:
image: redis:latest
ports:
- "6379:6379"
backend:
build: ./backend
ports:
- "8000:8000"
depends_on:
- redis
environment:
- REDIS_HOST=redis
worker:
build: ./worker
depends_on:
- redis
environment:
- REDIS_HOST=redis
frontend:
build: ./frontend
ports:
- "3000:3000"
depends_on:
- backend- Multiple Workers: Scale Celery workers horizontally
- Redis Cluster: Use Redis Cluster for high availability
- Load Balancer: Add nginx for API load balancing
- CDN: Use CDN for video file serving
- Database: Consider PostgreSQL for production
- Input Validation: Sanitize all user prompts
- Rate Limiting: Implement per-user rate limits
- File Upload: Secure video file serving
- Authentication: Strengthen JWT implementation
- CORS: Configure proper CORS policies
- Fork the repository
- Create feature branch
- Make changes
- Test thoroughly
- Submit pull request
MIT License - see LICENSE file for details
For issues and questions:
- Check troubleshooting section
- Review logs for error messages
- Create GitHub issue with details
Note: This is a demonstration project. For production use, implement additional security measures, error handling, and monitoring.