### Build frontend and start backend for server deployment Source: https://github.com/chatfire-ai/huobao-drama/blob/master/README.md Builds the frontend with `npm run generate`, copies the output from `frontend/.output/public` to `frontend/dist` (required for the backend to serve pages; skipping this causes 404s), then starts the backend with `npm start`. ```bash cd frontend && npm run generate cp -r .output/public dist && cd .. cd backend && npm start ``` -------------------------------- ### Build and start with Docker Compose Source: https://github.com/chatfire-ai/huobao-drama/blob/master/README.md Configures the environment by copying .env.example to .env and editing WATCHTOWER_TOKEN, then builds and starts the stack with docker compose, injecting HUOBAO_VERSION for the About & Updates comparison. Access the app at http://localhost:5679. ```bash cp .env.example .env # edit WATCHTOWER_TOKEN HUOBAO_VERSION=4.0.5 docker compose up -d --build # 3. Visit http://localhost:5679 ``` -------------------------------- ### Clone and install dependencies Source: https://github.com/chatfire-ai/huobao-drama/blob/master/README.md Clone the repository and install backend and frontend dependencies. Requires Node.js 20+ and npm 9+. ```bash git clone https://github.com/chatfire-AI/huobao-drama.git cd huobao-drama # Install backend dependencies cd backend && npm install # Install frontend dependencies cd ../frontend && npm install ``` -------------------------------- ### Install macOS app via curl and hdiutil Source: https://github.com/chatfire-ai/huobao-drama/blob/master/README.md Downloads the macOS DMG via curl (avoiding the quarantine attribute), mounts it, copies the app to /Applications, and unmounts. Use the -arm64.dmg for Apple Silicon and the plain dmg for Intel. This avoids the Gatekeeper 'damaged' prompt without needing a fix script. ```bash curl -L -o /tmp/HuobaoDrama.dmg https://installer.chatfire.site/huobao-drama/v4.0.5/HuobaoDrama-4.0.5-arm64.dmg \ && hdiutil attach -nobrowse /tmp/HuobaoDrama.dmg \ && cp -R /Volumes/HuobaoDrama*/HuobaoDrama.app /Applications/ \ && hdiutil detach /Volumes/HuobaoDrama* ``` -------------------------------- ### Run single-service mode Source: https://github.com/chatfire-ai/huobao-drama/blob/master/README.md Build the frontend and start the backend in single-service mode. The backend serves both API and static files on http://localhost:5679. ```bash # 1. Build the frontend cd frontend && npm run generate # 2. Copy the build output where the backend expects it # (generate outputs to .output/public; the backend reads frontend/dist) cp -r .output/public dist # 3. Start the backend cd ../backend && npm start ``` -------------------------------- ### Package desktop app with npm run dist and dist:win Source: https://github.com/chatfire-ai/huobao-drama/blob/master/README.md Packages the desktop app from source. `npm run dist` produces macOS DMGs for arm64 and Intel, and `npm run dist:win` produces a Windows NSIS installer (win-x64, cross-buildable on macOS). The generated artifacts are placed in desktop/release/. ```bash # One-command packaging (frontend generate → backend esbuild → electron-builder) npm run dist # macOS dmg (arm64 + Intel) npm run dist:win # Windows NSIS installer (win-x64, cross-buildable on macOS) # Artifacts # desktop/release/HuobaoDrama--arm64.dmg (Apple Silicon) # desktop/release/HuobaoDrama-.dmg (Intel) # desktop/release/HuobaoDrama Setup .exe (Windows) ``` -------------------------------- ### Publish in-app update release Source: https://github.com/chatfire-ai/huobao-drama/blob/master/README.md Publishes a new release for the built-in updater. Bump the version in desktop/package.json, package with npm run dist and dist:win, generate the release manifest with `npm run feed`, then upload the manifest, installers, and zips to a GitHub Release. The manifest URL can be overridden with the HUOBAO_UPDATE_FEED environment variable. ```bash # 1. Bump version in desktop/package.json, then package npm run dist # macOS (produces dmg + update zip) npm run dist:win # Windows (produces Setup.exe) # 2. Generate the release manifest release/latest.json (with per-platform sha256) cd desktop && npm run feed # 3. Publish: upload latest.json + installers + zips to a GitHub Release (tag like v1.0.1) ``` -------------------------------- ### Files to upload for server deployment Source: https://github.com/chatfire-ai/huobao-drama/blob/master/README.md Lists the directories to upload to the server for a manual deployment: backend source and node_modules, agent skill files, frontend build output, and the data directory (auto-created on first run). ```text backend/ # backend source + node_modules backend/workspace/skills/ # Agent skill files frontend/dist/ # frontend build output data/ # data directory (auto-created on first run) ``` -------------------------------- ### Run backend typecheck and frontend build Source: https://github.com/chatfire-ai/huobao-drama/blob/master/README.md Run these commands to verify the backend type checks and build the frontend. The first command checks the backend, and the second builds the frontend. ```bash cd backend && npm run typecheck ``` ```bash cd ../frontend && npm run build ``` -------------------------------- ### Run desktop app in development Source: https://github.com/chatfire-ai/huobao-drama/blob/master/README.md Runs the desktop app in development mode. First build the frontend static output, then bundle the backend and launch it in an Electron window. Note that Seedance video models require a PUBLIC_BASE_URL public address, which the desktop app lacks, so that scenario produces a clear error message. ```bash npm run build:frontend # frontend static output (frontend/.output/public) cd desktop && npm run dev # bundle the backend and run in an Electron window ``` -------------------------------- ### Run prebuilt Docker image Source: https://github.com/chatfire-ai/huobao-drama/blob/master/README.md Pulls the prebuilt multi-arch image (linux/amd64 and linux/arm64) and runs it with the named volume huobao-data mounted at /app/data, port 5679 exposed, and restart policy unless-stopped. ```bash docker pull huobao/huobao-drama:4.0.6 docker run -d \ --name huobao-drama \ -p 5679:5679 \ -v huobao-data:/app/data \ --restart unless-stopped \ huobao/huobao-drama:4.0.6 ``` -------------------------------- ### Run development mode Source: https://github.com/chatfire-ai/huobao-drama/blob/master/README.md Run backend and frontend in development mode with hot reload. Frontend runs on http://localhost:3013 and backend API on http://localhost:5679/api/v1. ```bash # Terminal 1: backend cd backend npm run dev # Terminal 2: frontend cd frontend npm run dev ``` -------------------------------- ### Run MySQL to SQLite migration manually Source: https://github.com/chatfire-ai/huobao-drama/blob/master/README.md Manually migrate data from a legacy MySQL deployment to SQLite. Requires --force if the target is non-empty; automatic backup is performed before writing. ```bash # Or run manually (non-empty target requires --force; automatic backup before writing) cd backend && npx tsx scripts/import-mysql-to-sqlite.ts ``` -------------------------------- ### Nginx reverse proxy configuration Source: https://github.com/chatfire-ai/huobao-drama/blob/master/README.md Nginx reverse proxy configuration for the backend on port 5679. Sets a 100m client_max_body_size for uploads, serves /static/ directly from disk with immutable caching, and proxies all other requests to the backend. ```nginx server { listen 80; server_name your-domain.com; # Max 50MB for reference video/audio uploads client_max_body_size 100m; # Generated images/videos served straight from disk, bypassing Node: # sendfile zero-copy + long-lived caching # (files are uuid-named and immutable, so immutable caching is safe) location /static/ { alias /path/to/huobao-drama/data/static/; sendfile on; tcp_nopush on; expires 1y; add_header Cache-Control "public, immutable"; } location / { proxy_pass http://localhost:5679; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.