A FastAPI-based backend and React frontend to convert natural language prompts into 3Blue1Brown-style animations using the Manim library. Built with OpenAI's GPT model via OpenRouter API.
Live Demo: https://renderconcepts.com
- Generate math visualizations from plain English.
- Automatic tool_call generation using LLM.
- Supports 20+ animation tools (text, LaTeX, graphs, shapes, transforms, etc.)
- Exposes Manim videos and generated code via static routes.
- React + Tailwind frontend for easy UX.
Frontend
- Next.js (App Router)
- TailwindCSS
- Clerk (for auth + usage limits)
- Deployed on Vercel
Backend
- FastAPI
- Manim Community Edition (subprocess-based rendering)
- Supabase (optional for storing usage)
- Deployed on AWS EC2 (Ubuntu 22.04)
- Prompt Input: A user provides a natural language prompt.
- Classification: Prompt is checked for complexity.
- LLM Interaction:
- If simple, a direct Manim Python script is generated.
- If complex, LLM generates a list of
tool_calls
in JSON.
- Code Generation: Each tool_call is converted into valid Manim Python code.
- Rendering: Code is saved and rendered using
manim
. - Result: A video (
.mp4
) and manim code file (.py
) are returned via API.
- Guests: 3 video credits.
- Logged-in users: 10 total credits.
- Data stored in Supabase.
backend/
├── app/
│ ├── main.py # FastAPI app, LLM calls, route handling
│ ├── executor.py # Validation, scene builder, Manim subprocess call
│ ├── dispatcher.py # tool -> code generator mapping
│ ├── code_generators.py # Python code templates per tool
│ ├── registry.py # Tool schema + validation
│ ├── schemas.py # Pydantic models for all tool args
│ ├── prompt.py # LLM system prompts
│ └── render/
│ ├── code/ # .py files generated
│ └── output/videos/ # .mp4 output files
frontend/
├── app/
│ ├── page.tsx # Main UI with prompt input
│ └── components/ # Input form logic
cd backend
python -m venv venv
source venv/bin/activate # or venv\Scripts\activate on Windows
pip install -r requirements.txt
Create a .env
file:
OPENAI_API_KEY=your-openrouter-api-key
Start the server:
uvicorn app.main:app
Make sure you have Manim CE installed and accessible in your PATH.
cd frontend
npm install
npm run dev
Includes but not limited to:
add_text
,add_latex
plot_graph
,set_axes
,label_axes
,add_axis_markings
add_shape
,move_object
,fade_in
,fade_out
wait
,transform_object
,rotate_object
,scale_object
group_objects
,draw_arrow
,set_color
create_number_line
,animate_text_change
,surround_with_shape
set_background_color
Full argument validation handled via Pydantic models in schemas.py
.
"Show 'Hello World' in red"
"Plot cosine graph with yellow axes and custom ticks"
"Create a rectangle and transform it into a circle after 2 seconds"
Idea inspired by Harkirat Singh's YouTube video.
- Prompt history with previews
- Advanced tool combinations (3D, camera zoom, etc)
- Shareable links
- Export code directly
You might have to use these commands, if you face error while running pip install -r requirements.txt
during installation of pangocairo
.
sudo apt install -y python3-dev pkg-config
sudo apt install -y build-essential libcairo2-dev
sudo apt install -y libpango1.0-dev libgirepository1.0-dev
MIT License. See LICENSE
file.