Learn‑KuchBhi
Inspiration
We learn best when concepts are explained visually and reinforced through practice. We wanted a way to turn any topic into bite‑sized study assets like animated explanations, organized flashcards, and a quick multiplayer quiz, so that students can go from curiosity to understanding in minutes.
What it does
- AI‑powered Manim videos: Type a prompt, get a clean, educational animation. The system upgrades prompts, generates Manim code, lint‑fixes it, and renders an MP4 you can stream instantly.
- Smart flashcards with outlines: It first designs a topic/subtopic outline, then generates high‑quality flashcard sets for each subtopic. Progress streams live via Server‑Sent Events (SSE).
- Real‑time quiz (two‑player or solo): Play a fast multiple‑choice quiz on an AI‑generated topic set or math mode. WebSockets power low‑latency gameplay and score updates.
- Accounts and persistence: Authenticated users can trigger generations; all runs, videos, and flashcards are stored and queryable.
- Hosted demo: Live at https://kuch-bhi.built.systems
How we built it
- Backend: FastAPI app with modular services for video generation, flashcards, and quiz. Uvicorn runs the ASGI server.
- Video pipeline: Prompt upgrader (Gemini) → Manim code generator (Gemini/OpenRouter via pydantic‑ai) → Ruff lint/auto‑fix → preflight → render with Manim/MoviePy → store and serve under
/videos. - Flashcards: Outline agent + per‑subtopic flashcard agents (pydantic‑ai). Stores runs and sets in PostgreSQL, streams run status and new sets via SSE.
- Quiz: In‑memory manager with REST + WebSocket endpoints; supports topic‑AI or math modes, two players max, auto‑start when all players are ready.
- Data & auth: SQLAlchemy models + Alembic migrations on PostgreSQL; FastAPI‑Users for auth with JWT (jwcrypto/pyjwt). Redis for sessions/caching.
- Ops:
uvfor Python envs, Docker Compose for local Postgres/Redis, Nginx for TLS, SSE and WS proxying. Optional Context7 integration to fetch docs for the codegen agent.
Challenges we ran into
- Making LLM‑generated Manim code reliably lint‑clean and runnable; added iterative lint/runtime fix loops and fallbacks.
- Containing dependencies per‑session for rendering while keeping runs fast and deterministic.
- Designing an outline‑first flashcard flow that scales across many subtopics with live progress via SSE.
- Building a simple but robust WebSocket quiz loop with fair scoring, timeouts, and auto‑start while handling disconnects.
- Schema evolution and status tracking for long‑running jobs across DB tables.
Accomplishments that we're proud of
- A full end‑to‑end video pipeline that self‑corrects (lint/runtime) and produces clean animations from plain prompts.
- Multi‑agent flashcard generation with persistent runs, per‑subtopic sets, and real‑time progress streaming.
- A snappy two‑player quiz with both AI‑topic and math modes over WebSockets.
- Production‑ready touches: JWT auth, DB migrations, static video serving, Nginx WS/SSE proxying, and environment‑based provider selection.
What we learned
- How to steer LLMs for deterministic, lint‑clean code generation with feedback loops.
- Practical patterns for SSE and WebSockets on FastAPI behind Nginx.
- Schema design for content generation pipelines and incremental result surfacing.
- The trade‑offs between provider models (Gemini vs OpenRouter) for different tasks.
What's next for Learn‑KuchBhi
- Rich frontend for creation, review, and study flows; shareable links and classrooms.
- Editable timelines for videos and flashcard curation; export to Anki/CSV.
- More quiz modes (buzz‑in, timed rounds), leaderboards, and persistence.
- Caching, deduplication, and reuse of assets; cost/latency optimizations.
- More providers and guardrails; better observability and retry logic.
Built With
- Python
- FastAPI, Uvicorn
- PostgreSQL, SQLAlchemy, Alembic, asyncpg
- Redis
- Manim, MoviePy
- Pydantic v2, Pydantic Settings, pydantic‑ai
- Google Gemini (google‑genai), OpenRouter (OpenAI‑compatible)
- JWT (pyjwt), jwcrypto
- httpx
- Server‑Sent Events (SSE), WebSockets
- Nginx (TLS, reverse proxy for SSE/WS)
- Docker, Docker Compose
- uv (Python package manager)
- Optional: Context7 API integration for docs
Built With
- docker
- fastapi
- postgresql
- pydantic
- python
- redis

Log in or sign up for Devpost to join the conversation.