A fully automated YouTube video generator that creates professional-quality videos from a single topic prompt.
📚 Documentation Map: A comprehensive directory of all project markdown files, guides, and strategic handbooks is plainly laid out in DOCUMENTATION.md.
- AI Script Generation - Uses OpenRouter (GPT-5.4-nano) to generate engaging, rapid-paced scripts
- Smart Media Sourcing - Automatically finds relevant images via DuckDuckGo with AI-powered visual planning
- Text-to-Speech Narration - Generates professional voiceover using OpenAI TTS
- Canvas Video Rendering - Renders videos with Ken Burns effects, gradient overlays, and text captions
- Pipeline UI - Step-by-step workflow with progress tracking and debug logging
- Topic → Enter your topic, style, and target duration
- Script → AI generates a structured script with segments
- Media → AI plans visuals and sources images automatically
- Narration → Generates audio clips for each segment
- Assembly → Renders the final video with effects
- Preview → Preview and download your video
- Node.js 18+
- OpenRouter API key (for script generation)
- OpenAI API key (for TTS narration)
npm install
npm run devEnd-to-end pipeline without real API keys: Playwright drives the UI with mocked OpenRouter/media, then server-render.mjs produces the final MP4 with narration and background music.
Terminal 1 — dev server:
npm run dev -- --port 5173 --host 0.0.0.0Terminal 2 — full pipeline:
npm run generate:video
# or with a custom topic:
npm run generate:video -- "Why quantum computing matters in 2026"Requirements: Node 18+, Playwright Chromium (npx playwright install chromium), ffmpeg on PATH. Optional: edge-tts for faster narration synthesis on the server.
Output:
| Path | Description |
|---|---|
test-recordings/full-<timestamp>/final-video-final.mp4 |
Run-specific final video with muxed audio |
test-recordings/FINAL-OUTPUT.mp4 |
Copy of the latest successful render |
Screenshots for each pipeline step are saved alongside the MP4 in the same full-<timestamp>/ folder.
Fixture-only render (no browser, no LLM):
npm run render:fixtureSeven-point checklist enforced by scripts/verify-real-pass.mjs:
npm run verify:real-passFixture / short CI run (30s minimum instead of 180s):
REAL_PASS_FIXTURE=1 MIN_DURATION_SEC=30 npm run verify:real-passKey env vars: MIN_DURATION_SEC, MIN_SIZE_BYTES, FORCE_CPU / AUTOTUBE_FORCE_CPU, SKIP_GATE_TEST, RENDER_LOG. Full checklist and example output: scripts/squad/R7-real-pass.md.
- Open the app in your browser
- Click the ⚙️ Settings button
- Enter your API keys:
- OpenRouter API Key - Get from https://openrouter.ai
- OpenAI API Key - Get from https://platform.openai.com
- React 19 + TypeScript
- Vite for bundling
- Tailwind CSS 4 for styling
- Canvas 2D for video rendering
src/
├── components/ # React UI components
│ ├── TopicStep.tsx
│ ├── ScriptStep.tsx
│ ├── MediaStep.tsx
│ ├── NarrationStep.tsx
│ ├── AssemblyStep.tsx
│ ├── PreviewStep.tsx
│ └── ...
├── services/ # Core business logic
│ ├── llm.ts # Script generation via OpenRouter
│ ├── llmVisualDirector.ts # AI visual planning
│ ├── media.ts # Image sourcing & scoring
│ ├── tts.ts # OpenAI TTS integration
│ ├── videoRenderer.ts # Canvas-based video rendering
│ └── visualPlanner.ts # Topic context resolution
├── utils/ # Utilities
├── store.ts # React state management
└── types.ts # TypeScript types
The Vite dev server (npm run dev) runs a local proxy at /api/search and /api/proxy-image that enables:
- DuckDuckGo image search (free, no API key)
- CORS-free image loading into the Canvas renderer (prevents blank video output)
In production (the static dist/index.html from npm run build) these proxy routes are unavailable. The app automatically falls back to Wikimedia Commons, Unsplash, and Picsum for media sourcing, and uses external CORS proxies (weserv.nl, allorigins.win) for canvas-safe image loading. For best results in production, provide a Pexels API key in Settings.
Production deploy is push to master → Railway GitHub autodeploy (no GitHub Actions).
- One-time: Railway dashboard → connect this repo → branch
master, root directory.(repo root). - Every release:
git push origin master— Railway runsnixpacks.toml(npm run build, native deps) and starts viarailway.toml(npx tsx server.mjs). - Health:
https://autotube-production.up.railway.app/api/health
Set service variables in Railway: OPENROUTER_API_KEY, VITE_OPENROUTER_KEY, TRUST_PROXY, ALLOWED_ORIGINS.
Optional emergency CLI (not the normal path): ./scripts/deploy.sh with RAILWAY_TOKEN set. Full checklist: docs/SHIP_PLAN_MASTER.md.
API keys are stored in your browser's localStorage. Only use the app on a device you trust and never share your browser profile with others.
MIT