reallearn

The World Is
Your Textbook

reallearn is an AI-powered learning product that turns a single question into a structured, high-retention learning journey. Instead of giving one generic answer, reallearn teaches in stages, checks understanding, and connects learning to real-world events happening right now.

Modern learning, premium clarity, and future-ready understanding — in one seamless experience.

reallearn product preview

Gemma 4 Usage

reallearn is powered by Gemma 4 26B (gemma-4-26b-a4b-it) through the Gemini API. The architecture uses structured prompting and robust post-processing to maintain quality and consistency.

  • Structured output with strict 3-part JSON schema and quiz pairs
  • Native multilingual generation in 8 supported Indian languages
  • Adaptive difficulty for Class 6–8, Class 9–10, and College levels
  • Serper-powered real-world grounding for current-event relevance
  • 5-stage JSON repair and strict schema validation
  • Average generation time target: 15–25 seconds

What reallearn is

A guided-learning platform for students who need clarity on difficult topics, language comfort, active understanding checks, and better theory-to-reality transfer.

Core idea: Don't just answer — teach. Structure the answer into a journey, verify comprehension at each step, and anchor knowledge to the real world.

What problem it solves

Traditional one-shot AI answers are often shallow, mismatched to learner level, disconnected from current reality, and easy to forget. reallearn solves this with staged teaching and mandatory comprehension checkpoints.

How reallearn works end-to-end

  1. Learner enters a question.
  2. Learner selects language and level.
  3. Frontend requests /api/generate-lesson.
  4. Backend fetches recent context when available.
  5. Gemma generates strict JSON journey output.
  6. Backend validates/repairs output if needed.
  7. Frontend renders 3 parts + sources + quizzes.
  8. Quiz pass unlocks next part.
  9. Learner completes takeaways and follow-up loop.

Detailed feature breakdown

  • 3-part unlockable lesson journey (Foundation → Mechanism → Real World Now)
  • Quiz-gated progression (2 MCQs per part, 4 options each)
  • Multi-language support (English, Hindi, Gujarati, Tamil, Bengali, Marathi, Telugu, Kannada)
  • Adaptive depth by learner level
  • Real-world context integration using recent news
  • SSE streaming with heartbeat keep-alive ping events
  • Reliability layer for malformed model output
  • Follow-up learning loop for continued journeys
  • Session-persisted frontend state

How reallearn helps in the real-world

  • "I don't know where to start." → Part 1 creates an entry point.
  • "I read but don't understand." → Quiz gating enforces comprehension.
  • "It feels disconnected." → Part 3 links to live current events.
  • "Too basic or too complex." → Level-based depth calibration.
  • "English-only blocks me." → Native multilingual generation.

Tech stack

Frontend (Vercel): Next.js 15, React 19, TypeScript, Zustand, React Markdown, Tailwind CSS.

Backend (Render): Node.js, Express, SSE + JSON APIs, Gemma integration, Serper context enrichment, validation and repair layer.

Architecture and deployment

  • frontend/ → Next.js app on Vercel
  • backend/ → Express API on Render
  • Primary endpoint: POST /api/generate-lesson
  • Health endpoint: GET /health

API behavior and SSE streaming

  • event: ping → keep-alive heartbeat
  • event: lesson → final lesson payload
  • event: done → successful stream end
  • event: error → failure message

Project structure

reallearn/
├── frontend/         # Next.js app (UI, state, client flow)
├── backend/          # Express API, AI calls, validation, context fetch
└── README.md

Environment variables

  • NEXT_PUBLIC_BACKEND_URL=https://<your-render-backend>.onrender.com
  • NEXT_PUBLIC_STREAM_IDLE_TIMEOUT_MS=120000 (optional)
  • GEMMA_API_KEY=...
  • GEMMA_MODEL=gemma-4-26b-a4b-it
  • GEMMA_MAX_RETRIES=2, GEMMA_RETRY_DELAY_MS=700, GEMMA_MAX_RETRY_DELAY_MS=5000 (optional retry tuning)
  • GEMMA_TIMEOUT_CIRCUIT_FAILURE_THRESHOLD=5, GEMMA_TIMEOUT_CIRCUIT_COOLDOWN_MS=60000 (optional timeout circuit)
  • SERPER_API_KEY=...
  • MAX_CONCURRENT_LESSON_REQUESTS=3 (optional)
  • LESSON_FAILURE_ALERT_THRESHOLD=5 (optional)
  • SSE_HEARTBEAT_INTERVAL_MS=15000 (optional; capped at 55000)
  • FRONTEND_ORIGIN=https://<your-vercel-frontend>.vercel.app
  • PORT=10000 (optional on Render)

Local development

cd backend
npm install
npm start

cd frontend
npm install
npm run dev

Validation commands

cd frontend
npm run lint
npm run build

Roadmap ideas

  • Learning outcome analytics
  • Spaced repetition for takeaways
  • User accounts and long-term progress
  • Teacher/classroom mode
  • Voice input/output in multiple languages

License

This project is licensed under the MIT License.