Adaptive learning platform for Year 4–6. Teachers run a short student survey and quiz, an AI rule engine infers five learning flags, and the teacher validates or overrides each one before generating a curriculum-aligned PDF worksheet adapted to that student's needs.
Requirements: Node.js 20+, npm
# 1. Install dependencies
npm install
# 2. Add your Gemini API key
cp .env.example .env
# Edit .env and set GEMINI_API_KEY=your_key_here
# 3. Start the dev server
npm run dev
# → http://localhost:5173Other useful commands:
npm run check # TypeScript + Svelte type-check
npm test # Run rule-engine unit tests (Vitest)
npm run build # Production build
npm run preview # Preview the production build locally| Layer | Technology |
|---|---|
| Framework | SvelteKit 2 + Svelte 4 |
| Styling | Tailwind CSS 3.4 + CSS custom properties |
| AI generation | Google Gemini 2.5 Flash (@google/generative-ai) |
| PDF rendering | pdfmake (server-side, Node.js) |
| State | Svelte writable store (in-memory, seed data) |
| Deployment | Vercel (@sveltejs/adapter-vercel) |
Data flow:
- Student completes survey (
/student/survey) + quiz (/student/quiz) - Rule engine (
src/lib/rules/engine.ts) evaluates responses → five learning flags - Teacher reviews flags at
/teacher/student/[id], validates or overrides - Teacher enters a topic and clicks Generate →
POST /api/generate-material - Gemini returns structured JSON → pdfmake renders an A4 PDF → returned as
application/pdf - Browser shows the PDF in an iframe; teacher downloads
Use this script for a self-led run-through.
Before you start: make sure the dev server is running (npm run dev) and you have a GEMINI_API_KEY in .env.
Open http://localhost:5173. Read the headline and three value cards. Click "Watch the demo →".
You land on the teacher login. Type anything in the email and password fields (demo mode accepts any credentials). Click Sign in.
You see the Year 5 Maple class — 5 students. Notice the Needs review badge on most cards. Click the "Needs review" filter chip to narrow the list.
Click on Amara D. (reading + language flags). You see her learning flags, each with AI-generated evidence. Try the following:
- Click Validate on Reading Accessibility to confirm the AI's assessment.
- Click Override on Language Scaffolding, enter a reason (e.g. "Amara is bilingual, advanced level"), and confirm. Watch the flag flip state.
In the right panel, the subject is pre-set to Maths. Type fractions in the Topic field. Click Generate →.
You land on the worksheet page. A loading spinner appears while Gemini generates the content and pdfmake renders the PDF (~15 s). The finished worksheet appears in the iframe, adapted to Amara's flags.
Click Download PDF to save it.
Go back to the dashboard (/teacher). A small amber Reset demo button (visible in dev mode only) appears top-right. Click it to restore all students to their original seed state.
| Variable | Required | Description |
|---|---|---|
GEMINI_API_KEY |
Yes | Google AI Studio key — used server-side only |
Set these in the Vercel dashboard under Project → Settings → Environment Variables before deploying.
# Install Vercel CLI (once)
npm i -g vercel
# Deploy
vercelWhen prompted:
- Framework: SvelteKit (auto-detected)
- Set
GEMINI_API_KEYin the Vercel dashboard or withvercel env add GEMINI_API_KEY
The project uses @sveltejs/adapter-auto, which auto-detects Vercel and deploys server-side routes (including the PDF generator) as Node.js serverless functions automatically.
- In-memory state only. Student data resets on every server restart / new tab. A real deployment would need a database (Supabase schema is partially wired —
@supabase/supabase-jsis installed but not yet connected). - Single class, hardcoded. Year 5 Maple and its 5 seed students are fixed. Multi-class support and a real auth system are not implemented.
- Student flow is one-shot. There is no persistent student account; survey and quiz state is held in
localStorageand cleared after submission. - PDF fonts are basic. The worksheet uses Helvetica (built-in PDF Type-1). A custom font (e.g. Lexend for dyslexia-friendly reading) would require bundling font files.
- English and Science subjects are coming soon. Only Maths worksheet generation is wired up.
- Gemini model availability. The project targets
gemini-2.5-flash. If this model is unavailable on your key, update the model string insrc/routes/api/generate-material/+server.ts.