The StoryBoard AI Music Video Storyboarder is a production-ready application with project management, asset management, AI-powered storyboard generation, and MediaBunny Studio editing/export tooling.
- Core storyboard, asset, and AI generation flows are shipped.
- MediaBunny Studio is available at
/projects/:projectId/mediabunnyfor all users in this deployment. - MediaBunny currently supports per-source export workflows; single-file composed timeline export is in active roadmap execution (
docs/mediabunny/MEDIABUNNY_NEXT_ROADMAP.md). - Official MediaBunny docs live under
docs/mediabunny/; historical planning docs are archived underdocs/_legacy/mediabunny/.
Prerequisites: Node.js 22 LTS recommended (.nvmrc is set to 22)
- Install dependencies:
npm install - Copy
.env.example→.env.local, setGEMINI_API_KEYandAI_GATEWAY_API_KEY, and review overrides indocs/CONFIGURATION.md. - Prepare the database:
npm run migrateto apply SQL migrations, ornpm run seedto apply migrations and load a sample project.
- Start services in separate terminals:
npm run dev:server(Express API on port 4000)npm run dev(Vite frontend on port 3333, proxying/api→ 4000)
- Visit http://localhost:3333; projects and generated assets are stored under
data/.
- Frontend build (Vite):
npm run buildornpm run build:web - Server build (
dist-server/):npm run build:server - Build both:
npm run build:all - Frontend typecheck:
npm run typecheck - Server typecheck:
npm run typecheck:server
Run the compiled server with npm run start:server once dist-server is generated.
Note: dist-server/ is a generated build artifact and is ignored by version control. Do not commit files from this folder.
- Analyze bundles locally:
npm run analyze(generatesdist/stats.htmltreemap with gzip/brotli sizes; only included when ANALYZE is set in the script). - CI size guard:
npm run ci:build— production build used by CInpm run ci:check-bundle— checks gzip sizes and fails if limits are exceeded- Current limits (tweak in
scripts/check-bundle-sizes.mjs): entry ≤ 200 kB gzip; each non-vendor app chunk ≤ 300 kB gzip.
npm run check:db— verifies migrations and asset directory permissions.npm run maintain prune— removes orphaned asset references/files and prunes empty directories.npm run maintain export <projectId> [outputDir]— exports a project bundle (JSON + assets).npm run test:api— Vitest + Supertest smoke tests covering health/projects/scenes/chat/assets.
- Build the frontend:
npm run build - Run the server:
npm run start:server— serves API anddist/; assets underdist/assets/are long-cached (Cache-Control: public, max-age=31536000, immutable),index.htmlisno-cache, and non-API routes fall back toindex.html(SPA routing) - Environment: set
PORT,CORS_ORIGIN,GEMINI_API_KEY, andAI_GATEWAY_API_KEYfor Grok video via Vercel Gateway (seedocs/CONFIGURATION.md) - CDN/reverse proxy (optional): you can host
dist/on a CDN and proxy/apito the Node server; ensure SPA 404 fallback to/index.htmland respect the cache headers above.
This application follows a feature-first architecture with clear module boundaries. See docs/ARCHITECTURE.md for detailed documentation.
server/— Express app, migrations, stores, and maintenance scripts.src/— React UI, hooks, providers, and Gemini integrations (client-side).src/features/— Feature-first modules (app-shell, layout, library, scene, project, generation) with colocated components/hooks/state. Seesrc/features/README.md.src/components/— Shared UI components used across features.src/hooks/— Shared React hooks.src/services/— Core services and dependency injection.src/ui/— Reusable UI primitives and icon pack.src/utils/— Shared utility functions.src/config/— Application-wide configuration.src/types/— Shared TypeScript types.
data/— SQLite database (storyboard.db) and generated asset hierarchy.
Critical Rule: Features don't import from other features. This ensures:
- Clear separation of concerns
- Independent testability
- No circular dependencies (verified with madge)
See docs/ARCHITECTURE.md for import rules and best practices.
See docs/CONFIGURATION.md for configuration details, docs/mediabunny/README.md for MediaBunny Studio docs, and docs/mediabunny/MEDIABUNNY_NEXT_ROADMAP.md for next MediaBunny milestones. Historical phase logs are archived in docs/_legacy/.
Key Principles:
- Respect existing design system (no new colors/styles)
- Integrate within existing UI/UX (no new top-level navigation)
- Maintain module boundaries (features don't import features)
- Test for regressions (all existing features must work)
See .kiro/steering/current-mission.md for detailed integration roadmap and .kiro/specs/legacy/gemini-api-enhancement/tasks.md for complete task breakdown.
Database not found or migration errors
# Reset the database completely
npm run db:resetPort already in use
- Default ports: 3333 (frontend), 4000 (backend)
- Change backend port: set
PORTin.env.local - Vite will auto-increment if 3333 is taken
Environment validation errors
- Check your
.env.localagainst.env.example - Ensure
GEMINI_API_KEYis set correctly - Ensure
AI_GATEWAY_API_KEYis set when usingxai/grok-imagine-video - Server will show specific validation errors at startup
better-sqlite3 binding errors (Could not locate the bindings file)
- Use Node 22 LTS (
nvm usein this repo). - Rebuild the native addon:
npm rebuild better-sqlite3. - Verify binding health:
npm run check:sqlite. - If it still fails, remove and reinstall dependencies:
rm -rf node_modules package-lock.json && npm install(PowerShell:Remove-Item -Recurse -Force node_modules, package-lock.json). - Do not share one
node_modulesdirectory between PowerShell and WSL runs; native binaries are platform-specific.
better-sqlite3 ABI mismatch (NODE_MODULE_VERSION ... compiled against a different Node.js version)
- You switched Node majors after install (for example, installed on Node 22 and ran on Node 24).
- Run
npm run fix:sqliteto rebuild and verify bindings for the active Node runtime. - If needed, do a clean reinstall in your current shell/runtime.
npm audit high vulnerabilities
- Run
npm audit --jsonto see exact direct/transitive sources. - This repo is configured to pass with zero known vulnerabilities on a clean install.
- If audit regresses after forced upgrades/downgrades, do a clean reinstall and recheck.
TypeScript errors in IDE
# Restart TypeScript server or run:
npm run typecheckPre-commit hook failures
- Fix TypeScript errors in staged files
- Run
npm run typecheckto see all issues
Assets not loading
- Ensure
data/directory exists and is writable - Check
/api/healthendpoint for disk space status - Run
npm run maintain pruneto clean orphaned files
- Check existing documentation
- Review CONTRIBUTING.md for development setup
- Open an issue with reproduction steps