๐ฌ ็ซๅฎ็ญๅง - ๅบไบAI็ไธ็ซๅผ็ญๅง็ๆๅนณๅฐ ใไธๅฅ่ฏ็ๆๅฎๆด็ญๅง๏ผไปๅงๆฌๅฐๆ็ๅ จ่ชๅจๅใ Huobao Drama - An AI-Powered End-to-End Short Drama Generator "One Sentence to Complete Drama: Fully Automated from Script to Final Video"
# CLAUDE.md
## Project Overview
Huobao Drama โ AI-powered drama/video production tool. Full TypeScript stack.
## Structure
```
backend/ โ Hono + Drizzle ORM + Mastra (AI agents) + mysql2
backend/workspace/ โ Agent ๅทฅไฝ็ฎๅฝ๏ผMastra Workspace jail ๆ น๏ผ
backend/workspace/skills/ โ Agent SKILL.md definitions
frontend/ โ Nuxt 3 + Vue 3 + TypeScript (pure CSS, no UI framework)
configs/ โ config.yaml
data/ โ generated static files
```
## Commands
### Backend (`backend/`)
- `npm run dev` โ Start dev server with tsx watch (port 5679)
- `npm start` โ Start production server
- `npm run typecheck` โ TypeScript type checking
### Frontend (`frontend/`)
- `npm run dev` โ Vite dev server (port 3013, proxies /api to 5679)
- `npm run build` โ Production build
## Architecture
### Backend
- **HTTP**: Hono framework with CORS, logger middleware
- **Database**: Drizzle ORM + mysql2, schema in `src/db/schema.ts`
- **AI Agents**: Mastra framework with AI SDK (OpenAI compatible providers)
- **Agent Types**: script_rewriter, extractor, storyboard_breaker, grid_prompt_generator
- **Agent Chat**: Hono JSON endpoints for agent responses
- **File Storage**: Local filesystem under `data/static/`
### Frontend
- **Vue 3** + TypeScript + Vite
- **Routing**: Vue Router (4 routes: list, detail, workbench, settings)
- **State**: Single composable `useWorkbench.ts` for workbench page
- **API**: Unified fetch client in `src/api/index.ts` with SSE async generator
- **Styling**: Pure CSS with CSS variables (dark theme)
## Database
MySQL is the only runtime database. The backend reads `DATABASE_URL` first, then falls back to `MYSQL_HOST`, `MYSQL_PORT`, `MYSQL_USER`, `MYSQL_PASSWORD`, and `MYSQL_DATABASE`.
Tables are created on startup from `src/db/mysql-schema.ts`.
## Key Config
- `configs/config.yaml` โ AI provider defaults
- AI service configs stored in DB (`ai_service_configs` table)
- Agent configs stored in DB (`agent_configs` table)