An open-source, full-stack AI Video Generation platform built using a ReactJS frontend and a Python FastAPI backend powered by AnimateDiff and Stable Diffusion.
This monorepo architecture demonstrates how to bridge heavy asynchronous machine learning pipelines with responsive, real-time client web frameworks.
[ React Frontend ] --( POST /api/generate )--> [ FastAPI Backend ]
^ │ (Triggers Worker Thread)
│ ▼
[ Polling Loop 5s ] <--( GET /api/status/:id )-- [ Runs AnimateDiff Model ]
│ │ (Saves .mp4 to disk)
▼ ▼
[ Success State ] <========( Plays Video )======== [ Static Server Exposes Video ]
- Frontend Request: The user inputs a textual description. React posts the data to the backend.
- Instant Response: The FastAPI server hands back a unique
task_idand pushes the generation task to a background computational worker thread. - Polling Loop: The frontend continuously checks the server status using the
task_idevery 5 seconds. - Delivery: Once the frame rendering loop hits 100%, the backend hosts the final
.mp4file statically, and the frontend updates its state to display a custom playback frame.
- Frontend: ReactJS, Tailwind CSS, Lucide Icons, Fetch API (Polling Strategy)
- Backend: Python, FastAPI, PyTorch, Diffusers (
AnimateDiffPipeline), Uvicorn - Tunneling/Proxy: ngrok (For seamless free development connectivity)
- Python 3.10+ installed
- Node.js & npm installed
- A free ngrok Auth Token
cd backend
pip install -r requirements.txt
# Set your ngrok token as an environment variable
export NGROK_AUTH_TOKEN="your_token_here"
python main.pyTake note of the dynamic public proxy URL printed in your terminal.
- Paste the generated backend public URL into your React environment file configuration (
BASE_API_URL). - Run the client:
cd frontend
npm install
npm run devHeavy model files (.bin, .safetensors), localized static rendering outputs (.mp4), node modules, and environment authentication credentials are strictly scrubbed out using global context styling rules inside the root .gitignore file.