Full-stack AI video generation platform powered by OpenAI's Sora 2 model.
Sora Studio is a complete web application that enables users to create stunning AI-generated videos from text descriptions using OpenAI's Sora 2 API. The platform features a modern Next.js frontend, Node.js/Express backend, PostgreSQL database, and Redis caching.
- Video Generation: Create videos from text prompts using Sora 2 and Sora 2 Pro models
- Real-time Status Tracking: Monitor video generation progress in real-time
- Video Management: List, view, download, and delete generated videos
- Video Remixing: Iterate on existing videos with new prompts
- User Quotas: Track and limit usage per user
- Background Processing: Asynchronous status polling and video processing
- Caching: Redis-based caching for improved performance
- Type Safety: Full TypeScript implementation across frontend and backend
sora-studio/
├── sora-video-backend/ # Backend API (Node.js + Express + TypeScript)
│ ├── src/
│ │ ├── config/ # Database, Redis, OpenAI configuration
│ │ ├── controllers/ # Request handlers
│ │ ├── services/ # Business logic
│ │ ├── routes/ # API routes
│ │ ├── middleware/ # Express middleware
│ │ ├── types/ # TypeScript types
│ │ └── utils/ # Utility functions
│ ├── schema.sql # Database schema
│ └── package.json
│
├── sora-frontend/ # Frontend Web App (Next.js + React + TypeScript)
│ ├── src/
│ │ ├── app/ # Next.js App Router pages
│ │ ├── components/ # React components (to be built)
│ │ ├── lib/api/ # API client
│ │ └── types/ # TypeScript types
│ └── package.json
│
└── sora-implementation-guide/ # Comprehensive documentation
├── README.md
├── Sora-2-Video-Generation-Complete-Guide.md
├── Sora-2-Quick-Reference.md
├── Sora-2-Implementation-Roadmap.md
└── Sora-2-Troubleshooting-Guide.md
- Node.js 18+ (LTS recommended)
- PostgreSQL 14+
- OpenAI API key with Sora 2 access
- Redis 6+ (for caching and improved performance)
- Git for version control
git clone <repository-url>
cd sora-studiocd sora-video-backend
# Install dependencies
npm install
# Configure environment variables
cp .env.example .env
# Edit .env with your credentials:
# - OPENAI_API_KEY
# - DATABASE_URL
# - REDIS_URL (optional)
# Create database schema
psql $DATABASE_URL -f schema.sql
# Test connections
npm run test:connections
# Start development server
npm run devBackend will be available at http://localhost:3000
cd ../sora-frontend
# Install dependencies
npm install
# Configure environment variables
cp .env.local.example .env.local
# Update NEXT_PUBLIC_API_URL if needed
# Start development server
npm run devFrontend will be available at http://localhost:3001
# OpenAI Configuration
OPENAI_API_KEY=sk-proj-your-key-here
OPENAI_ORG_ID=org-your-org-id (optional)
OPENAI_PROJECT_ID=proj_your-project-id (optional)
# Database
DATABASE_URL=postgresql://user:password@host:5432/sora_studio
# Redis (optional but recommended)
REDIS_URL=redis://localhost:6379
# Application
NODE_ENV=development
PORT=3000
FRONTEND_URL=http://localhost:3001NEXT_PUBLIC_API_URL=http://localhost:3000/apiThe project uses PostgreSQL for data persistence. Run the schema file to create necessary tables:
psql $DATABASE_URL -f sora-video-backend/schema.sqlTables created:
videos- Video jobs and metadatavideo_events- Audit trail for video operationsuser_quotas- User usage tracking and limits
- Project setup and configuration
- Database schema and integration (PostgreSQL)
- Core API implementation (video CRUD operations)
- Dashboard with real-time video tracking
- Frontend polish with mock mode
- Advanced video features (download, remix)
- Authentication (Stack Auth integration)
- User management and quota system
- Redis caching and event logging
Day 10: Rate Limiting & Cost Control (~50% complete)
- User quota system implemented
- Cost tracking and estimation
- Rate limiting middleware
- Enhanced usage dashboard
Day 11: Error Handling & Monitoring (NEXT PRIORITY)
- Comprehensive error handling middleware
- Structured logging (Winston)
- Health check endpoints
- Monitoring and alerting
Day 12: Testing Suite
- Jest/Mocha setup
- Unit tests for services
- API integration tests
- Frontend component tests
- E2E tests (Playwright)
- >80% code coverage
Day 13: Performance Optimization (~40% complete)
- Redis caching layer
- Database query optimization
- Database indexes
- Connection pooling
- Frontend bundle optimization
Day 14: Deployment & Documentation
- Docker containerization
- CI/CD pipeline (GitHub Actions)
- Production deployment
- Monitoring dashboards
- User documentation
See sora-implementation-guide/Sora-2-Implementation-Roadmap.md for complete details.
POST /api/videos- Create new videoGET /api/videos/:id- Get video statusGET /api/videos- List user videosDELETE /api/videos/:id- Delete videoGET /api/videos/:id/download- Download completed videoPOST /api/videos/:id/remix- Remix existing video
GET /health- Health check endpointGET /- API information
- Runtime: Node.js 18+
- Framework: Express 4
- Language: TypeScript 5
- Database: PostgreSQL 14+ (via pg)
- Cache: Redis 6+ (via redis)
- API: OpenAI SDK
- Security: Helmet, CORS
- Framework: Next.js 15 (App Router)
- Language: TypeScript 5
- Styling: Tailwind CSS 3
- State Management: React Query (TanStack Query)
- HTTP Client: Axios
- Icons: Lucide React
cd sora-video-backend
# Run all tests
npm test
# Watch mode
npm run test:watch
# Coverage
npm run test:coverage
# Test connections
npm run test:connectionscd sora-frontend
# Run linter
npm run lint# Build and run with docker-compose
docker-compose up --build
# Run in background
docker-compose up -dcd sora-video-backend
npm run build
npm startcd sora-frontend
npm run build
npm startComprehensive documentation is available in the sora-implementation-guide/ directory:
- Complete Guide: Full technical architecture and implementation details
- Quick Reference: Copy-paste code snippets and examples
- Implementation Roadmap: 14-day sprint plan with daily tasks
- Troubleshooting Guide: Common issues and solutions
This is a personal/team project following a structured implementation roadmap. Refer to the roadmap for current development priorities.
Expected monthly costs for small-medium usage:
- OpenAI API: $50-200 (varies with video generation volume)
- Database (NeonDB): $0-25
- Redis (Upstash): $0-10
- Hosting: $10-50
Total: $60-285/month
- API keys stored in environment variables (never in code)
- Server-side API proxying (frontend never exposes OpenAI key)
- Input validation and sanitization
- Rate limiting to prevent abuse
- User quota enforcement
- CORS configuration for frontend access
ISC
Current Phase: Days 1-9 Complete ✅ (Core Platform Functional) Next Phase: Days 10-14 - Production Readiness Overall Progress: 64% (9/14 days complete)
- ✅ Full authentication system (Stack Auth)
- ✅ Video generation, status tracking, download, remix
- ✅ User quota management and cost tracking
- ✅ Redis caching and event logging
- ✅ Modern UI with Tailwind + Emerald theme
- ✅ Mock mode for development/demos
Last Updated: October 22, 2025 Version: 1.0.0-alpha