Foundation
Inspiration
We noticed that most online learning is either rigidly pre-built (fixed courses that don't adapt) or unstructured (random YouTube videos with no progression). We wanted something in between: type what you want to learn, get a real curriculum with prerequisites, lessons, and quizzes generated on the fly and grounded in actual sources.
What it does
Foundation takes a plain-English learning prompt and generates a structured knowledge graph of 6–10 interconnected lessons. Each node is a lesson with:
- A written lesson synthesized from web-searched sources
- An SVG or Mermaid visual diagram
- A 3-question quiz with a 70% pass threshold
- Cited sources the learner can visit
Nodes unlock progressively : complete node 1 to unlock node 2, and so on via hard prerequisite edges. The graph visualizes your progress in real time. A built-in notebook lets you attach notes to specific nodes.
How we built it
- Next.js 15 (App Router) + React 19 + TypeScript for the full-stack framework
- Supabase for auth (anonymous sessions), database (graphs, nodes, edges, progress, notes), and vector search (pgvector embeddings for cache deduplication)
- Anthropic Claude (
claude-sonnet-4-5-20250929) for graph skeleton generation, lesson synthesis, and web-grounded sourcing via theweb_searchtool - OpenAI (
text-embedding-3-small) for query embeddings used in retrieval/cache - React Flow + Dagre for the interactive DAG layout
- Zod for strict contract validation across the entire pipeline
Challenges
- Generation latency. Each node requires two Anthropic API calls (sourcing + lesson). Running them sequentially was too slow, so we parallelized node 1 and node 2 enrichment with Promise.all.
- Webpack static replacement. process.env[dynamicKey] silently returns undefined on the client because Next.js/Webpack only inlines literal process.env.NEXT_PUBLIC_* references.
- Strict JSON from LLMs. Getting the model to return valid, schema-compliant JSON (exactly 3 quiz items, 3–5 sources, valid SVG with xmlns) required careful prompting and a validation-retry loop.
- Graceful degradation. If any enrichment step fails, the graph still persists with null lesson fields and a
flagged_for_reviewflag; the frontend shows "Lesson is still being prepared" instead of crashing.
What we learned
- Parallelizing independent API calls is the easiest performance win when working with LLM pipelines.
- Zod schemas as a shared contract layer between frontend and backend catch a surprising number of integration bugs before they reach the UI.
- Anonymous Supabase auth is great for hackathon demos
Built With
- anthropic
- css
- dagre
- next.js
- openai
- pgvector
- postgresql
- react
- reactflow
- supabase
- typescript
- zod
Log in or sign up for Devpost to join the conversation.