Fable Lab is a next-generation K12 educational platform that combines generative AI, interactive p5.js simulations, and interactive storytelling to make STEM concepts tangible and engaging.
Built with Next.js 16 and Google's Gemini models, it offers two distinct modes:
- Lesson Mode: A structured, story-driven learning experience powered by a multi-agent backend.
- Playground: A real-time, voice-enabled collaborative coding environment where students build experiments by talking to an AI.
- ๐ค AI-Generated Lessons: Enter a topic (e.g., "Photosynthesis for 5th graders"), and our multi-agent system generates a complete lesson with:
- A narrative story tailored to the age group.
- Consistent characters and visual style.
- A fully interactive, code-generated p5.js experiment.
- Embedded quiz questions.
- ๐๏ธ Voice-First Playground: Talk to the AI to build visualizations in real-time.
- "Make a bouncing ball." -> Code generates
- "Now make it react to gravity." -> Code updates
- Uses Gemini Multimodal Live API for sub-100ms latency.
- ๐จ Dynamic Visuals: Consistent art direction across generated stories using specialized prompting pipelines.
- ๐ ๏ธ Modern Tech Stack: Built for performance and developer experience.
- Framework: Next.js 16 (App Router)
- Language: TypeScript
- AI SDK: Vercel AI SDK + Google Generative AI
- Database: PostgreSQL (Neon) + Drizzle ORM
- Styling: Tailwind CSS + Shadcn UI
- State/API: tRPC + TanStack Query
- Auth: Better Auth
- Node.js 20+
- Bun (recommended) or npm/pnpm
- PostgreSQL database (Neon.tech recommended)
- Google Cloud Project with Vertex AI / Gemini API enabled
-
Clone the repository:
git clone https://github.com/emrsyah/fable-lab.git cd fable-lab -
Install dependencies:
bun install
-
Environment Setup: Create a
.env.localfile based on.env.example:cp .env.example .env.local
Fill in your API keys (Google AI, Database URL, etc.).
-
Database Migration: Push the schema to your database:
bun db:generate bun db:migrate
-
Run Development Server:
bun dev
Open http://localhost:3000 to see the app.
| Script | Purpose |
|---|---|
bun dev |
Start development server |
bun build |
Build for production |
bun db:studio |
Open Drizzle Studio to manage DB data |
bun db:push |
Push schema changes to DB (prototyping) |
bun lint |
Run Biome linter |
- Fable Lab ADK: The Python backend hosting the advanced AI agents that power this frontend.