Full-stack AI Short Drama Automation Platform Based on Go + Vue3
Huobao Drama is an AI-powered short drama production platform that automates the entire workflow from script generation, character design, storyboarding to video composition.
火宝短剧商业版地址:火宝短剧商业版
火宝小说生成:火宝小说生成
- 🤖 AI-Driven: Parse scripts using large language models to extract characters, scenes, and storyboards
- 🎨 Intelligent Creation: AI-generated character portraits and scene backgrounds
- 📹 Video Generation: Automatic storyboard video generation using text-to-video and image-to-video models
- 🔄 Complete Workflow: End-to-end production workflow from idea to final video。
Based on DDD (Domain-Driven Design) with clear layering:
├── API Layer (Gin HTTP)
├── Application Service Layer (Business Logic)
├── Domain Layer (Domain Models)
└── Infrastructure Layer (Database, External Services)
Experience AI short drama generation:
- ✅ AI-generated character portraits
- ✅ Batch character generation
- ✅ Character image upload and management
- ✅ Automatic storyboard script generation
- ✅ Scene descriptions and shot design
- ✅ Storyboard image generation (text-to-image)
- ✅ Frame type selection (first frame/key frame/last frame/panel)
- ✅ Automatic image-to-video generation
- ✅ Video composition and editing
- ✅ Transition effects
- ✅ Unified asset library management
- ✅ Local storage support
- ✅ Asset import/export
- ✅ Task progress tracking
| Software | Version | Description |
|---|---|---|
| Go | 1.23+ | Backend runtime |
| Node.js | 18+ | Frontend build environment |
| npm | 9+ | Package manager |
| FFmpeg | 4.0+ | Video processing (Required) |
| SQLite | 3.x | Database (built-in) |
macOS:
brew install ffmpegUbuntu/Debian:
sudo apt update
sudo apt install ffmpegWindows: Download from FFmpeg Official Site and configure environment variables
Verify installation:
ffmpeg -versionCopy and edit the configuration file:
cp configs/config.example.yaml configs/config.yaml
vim configs/config.yamlConfiguration file format (configs/config.yaml):
app:
name: "Huobao Drama API"
version: "1.0.0"
debug: true # Set to true for development, false for production
server:
port: 5678
host: "0.0.0.0"
cors_origins:
- "http://localhost:3012"
read_timeout: 600
write_timeout: 600
database:
type: "sqlite"
path: "./data/drama_generator.db"
max_idle: 10
max_open: 100
storage:
type: "local"
local_path: "./data/storage"
base_url: "http://localhost:5678/static"
ai:
default_text_provider: "openai"
default_image_provider: "openai"
default_video_provider: "doubao"Key Configuration Items:
app.debug: Debug mode switch (recommended true for development)server.port: Service portserver.cors_origins: Allowed CORS origins for frontenddatabase.path: SQLite database file pathstorage.local_path: Local file storage pathstorage.base_url: Static resource access URLai.default_*_provider: AI service provider configuration (API keys configured in Web UI)
# Clone the project
git clone https://github.com/chatfire-AI/huobao-drama.git
cd huobao-drama
# Install Go dependencies
go mod download
# Install frontend dependencies
cd web
npm install
cd ..Frontend and backend separation with hot reload
# Terminal 1: Start backend service
go run main.go
# Terminal 2: Start frontend dev server
cd web
npm run dev- Frontend:
http://localhost:3012 - Backend API:
http://localhost:5678/api/v1 - Frontend automatically proxies API requests to backend
Backend serves both API and frontend static files
# 1. Build frontend
cd web
npm run build
cd ..
# 2. Start service
go run main.goAccess: http://localhost:5678
Database tables are automatically created on first startup (using GORM AutoMigrate), no manual migration needed.
⚠️ Note: Please save your data to local storage promptly when using cloud deployment
If you are in China, pulling Docker images and installing dependencies may be slow. You can speed up the build process by configuring mirror sources.
Step 1: Create environment variable file
cp .env.example .envStep 2: Edit .env file and uncomment the mirror sources you need
# Enable Docker Hub mirror (recommended)
DOCKER_REGISTRY=docker.1ms.run/
# Enable npm mirror
NPM_REGISTRY=https://registry.npmmirror.com/
# Enable Go proxy
GO_PROXY=https://goproxy.cn,direct
# Enable Alpine mirror
ALPINE_MIRROR=mirrors.aliyun.comStep 3: Build with docker compose (required)
docker compose buildImportant Note:
⚠️ You must usedocker compose buildto automatically load mirror source configurations from the.envfile- ❌ If using
docker buildcommand, you need to manually pass--build-argparameters- ✅ Always recommended to use
docker compose buildfor building
Performance Comparison:
| Operation | Without Mirrors | With Mirrors |
|---|---|---|
| Pull base images | 5-30 minutes | 1-5 minutes |
| Install npm deps | May fail | Fast success |
| Download Go deps | 5-10 minutes | 30s-1 minute |
Note: Users outside China should not configure mirror sources, use default settings.
# Start services
docker-compose up -d
# View logs
docker-compose logs -f
# Stop services
docker-compose downNote: Linux users need to add
--add-host=host.docker.internal:host-gatewayto access host services
# Run from Docker Hub
docker run -d \
--name huobao-drama \
-p 5678:5678 \
-v $(pwd)/data:/app/data \
--restart unless-stopped \
huobao/huobao-drama:latest
# View logs
docker logs -f huobao-dramaLocal Build (optional):
docker build -t huobao-drama:latest .
docker run -d --name huobao-drama -p 5678:5678 -v $(pwd)/data:/app/data huobao-drama:latestDocker Deployment Advantages:
- ✅ Ready to use with default configuration
- ✅ Environment consistency, avoiding dependency issues
- ✅ One-click start, no need to install Go, Node.js, FFmpeg
- ✅ Easy to migrate and scale
- ✅ Automatic health checks and restarts
- ✅ Automatic file permission handling
The container is configured to access host services using http://host.docker.internal:PORT.
Configuration Steps:
-
Start service on host (listen on all interfaces)
export OLLAMA_HOST=0.0.0.0:11434 && ollama serve
-
Frontend AI Service Configuration
- Base URL:
http://host.docker.internal:11434/v1 - Provider:
openai - Model:
qwen2.5:latest
- Base URL:
# 1. Build frontend
cd web
npm run build
cd ..
# 2. Compile backend
go build -o huobao-drama .Generated files:
huobao-drama- Backend executableweb/dist/- Frontend static files (embedded in backend)
Files to upload to server:
huobao-drama # Backend executable
configs/config.yaml # Configuration file
data/ # Data directory (optional, auto-created on first run)
# Upload files to server
scp huobao-drama user@server:/opt/huobao-drama/
scp configs/config.yaml user@server:/opt/huobao-drama/configs/
# SSH to server
ssh user@server
# Modify configuration file
cd /opt/huobao-drama
vim configs/config.yaml
# Set mode to production
# Configure domain and storage path
# Create data directory and set permissions (Important!)
# Note: Replace YOUR_USER with actual user running the service (e.g., www-data, ubuntu, deploy)
sudo mkdir -p /opt/huobao-drama/data/storage
sudo chown -R YOUR_USER:YOUR_USER /opt/huobao-drama/data
sudo chmod -R 755 /opt/huobao-drama/data
# Grant execute permission
chmod +x huobao-drama
# Start service
./huobao-dramaCreate service file /etc/systemd/system/huobao-drama.service:
[Unit]
Description=Huobao Drama Service
After=network.target
[Service]
Type=simple
User=YOUR_USER
WorkingDirectory=/opt/huobao-drama
ExecStart=/opt/huobao-drama/huobao-drama
Restart=on-failure
RestartSec=10
# Environment variables (optional)
# Environment="GIN_MODE=release"
[Install]
WantedBy=multi-user.targetStart service:
sudo systemctl daemon-reload
sudo systemctl enable huobao-drama
sudo systemctl start huobao-drama
sudo systemctl status huobao-dramaIf you encounter attempt to write a readonly database error:
# 1. Check current user running the service
sudo systemctl status huobao-drama | grep "Main PID"
ps aux | grep huobao-drama
# 2. Fix permissions (replace YOUR_USER with actual username)
sudo chown -R YOUR_USER:YOUR_USER /opt/huobao-drama/data
sudo chmod -R 755 /opt/huobao-drama/data
# 3. Verify permissions
ls -la /opt/huobao-drama/data
# Should show owner as the user running the service
# 4. Restart service
sudo systemctl restart huobao-dramaReason:
- SQLite requires write permission on both the database file and its directory
- Needs to create temporary files in the directory (e.g.,
-wal,-journal) - Key: Ensure systemd
Usermatches data directory owner
Common Usernames:
- Ubuntu/Debian:
www-data,ubuntu - CentOS/RHEL:
nginx,apache - Custom deployment:
deploy,app, current logged-in user
server {
listen 80;
server_name your-domain.com;
location / {
proxy_pass http://localhost:5678;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
# Direct access to static files
location /static/ {
alias /opt/huobao-drama/data/storage/;
}
}- Language: Go 1.23+
- Web Framework: Gin 1.9+
- ORM: GORM
- Database: SQLite
- Logging: Zap
- Video Processing: FFmpeg
- AI Services: OpenAI, Gemini, Doubao, etc.
- Framework: Vue 3.4+
- Language: TypeScript 5+
- Build Tool: Vite 5
- UI Components: Element Plus
- CSS Framework: TailwindCSS
- State Management: Pinia
- Router: Vue Router 4
- Package Management: Go Modules, npm
- Code Standards: ESLint, Prettier
- Version Control: Git
A: Use http://host.docker.internal:11434/v1 as Base URL. Note two things:
- Host Ollama needs to listen on
0.0.0.0:export OLLAMA_HOST=0.0.0.0:11434 && ollama serve - Linux users using
docker runneed to add:--add-host=host.docker.internal:host-gateway
A: Ensure FFmpeg is installed and in the PATH environment variable. Verify with ffmpeg -version.
A: Check if backend is running and port is correct. In development mode, frontend proxy config is in web/vite.config.ts.
A: GORM automatically creates tables on first startup, check logs to confirm migration success.
-
🎭 Global Style System: Introduced comprehensive style selection support across the entire project. Users can now define custom visual styles at the drama level, which automatically applies to all AI-generated content including characters, scenes, and storyboards, ensuring consistent artistic direction throughout the production.
-
✂️ Nine-Grid Sequence Image Cropping: Added cropping tool for action sequence images. Users can now extract individual frames from 3x3 grid layouts and designate them as first frames, last frames, or keyframes for video generation, providing greater flexibility in shot composition and continuity.
-
📐 Optimized Action Sequence Grid: Enhanced the visual quality and layout of nine-grid action sequence images with improved spacing, alignment, and frame transitions.
-
🔧 Manual Grid Assembly: Introduced manual grid composition tools supporting 2x2 (four-grid), 2x3 (six-grid), and 3x3 (nine-grid) layouts, allowing users to create custom action sequences from individual frames.
-
🗑️ Content Management: Added delete functionality for both generated images and videos, enabling better asset organization and storage management.
- Introduced local storage strategy for generated content caching, effectively mitigating external resource link expiration risks
- Implemented Base64 encoding for embedded reference image transmission
- Fixed issue where shot image prompt state was not reset when switching shots
- Fixed issue where video duration displayed as 0 when adding library videos
- Added scene migration to episodes
- Added migration script for processing historical data. For detailed instructions, please refer to MIGRATE_README.md
- Pure Go SQLite driver (
modernc.org/sqlite), supportsCGO_ENABLED=0cross-platform compilation - Optimized concurrency performance (WAL mode), resolved "database is locked" errors
- Docker cross-platform support for
host.docker.internalto access host services - Streamlined documentation and deployment guides
- Fixed video generation API response parsing issues
- Added OpenAI Sora video endpoint configuration
- Optimized error handling and logging
Issues and Pull Requests are welcome!
- Fork this project
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Configure in 2 minutes: API Aggregation Site
AI Huobao - AI Studio Startup
- 🏠 Location: Nanjing, China
- 🚀 Status: Startup in Progress
- 📧 Email: 18550175439@163.com
- 🐙 GitHub: https://github.com/chatfire-AI/huobao-drama
"Let AI help us do more creative things"
- Submit Issue
- Email project maintainers
