Inspiration
Complex ideas rarely fail because learners lack curiosity—they fail because static text flattens dynamic processes. Trying to grasp an AVL tree rotation, a Fourier transform, or a backpropagation step from a wall of paragraphs feels like trying to understand choreography from a photograph.
Inspired by the timeless clarity of classic blackboard lectures and channels like 3Blue1Brown, we asked: What if anyone could type a question and immediately watch a bespoke, hand-animated blackboard lesson crafted just for them? Static LLM text explanations are everywhere, yet true visual pedagogy remains locked behind hours of manual animation scripting and video editing. ChalkMind was born to close that gap—turning raw curiosity into deterministic, mathematically precise blackboard videos on demand.
What it does
ChalkMind is an AI-powered educational platform that transforms any natural-language topic prompt into a narrated, vector-animated blackboard video lesson.
- Prompt-to-Lesson Synthesis: Users enter any concept (e.g., "How do we balance an AVL tree in data structures? Explain each case with a good example"), and ChalkMind decomposes the explanation into a structured, multi-scene lesson plan complete with narration scripts and executable vector animation code.
- Synchronized Voiceover & Visuals: Every scene is voiced naturally and paced dynamically so animations hold on screen for the exact duration of the spoken explanation—no awkward cuts or rushed diagrams.
- Self-Healing Animation Engine: If generated animation code hits a runtime or geometry error during compilation, an autonomous feedback loop captures the stack trace, repairs the script with AI, and re-renders seamlessly.
- Cloud Library & Interactive Player: Completed lessons are stored in the cloud and accessible from the My Lessons dashboard, complete with a synchronized scene-by-scene transcript alongside the video player.
How we built it
We architected ChalkMind as a decoupled, cloud-native pipeline separating fast web interactions from heavy asynchronous media rendering:
┌─────────────────┐ 1. Prompt ┌──────────────────────────┐
│ React Router │ ─────────────────► │ Gemini 2.5 Flash API │
│ Frontend UI │ │ (Structured JSON Script) │
└────────┬────────┘ └────────────┬─────────────┘
│ │ 2. Insert Lesson & Scenes
│ 6. Poll Status ▼
│ (/api/status/:id) ┌──────────────────────────┐
├───────────────────────────► │ Supabase PostgreSQL │
│ │ (lessons & scenes RLS) │
│ └────────────┬─────────────┘
│ │ 3. Spawn Worker
│ ▼
│ ┌──────────────────────────┐
│ │ Python Render Worker │
│ │ • edge-tts + ffprobe │
│ │ • Manim CE (+ Self-Heal)│
│ │ • FFmpeg A/V Muxing │
│ └────────────┬─────────────┘
│ │ 4. Upload final.mp4
│ 7. Stream Video ▼
└───────────────────────────► ┌──────────────────────────┐
│ Supabase Storage Bucket │
└──────────────────────────┘
- Frontend & Full-Stack Routing: Built with React Router, TypeScript, and Tailwind CSS, featuring authenticated routes, real-time progress polling, a My Lessons dashboard, and a split-view watch interface.
- Structured Pedagogical Generation: Using Google Gemini (
gemini-2.5-flash), the server generates a strict JSON blueprint containing a lesson title and an ordered array of scenes—each pairing clear spoken narration with Python animation instructions. - Normalized Database & Auth: Backed by Supabase PostgreSQL with Row Level Security (RLS). Separating
lessonsfromsceneslets us track scene-level audio durations and granular rendering progress ($35\% \rightarrow 60\% \rightarrow 75\% \rightarrow 90\% \rightarrow 100\%$). - Asynchronous Rendering Worker: A detached Python worker (
render_blackboard.py) orchestrates the heavy media pipeline: - Synthesizes voiceovers per scene using
edge-ttsand measures exact clip durations ($T_i$) viaffprobe. - Compiles vector graphics onto a
#1e1e1eblackboard canvas using Manim Community Edition, dynamically injectingself.wait()timings so total scene duration matches narration length:
$$T_{\text{scene}} = \max\left(1.0,\; T_{\text{audio}} - 0.5\right) + 0.5$$
- Concatenates audio tracks and muxes them with the rendered video stream via FFmpeg before uploading the final
.mp4directly to Supabase Storage.
Challenges we ran into
- LLMs Hallucinating Fragile Animation Code: Generative models frequently produce subtle Manim bugs—such as 2D vs. 3D coordinate broadcasting errors, undefined mobject references across scenes, or invalid
FadeOutgroupings. A single syntax or runtime slip would crash the entire video build. - Audio-Visual Drift: Early prototypes rendered animations at fixed speeds, causing visuals to vanish mid-sentence or linger in awkward silence.
- Silent Background Worker Failures: Because the Python worker runs detached from the HTTP request lifecycle, early crashes or Supabase RLS permission mismatches (
publishablevs.secretservice keys) left the frontend loader hanging without surfacing tracebacks. - Cross-Process State Synchronization: Coordinating real-time progress updates between a detached Python process, Supabase Postgres, and React polling intervals required careful state transitions and cleanup.
Accomplishments that we're proud of
- Autonomous Self-Healing Render Loop: Instead of letting bad code fail a user's lesson, we built a closed-loop recovery system. When Manim exits with a non-zero status, our worker extracts the exact error log, feeds both the broken snippet and traceback back to Gemini with strict geometric constraints, and re-compiles automatically.
- Exact Narration-to-Frame Pacing: By measuring every synthesized
.mp3segment withffprobebefore assembling the Manim script, every visual transition locks cleanly onto the narrator's cadence. - Zero-Infrastructure Media Delivery: Transitioning from local file storage to a fully cloud-native architecture with normalized Supabase tables, RLS-protected user libraries, and direct storage bucket streaming.
What we learned
- Determinism Around Probabilistic Models: LLMs shine at creative structuring and pedagogical storytelling, but reliable production pipelines require rigid guardrails—schema validation, AST/indentation normalization, timeout fallbacks, and automated error recovery.
- Observability in Async Pipelines: Decoupled background workers demand explicit state machines (
generating$\rightarrow$completed/failed) and structured error logging so the UI always reflects ground truth. - Service Boundaries Matter: Separating authentication, relational metadata, and binary object storage into clean service layers made debugging and scaling the rendering pipeline dramatically simpler.
What's next for ChalkMind
- Interactive Quiz Checkpoints: Pausing playback between scenes to ask AI-generated comprehension questions before continuing the blackboard animation.
- Multi-Language & Custom Voice Profiles: Allowing students to generate lessons in their native language with selectable tutor voices and pacing controls.
- Live Scene Editor: Letting educators tweak individual scene scripts or re-render a single faulty slide without regenerating the entire video.
- LaTeX & Equation Rendering Mode: Adding full mathematical typesetting support for university-level calculus, linear algebra, and physics derivations.
Built With
- edge-tts
- ffmpeg
- ffprobe
- google-gemini-api
- manim
- node.js
- postgresql
- python
- react-router
- shadcn/ui
- supabase
- supabase-auth
- supabase-storage
- tailwind-css
- typescript