In December 2025, I began building PanunSchool — an educational platform that puts an AI tutor in the hands of every student. The core idea was simple: what if a student could upload their textbook, and an AI would read it, understand it, and then become their personal tutor — answering questions, generating quizzes, and explaining concepts in ways tailored to their learning level?

Powered by Google's Gemini 2.0 Flash, PanunSchool is my most technically ambitious project to date. In this article, I'll walk through the architecture decisions, the AI integration challenges, and the real-time communication infrastructure that makes it all work.

The Vision: AI Tutoring for Everyone

The education gap in regions like Kashmir is not just about access to schools — it's about access to quality, personalized instruction. A classroom with 40 students and one teacher cannot provide the individualized attention that every student needs. Private tutoring is expensive and often unavailable in remote areas.

PanunSchool aims to fill this gap with an AI tutor that:

System Architecture

PanunSchool's architecture consists of four major layers:

┌─────────────────────────────────────────┐
│           Frontend (React)              │
│  Document Viewer │ Chat UI │ Quiz UI    │
├─────────────────────────────────────────┤
│        Real-Time Layer (Socket.IO)      │
│  Chat Messages │ Typing Indicators │    │
│  Quiz Events   │ Document Sync         │
├─────────────────────────────────────────┤
│         Backend API (Node.js)           │
│  Auth │ Documents │ Quizzes │ Sessions  │
├─────────────────────────────────────────┤
│         AI Layer (Gemini 2.0 Flash)     │
│  RAG Pipeline │ Quiz Generation │       │
│  Context Management │ Prompt Engine     │
├─────────────────────────────────────────┤
│         Data Layer                      │
│  PostgreSQL │ Redis │ Object Storage    │
└─────────────────────────────────────────┘

The AI Engine: Gemini 2.0 Flash Integration

At the heart of PanunSchool is the AI tutoring engine, powered by Gemini 2.0 Flash. I chose Gemini for several reasons:

RAG Pipeline: Retrieval-Augmented Generation

The naive approach to AI tutoring would be to dump the entire document into the LLM context and ask questions. This doesn't scale — textbooks can be hundreds of pages. Instead, I implemented a RAG (Retrieval-Augmented Generation) pipeline:

  1. Document Ingestion — When a student uploads a PDF, the system extracts text using a PDF parser, splits it into semantically meaningful chunks (by section/paragraph), and generates embedding vectors for each chunk.
  2. Vector Storage — Embeddings are stored in a vector database, indexed by document and user.
  3. Query Processing — When a student asks a question, the system generates an embedding for the query, performs a similarity search against the document chunks, and retrieves the most relevant sections.
  4. Context Assembly — The relevant chunks are assembled into a context prompt, combined with the student's question and conversation history.
  5. Response Generation — Gemini generates a response grounded in the retrieved context, with citations pointing back to specific sections of the student's document.

This architecture ensures that the AI's answers are always grounded in the student's actual study material — not generic internet knowledge. When the AI references "Chapter 3, Section 2.1", the student can verify it directly in their document.

Prompt Engineering: The Teaching Persona

Getting an LLM to be a good tutor is more than just throwing questions at it. I designed a multi-layered prompt structure:

System Prompt:
"You are PanunSchool AI Tutor — a patient, encouraging 
educational assistant. Your role is to help students 
understand their course material deeply.

Rules:
1. Always ground your answers in the provided context
2. If the context doesn't contain the answer, say so
3. Use analogies and examples relevant to the student
4. Break complex concepts into smaller steps
5. Ask follow-up questions to check understanding
6. Encourage the student when they're on the right track
7. Never give direct answers to quiz questions — guide 
   the student to discover the answer themselves"

The last rule is particularly important. An AI tutor that just gives answers isn't teaching — it's doing the student's homework. PanunSchool's AI is designed to use the Socratic method, asking guiding questions that lead students to understand concepts on their own.

Automated Quiz Generation

One of PanunSchool's most powerful features is automated quiz generation. Given a document or chapter, the AI can generate:

The quiz generation uses a specialized prompt that instructs Gemini to create questions at different Bloom's Taxonomy levels — from basic recall (Level 1) to analysis and evaluation (Levels 4-5). This ensures assessments aren't just memory tests but genuinely measure understanding.

// Quiz generation request
const generateQuiz = async (documentChunks, options) => {
  const prompt = `
    Based on the following study material, generate 
    ${options.count} quiz questions.
    
    Distribution:
    - 30% Remember/Recall (Bloom's Level 1-2)
    - 40% Apply/Analyze (Bloom's Level 3-4)  
    - 30% Evaluate/Create (Bloom's Level 5-6)
    
    Format: Return as JSON array with fields:
    { question, type, options[], correctAnswer, 
      explanation, bloomLevel, sourceSection }
    
    Study Material:
    ${documentChunks.join('\n\n')}
  `;
  
  return await gemini.generateContent(prompt);
};

Real-Time Communication: Socket.IO

The tutoring experience needs to feel like a real conversation. Typing a question and waiting for a full response to load feels disconnected. I implemented streaming responses using Socket.IO:

Socket.IO also powers other real-time features: typing indicators, document sync between devices, and live quiz participation (for classroom mode, where a teacher can host a quiz for multiple students simultaneously).

Document Unlocking System

PanunSchool has a document unlocking mechanism that incentivizes engagement. When a student uploads a document, certain advanced chapters or sections are "locked." Students unlock them by completing quizzes on prerequisite chapters, ensuring they have the foundational knowledge before advancing.

This gamification element turned out to be surprisingly effective at keeping students engaged. The unlock notification — complete with a satisfying animation — creates a sense of progression and achievement that pure content access doesn't provide.

Performance and Cost Optimization

Running an AI-powered platform at scale requires careful optimization:

Lessons Learned

Building an AI-powered education platform taught me several things:

  1. Prompt engineering is product design. The system prompt isn't code — it's the personality and pedagogy of your product. Iterate on it like you would iterate on UI.
  2. RAG is essential for educational AI. Students need answers grounded in their specific materials, not generic knowledge. RAG makes this possible.
  3. Streaming responses transform the UX. The difference between waiting 5 seconds for a complete response and seeing it appear word-by-word is the difference between a tool and a companion.
  4. Gamification works. The document unlocking system increased average session time by 40% compared to a version without it.
  5. AI safety in education is paramount. The AI must never present wrong information confidently. When uncertain, it should say "I'm not sure about this — let's look at the text together."

What's Next for PanunSchool

The roadmap includes:

PanunSchool represents what I believe is the future of education: AI as a patient, knowledgeable, always-available tutor that meets every student exactly where they are. If you're building in EdTech or AI, let's connect on LinkedIn.