Prompt2Frame is an AI-powered animation generator that transforms natural language descriptions into stunning, mathematical 2D animations. It leverages the power of Large Language Models (LLM) and the Manim engine to bring your ideas to life instantly.
- Text-to-Animation: Just describe what you want (e.g., "A red circle morphing into a blue square"), and watch it happen.
- Smart Prompt Expansion: Vague ideas are automatically expanded into detailed, technically accurate animation scripts.
- Code Generation: Uses Groq's high-speed LLMs (Llama 3) to generate error-free Manim Python code.
- Smart Caching:
- Instant Replay: Caches generated videos (7-day TTL) for sub-second responses to duplicate requests.
- Prompt Cache: Caches expanded prompts (24h TTL) to save API costs and time.
- Optimized Rendering: Parallel video processing and efficient ffmpeg concatenation.
- Rate Limiting: Sliding window protection (5 requests/min per IP) to prevent abuse.
- Input Sanitization: Extensive validation to block malicious code injection and dangerous patterns.
- Circuit Breaker: Automatic failover and recovery for external API dependencies.
- Secure CORS: Strictly configured cross-origin policies for production safety.
- Responsive Design: Fully adaptive interface that works beautifully on mobile, tablet, and desktop.
- Dark Mode: Sleek, glassmorphic dark theme designed for visual comfort.
- Interactive Player: Integrated video player with instant download and replay capabilities.
Prompt2Frame uses a robust monolithic architecture suitable for both local development and scalable cloud deployment.
prompt2frame/
├── backend/ # FastAPI Service
│ ├── src/ # Core Logic
│ │ ├── app.py # API Gateway & Middleware
│ │ ├── generator.py # AI Code Generation
│ │ ├── executor.py # Manim Rendering Engine
│ │ ├── cache.py # Caching System
│ │ └── rate_limiter.py # Security & Throttling
│ └── media/ # Generated Video Storage
│
├── frontend/ # React Application
│ ├── src/ # UI Components & Logic
│ └── public/ # Static Assets
│
└── requirements.txt # Dependencies
- Backend: Python 3.10+, FastAPI, Uvicorn, Manim Community v0.17+, Groq SDK
- Frontend: React 18, Vite, Tailwind CSS, Framer Motion, Lucide Icons, Shadcn UI
- Infrastructure: Docker support (coming soon), Multi-environment configuration (.env)
- Python 3.10+ (Required for Manim)
- Node.js 18+ & npm
- FFmpeg (Must be installed and in system PATH)
- Groq API Key (Get one for free at console.groq.com)
# 1. Clone the repository
git clone https://github.com/sourize/prompt2frame.git
cd prompt2frame/backend
# 2. Create virtual environment
python -m venv venv
# Windows:
venv\Scripts\activate
# Mac/Linux:
source venv/bin/activate
# 3. Install dependencies
pip install -r requirements.txt
# 4. Configure Environment
# Create a .env file in /backend and add:
GROQ_API_KEY=your_groq_api_key_here
PORT=5000
DEBUG=true
ALLOWED_ORIGINS=["http://localhost:5173","http://localhost:8080"]# 1. Go to frontend directory
cd ../frontend
# 2. Install dependencies
npm install
# 3. Configure Environment
# Create a .env file in /frontend and add:
VITE_BACKEND_URL=http://localhost:5000
# 4. Start Development Server
npm run dev# From /backend directory
python -m uvicorn src.app:app --reload --port 5000Visit http://localhost:5173 (or the port shown in your terminal) to start creating!
We include built-in health checks and validation tools.
- Health Check:
GET /health- Verifies API status and dependency availability. - Metrics:
GET /metrics- View cache hit rates, request counts, and system load.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Sourish
Made with ❤️ and 🤖 using Prompt2Frame