2.9 KiB
2.9 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
Anime Quiz Video Generator - A full-stack web application that generates "Guess the Anime Opening" videos for YouTube Shorts and TikTok. Combines a Python FastAPI backend for video processing with a Vue 3 frontend.
Commands
Docker (primary development method)
docker-compose up --build # Build and start all services
docker-compose up # Start existing containers
docker-compose down # Stop containers
Frontend (from /frontend directory)
npm run dev # Start Vite dev server (port 5173)
npm run build # Build for production
npm run preview # Preview production build
Backend (from /backend directory)
uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
Architecture
Backend (FastAPI + MoviePy)
backend/app/main.py- FastAPI application with REST endpointsbackend/app/video_generator.py- CoreVideoGeneratorclass handling all video compositionbackend/app/models.py- Pydantic models (VideoMode, Difficulty, QuizItem, GenerateRequest)backend/app/config.py- Settings via Pydantic BaseSettings withQUIZ_env prefix
Video generation runs in ThreadPoolExecutor (max_workers=1) to avoid blocking the async event loop.
Frontend (Vue 3 + Vite)
frontend/src/App.vue- Single component handling all UI, form state, and API calls- Uses Vue 3 Composition API (
ref,reactive,computed) - Vite proxies
/api,/videos,/downloadto backend athttp://backend:8000
Media Organization
media/
├── audio/ # MP3 anime openings
├── backgrounds/ # MP4 looping videos (5-10 sec recommended)
└── posters/ # Anime poster images (JPG/PNG/WebP)
output/videos/ # Generated MP4 files
Video Generation Flow
- Frontend POSTs to
/generatewith quiz configuration VideoGenerator.generate()creates scenes in sequence:- Question scene: background + countdown timer + difficulty badge + audio track
- Answer scene: anime title + poster image with fade-in
- For "full" mode, adds final CTA screen
- Concatenates all scenes → writes MP4 (H.264/AAC)
- Returns video URL for download
Video dimensions:
shorts: 1080x1920 (9:16) for TikTok/Shortsfull: 1920x1080 (16:9) for YouTube
API Endpoints
| Method | Endpoint | Purpose |
|---|---|---|
| GET | /health |
Health check with FFmpeg status |
| GET | /content |
List available audio, backgrounds, posters |
| POST | /generate |
Generate video (returns video URL) |
| GET | /download/{filename} |
Download generated video |
| DELETE | /videos/{filename} |
Delete video |
| GET | /videos-list |
List generated videos |
Environment Variables
QUIZ_MEDIA_PATH=/app/media
QUIZ_OUTPUT_PATH=/app/output/videos
VITE_API_URL=http://backend:8000