LearnEngine
Key Features
The Learning Suite
A complete ecosystem featuring LearnEngine (Architect), LearnSubject (Classroom), and Help With (Assistant).
Public Dictionary
Context-aware translations and conjugations accessible to anyone without an account.
Adaptive Quizzes
Questions adjust difficulty based on your performance in real-time.
AI Tutor Chat
Ask questions anytime with full lesson context and persistent history.
Quiet Confidence
A premium, minimal aesthetic with high contrast, generous typography, and smooth micro-interactions.
Secure by Design
Multi-layer security with auth, rate limiting, and data isolation.
Overview
This project grew from a simple curriculum generator into a full Suite of learning tools. Built on Next.js 16 + React 19 with a "Quiet Confidence" design theme, think high contrast, minimal UI, smooth GSAP animations, and generous typography. The core Engine still hooks up to multiple AI models through OpenRouter to generate and grade adaptive content.
The Suite introduced dedicated spaces: "LearnSubject" provides a distraction-free classroom for generated lessons and quizzes. "Help With" acts as an assistant for breaking down specific problems. I also built a public-access Dictionary tool with context-aware translations and conjugations, designed to be the entry point to the ecosystem, no login required.
The backend was where things got spicy. Supabase for the database and auth, which was honestly great until I spent 3 hours debugging why Row Level Security wasn't working. The AI stuff goes way beyond just calling an API; I had to build injection protection because apparently people WILL try to break your prompts. Learned that one the hard way.
Security nearly killed me. Had to implement rate limiting after I realized someone could theoretically spam the AI endpoints and rack up my API bill. Added input sanitization, fixed an open redirect bug that was embarrassing, and strengthened the password requirements. Basically paranoia-driven development.
How It Started
From notebook to reality
The Idea
High Level Approach
Viability Research
Build Phase 1
Backend & Complexity Testing
Deep Dive & Model Selection
Architecture
System Architecture
- Session handling
- Route protection
- Generate Plan
- Generate Content
- Grade Answer
- Rate limiting
- Input sanitization
- Conversation management
- Message history
- PostgreSQL
- Auth
- RLS Policies
- Mimo Flash
- GPT-120B
- GLM 4.5 Air
User Journey
User Learning Journey
Adaptive Algorithm
Adaptive Learning Algorithm
How It Works
Security
Security Architecture
Database Design
Database Schema
- id
- display_name
- created_at
- is_correct
- user_answer
- time_spent
- topic
- outline
- status
- title
- content
- difficulty
- question_text
- options
- correct_answer
- title
- lesson_id
- model_id
- role
- content
- model_id
Work Items
AI-Generated Curricula
aiType literally any topic and get a structured lesson plan in seconds. The AI breaks it down into 4-6 sections with time estimates. Getting different AI models to format their output consistently was... an adventure.
- •OpenRouter integration, had to debug each model separately because they all have quirks
- •Mimo Flash, GPT-120B, GLM 4.5 Air support (each returns slightly different JSON, fun times)
- •Prompt injection sanitization after someone tried some creative inputs
- •JSON parsing with fallbacks because AI outputs aren't always clean
Dynamic Content Generation
aiEach lesson gets detailed, AI-written content in Markdown with math equation support. Getting the difficulty slider to actually change the language complexity took way more prompt iterations than I want to admit.
- •400-600 words per section (had to tweak prompts to stop AI from writing novels)
- •Difficulty scale 1-10 that actually works (mostly)
- •Markdown rendering with syntax highlighting for code examples
- •KaTeX for math equations, surprisingly smooth to integrate
Adaptive Quiz Engine
featureQuestions get easier if you're struggling (<50% accuracy) or harder if you're crushing it (>80%). The algorithm tracks your last 10 answers. First version was way too aggressive with difficulty swings, had to tune it.
- •Multiple choice, true/false, and short answer question types
- •AI grading for open-ended responses (this took forever to get right)
- •Performance context tracking that actually influences new questions
- •Difficulty adjustment in -2 to +2 range, aggressive enough to feel adaptive, not so much it's jarring
AI Tutor Chat
aiBuilt-in AI tutor that knows what lesson you're on. Ask questions anytime and get contextual help. The first version lost chat history on page refresh, that was a fun bug to explain to testers.
- •Persistent chat history that actually persists (took a few attempts)
- •Model picker so you can choose your AI
- •Lesson context injection so the AI knows what you're learning
- •Message streaming for that ChatGPT-like typing feel
Progress Tracking System
featureTracks accuracy, time spent, and improvement over time. Everything persists across sessions. The database schema for this went through like 3 revisions before it made sense.
- •Per-question answer tracking (yes, I store every answer)
- •Time spent per section and per question
- •Accuracy calculations that update in real-time
- •Visual progress bars that actually feel motivating
Security Architecture
securityMulti-layer security because I'm paranoid. Rate limiting, input sanitization, RLS policies, the works. Found an open redirect vulnerability during my own testing which was embarrassing but better than finding it in prod.
- •Supabase Auth with proper session handling
- •Rate limiting at 10 AI calls/minute (my wallet said so)
- •Prompt injection pattern filtering, people will try to break things
- •Open redirect prevention after I found a vulnerability in my own code
- •RLS policies that actually work (after the semicolon incident)
Database Architecture
architecturePostgreSQL with 7 interconnected tables. Users, lessons, sections, questions, progress, chat history, the whole thing. Took a while to get the relationships right but now it's actually pretty clean.
- •Profiles, lesson_plans, lesson_sections tables (basic but solid)
- •Questions with difficulty levels and type metadata
- •User progress tracking per section and per question
- •Chat conversation and message storage with proper foreign keys
- •RLS policies on everything, nobody sees anyone else's data
The Learning Suite
architectureExpanded the platform from a single tool into a complete suite. LearnEngine acts as the curriculum architect, LearnSubject is the distraction-free classroom for generated content, and Help With provides instant breakdowns of specific problems.
- •LearnEngine: Course generation and knowledge graph mapping
- •LearnSubject: Distraction-free study space with lessons and adaptive quizzes
- •Help With: Instant AI assistant for breaking down single questions
- •Seamless navigation logic between the Suite tools
Public Dictionary Network
featureBuilt a public-access Dictionary tool with context-aware translations and conjugations designed to act as a frictionless entry point into the LearnEngine ecosystem. No login required.
- •Public-first design allowing immediate utility without account creation
- •Context-aware definitions and real-world usage examples
- •Full verbal conjugation tables generated by AI
- •Visual distinction using emerald accents to signify public resources
"Quiet Confidence" Design
featureA premium, minimal aesthetic focusing on high contrast, generous typography, and subtle micro-interactions. The goal was to make learning feel elegant rather than gamified.
- •Light and Luxury Dark mode color palettes
- •Typography system combining Inter, Playfair Display, and Lora
- •Sharp edges with no border radius for a strict structural feel
- •GSAP-powered slide-up entrances and hover-lifts
Key Highlights
- 01
Designed the "Quiet Confidence" theme with a premium dark/light mode and smooth micro-interactions
- 02
Built a complete Suite: LearnEngine (Architect), LearnSubject (Classroom), Help With (Assistant), and a public Dictionary
- 03
Integrated public-access Dictionary with context-aware translations as a frictionless entry point
- 04
Built full AI curriculum generation with support for Mimo Flash, GPT-120B, GLM 4.5 Air, DeepSeek R1T2
- 05
Adaptive difficulty that tracks your last 10 answers and adjusts on the fly
- 06
7-table PostgreSQL schema with proper RLS policies and rate limiting
Technologies