Adapt

An AI-powered adaptive learning platform that generates personalized lesson content and adjusts in real time to how you learn.

What it does

  1. Onboarding — You describe a learning goal (e.g. "Understand the basics of machine learning") and set your age range and learning pace. The AI generates 3–7 structured learning objectives, each with a mastery rubric. You can revise them before starting.

  2. Adaptive lessons — For each objective, the AI generates lesson blocks one step at a time: explanations, flashcards, multiple-choice questions, process walkthroughs, and interactive games. If you answer incorrectly, the system re-explains and retests. It never repeats content you have already seen.

  3. Learner model — A persistent profile tracks your skills, struggle areas, and narrative. It updates after each objective and informs every new block generated.

  4. Progress map — An adventure map visualises your journey. Diamond nodes represent objectives, star nodes mark major skill unlocks, and dot nodes flag areas of struggle.

  5. Chat — A context-aware chat panel lets you ask questions at any point during a lesson.

Tech stack

Layer Technology
Framework Next.js (App Router), React 19, TypeScript
Styling Tailwind CSS 4
Database PostgreSQL via Supabase, Prisma ORM
AI — curriculum & blocks OpenAI GPT-4o (function calling)
AI — interactive games Anthropic Claude Sonnet
Validation Zod

Project structure

app/
  page.tsx                    # Dashboard — learning plans
  onboarding/setup/           # Onboarding wizard
  learn/[sessionId]/          # Main learning view
  api/
    onboarding/               # Generate / revise / finalize objectives
    blocks/next               # Generate the next lesson block(s)
    blocks/interaction        # Log a learner interaction
    objectives/[id]/complete  # Mark an objective as mastered
    learner-model/update      # Update the learner profile
    chat/                     # Streaming chat (SSE)
    sessions/                 # List and delete sessions
    map/[sessionId]/          # Fetch adventure map nodes

components/
  blocks/       # Renderers for every block type
  chat/         # Chat panel and message components
  layout/       # Left sidebar (objectives + rubric progress)
  learning/     # LearningView and LearnPageClient (state)
  learning-map/ # Adventure map visualisation
  onboarding/   # Wizard steps

lib/
  ai/           # OpenAI and Anthropic clients, prompts, generators
  types/        # Shared TypeScript interfaces
  db/           # Prisma client singleton
  hooks/        # useChatStream

prisma/
  schema.prisma # Database schema

Database schema

Model Purpose
User Base user record
LearnerModel Personalised profile: skills, struggle areas, narrative
LearningObjective Individual milestones with rubric criteria and status
LearningSession Links a user, their objectives, and in-progress state
LessonBlock AI-generated content blocks
BlockInteraction Records every learner interaction with a block
MapNode Visual nodes on the adventure map (DIAMOND / STAR / DOT)
MapEdge Connections between nodes
ChatMessage Per-session chat history

Getting started

Prerequisites

  • Node.js 18+
  • A PostgreSQL database (Supabase free tier works)
  • An OpenAI API key (GPT-4o access)
  • An Anthropic API key (for game block generation)

Environment variables

Create a .env.local file in the project root:

DATABASE_URL=postgresql://user:password@host:5432/db?pgbouncer=true
DIRECT_URL=postgresql://user:password@host:5432/db
OPENAI_API_KEY=sk-proj-...
ANTHROPIC_API_KEY=sk-ant-api03-...

Install and run

npm install

# Apply database migrations
npx prisma migrate deploy

# Start the development server
npm run dev

Open http://localhost:3000 and create your first learning plan.

Other commands

npm run build   # Production build
npm start       # Start production server
npm run lint    # Lint
npx prisma studio  # Browse the database

Block types

The lesson engine generates content using these block types:

Type Description
paragraph Explanatory text
heading Section title
statement Highlighted callout (tip, warning, example, etc.)
accordion Expandable topic list
process Step-by-step walkthrough
flashcard Term / definition card deck
multiple_choice Scored question with feedback
storytelling Narrative character introduction
game AI-generated interactive game (sandboxed iframe)
continue Objective completion marker

How the adaptive loop works

  1. When you complete a block, the client sends your response and score to /api/blocks/next.
  2. The route reconstructs the full interaction history for the current objective, computes rubric metrics, and calls GPT-4o.
  3. GPT-4o decides what to generate next based on the prompt rules (teach → assess → remediate on failure, advance on success).
  4. A speculative prefetch runs in the background on the happy path so the next block appears instantly.
  5. After an objective is mastered, the learner model updates and the adventure map may gain new nodes.

Built With

  • css
  • fastapi
  • next.js-(app-router)
  • react
  • react-19
  • tailwind
Share this project:

Updates