The Spark Behind CrammAI
Back in university, my classmates probably thought I never slept π . I was always neck-deep in coding projects π», tinkering with the latest AI tools π€, and still somehow crushing my exams π―.
But hereβs the truth: my bottleneck wasnβt understanding the concepts π§ . I could pick those up fast.
The real struggle was wading through endless PDFs π, lecture notes π, and convoluted study guides π just to find the critical info.
I kept thinking: β_If only I had an AI that could automate this process. Something that could ingest all my materials and tell me exactly what to focus on.β
Fast forward a few years later β I finally built it. π
Meet CrammAI β the study co-pilot I wish I had in uni π§βπ.
No more late-night panic β CrammAI takes your notes and transforms them into cram sheets, clever mnemonics, a 24/7 chat tutor, smart quizzes, and even a live voice tutor. How Awesome is that!!
Dude, Chaos in, clarity out β‘π.
Hereβs how I built this personal study automation engine.
π οΈ The Tech Stack: My Automation Pipeline
To bring this to life, I needed a stack that was fast, modern, and could seamlessly integrate powerful AI capabilities. The goal was to build an automated content analysis and generation pipeline.
Frontend: React with TypeScript for a dynamic and type-safe user interface.
AI Engine: The Google Gemini API (@google/genai) is the core of the automation. It handles document analysis, topic prioritization, and content generation.
Styling: Good old-fashioned CSS. Clean, simple, and effective.
Step 1: πΉοΈ The User Input: Setting the Automation Parameters
Every good automation workflow starts with clear inputs. For CrammAI, the user defines the parameters by choosing a "study mode" based on their timeline. This was crucial because how you study with a week to spare is completely different from how you study the night before.
π§ Cruise Control (1+ week): Comprehensive, deep-dive automation.
π Turbo Mode (~2 days): Strategic automation focusing on high-impact topics.
β‘ Zoom Mode (Due tonight): A tactical strike plan. The AI automates the process of finding only the absolute must-know concepts for a last-minute cram session.
This initial choice acts as the primary instruction for the AI automation pipeline that follows.
code
Tsx
// Simplified React component for mode selection
const HomePage = ({ onSelectMode }) => (
<div className="mode-selection">
{/* The "Zoom Mode" card for last-minute crammers like me! */}
<div className="mode-card zoom" onClick={() => onSelectMode('zoom')}>
<div className="mode-icon">β‘</div>
<h2 className="mode-title">Zoom Mode</h2>
<p className="mode-description">Due tonight. Maximum focus, maximum efficiency.</p>
</div>
{/* Other modes follow the same pattern... */}
</div>
);
Step 2: π€ Automating File Ingestion and Preparation
My AI co-pilot needed to read my study materials. The Gemini API can process various file types, but it requires them in a specific format (base64 encoded strings). To make this seamless, I wrote a helper function to automate the conversion.
This function takes a standard File object from the browser, reads it, and automatically converts it into the JSON structure the Gemini API expects.
Tsx
/**
* An automated utility to convert a browser File object
* into the Gemini API's expected Part format.
*/
import { Part } from "@google/genai";
const fileToGenerativePart = (file: File): Promise<Part> => {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => {
// The result is a Data URL, e.g., "data:image/png;base64,iVBORw..."
// We automate splitting and extracting the necessary base64 data.
const base64Data = (reader.result as string).split(',')[1];
resolve({
inlineData: {
mimeType: file.type,
data: base64Data
}
});
};
reader.onerror = error => reject(error);
});
};
Step 3: π§ The Core Automation: AI-Powered Analysis and Planning
This is where the real magic happens. The app sends the user's files and the selected study mode to the Gemini API. The key to successful automation here is enforcing a strict output format.
You canβt build a reliable automation pipeline if you're just hoping the AI gives you good data. The Gemini APIβs responseSchema feature is a lifesaver. It forces the AI to return clean, predictable JSON every single time.
This completely automates the data-parsing step and makes the app incredibly robust.
Tsx
// Inside the main plan generation function
import { GoogleGenAI, Type } from "@google/genai";
const ai = new GoogleGenAI({ apiKey: process.env.API_KEY });
// 1. Get user-defined parameters (mode) and prepare files
const prompt = getPromptForMode(mode);
const fileParts = await Promise.all(uploadedFiles.map(fileToGenerativePart));
// 2. Define the automation's output contract (the JSON schema)
const responseSchema = {
type: Type.OBJECT,
properties: {
study_these: {
type: Type.ARRAY,
description: "A list of the most critical topics to study.",
items: { /*... topic, reason, key_points ...*/ }
}
}
};
// 3. Trigger the AI automation pipeline
const response = await ai.models.generateContent({
model: 'gemini-2.5-flash',
contents: [prompt, ...fileParts],
config: {
responseMimeType: 'application/json',
responseSchema: responseSchema, // Enforce the contract!
},
});
// 4. The result is clean, structured data, ready for the UI. No messy parsing needed.
const result = JSON.parse(response.text);
setAnalysisResult(result); %}
Step 4: β‘ Automating Active Recall: Flashcards & AI Grading
A study plan is just the start π . To really learn, you need active recall π‘. CrammAI automates this by generating βFlashcard Sprintsβ for each topic π.
But the coolest automation? The grading β .
When a user submits an answer, I donβt just do a basic string comparison. Instead, I send both the userβs answer and the correct answer to the Gemini API π, asking it to grade for conceptual correctness. This makes the system feel way more intelligent β almost human π€.
And yes, this is fully automated with a response schema π to guarantee a simple true/false plus clear feedback π.
Tsx
// The prompt for the automated AI grader
const prompt = `You are an AI grader. Be lenient with phrasing but strict on the core concept.
**Question:** ${currentCard.question}
**Correct Answer:** ${currentCard.answer}
**User's Answer:** ${userAnswer}
Is the user's answer substantially correct?`;
// The schema for a simple, automated response
const evaluationSchema = {
type: Type.OBJECT,
properties: {
is_correct: { type: Type.BOOLEAN },
feedback: { type: Type.STRING }
}
};
// The API call uses this prompt and schema to automate the grading process.
const response = await ai.models.generateContent({ /* ... */ });
const result = JSON.parse(response.text); // e.g., { is_correct: true, feedback: "Spot on!" }
πβ¨ How CrammAI Uses RAG for Smarter, Context-Aware Learning
CrammAI doesnβt just generate study materials β it understands them.
To ensure every summary, mnemonic, and quiz is relevant to your syllabus, the AI uses a method called Retrieval-Augmented Generation (RAG).
This approach makes our AI precise, context-aware, and fully grounded in your uploaded course materials β not random internet data.
Hereβs how it works π
π Retrieval:
When you upload your syllabus, notes, or textbooks, CrammAI extracts key concepts and builds a personalized knowledge base from your content. This ensures the AI only learns from your course materials β nothing else.
βοΈ Augmentation:
Next, your request (for example, βCreate a high-priority study plan for my chemistry examβ) is merged with the retrieved information. This creates a rich, context-driven prompt that fully represents what youβre studying.
β¨ Generation:
Finally, this augmented prompt is sent to the Gemini API, which generates your study plan, summaries, and quizzes directly from your documents. Every output is accurate, personalized, and free from hallucination.
This RAG-powered workflow ensures CrammAI acts like a top-tier tutor β one who reads your notes before teaching you.
Simplified Implementation Example:
Tsx
// 1. Retrieve content from user files
const userDocuments = await processFiles(uploadedFiles);
// 2. Augment user's request with retrieved context
const userRequest = "Generate a high-priority study plan for my exam.";
const augmentedPrompt = `${userDocuments}\n\n${userRequest}`;
// 3. Generate context-grounded output using Gemini
const studyPlan = await gemini.generateContent(augmentedPrompt);
By combining retrieval, augmentation, and generation, CrammAI delivers precise, syllabus-aligned results that make every minute of studying count. π―
π§ CrammAI Features That Make Learning Stick
πβ¨ AI-Generated Cram Notes
Forget dull summaries β this is next-level note-taking. For every high-priority topic, CrammAI creates study notes engineered for rapid learning and retention. Each note is crafted with:
π Quick Summary: The big idea in just a few sentences.
π Key Breakdowns: Complex concepts split into bite-sized, structured chunks.
π‘ Real-World Examples: See how theories work in practice for easier understanding.
π§ Memory Hooks: Clever metaphors, visuals, or βRemember tipsβ to make facts stick.
Itβs like having a world-class tutor turn dense material into simple, usable cheat sheets.
π¨ The Mnemonic Studio β Learning Made Fun
Tricky topic? No problem. The Mnemonic Studio creates catchy, memorable acronyms using famous names β cities π½, brands π·οΈ, even celebrities π.
Instead of random letters, think TESLA β‘ for the principles of electromagnetism. Donβt like the first idea? Just say, βMake it based on a movie character!β
π¬ Youβll always get a version that sticks.
π¬ The Chat Studio β Your 24/7 AI Tutor
This is your always-available study buddy π€. Right under your notes, you can ask:
βWhat were the three main points from the Cellular Respiration lecture?β
βCan you explain this concept in simpler words?β
The AI only pulls from the materials you uploaded π β so answers are accurate, relevant, and tailored to your course.
β Instant Practice Quizzes (with Explanations!)
Skip boring flashcards β test yourself with smart, interactive quizzes π―. CrammAI automatically generates multiple-choice questions from your notes.
But hereβs the real game-changer: every time you answer, you get instant, clear explanations of why the correct answer is right π‘.
Itβs the fastest way to lock knowledge into long-term memory.
ποΈ The Live Tutor
Simply start talking, and the AI tutor listens. It responds in real-time with spoken answers. π£οΈ
Your tutor knows your exact study materials. This provides a focused and relevant learning session. π
Ask questions and test your knowledge. It's a truly interactive and engaging study experience. β¨
π€ Challenges & Lessons Learned
β‘ Automation Loves Specificity
Prompt engineering is everything. To get reliable output from the AI, I had to be super precise. My prompts are filled with rules, examples, and format instructions. The more specific the prompt, the better the AI agent performs. π―
π Schema is Non-Negotiable
For any serious app, responseSchema is your best friend. It turns the AI from a creative but unpredictable partner into a reliable, deterministic teammate π€.
π Conclusion & Next Steps
Building CrammAI was an absolute blast π€π‘. Itβs proof that with todayβs tools, you can create powerful automation pipelines for almost anything β even those frantic last-minute cram sessions before exams. ππ₯
So whatβs next for my AI study co-pilot?
π§ Expanding the Pipeline β Support for video transcripts π₯ and audio notes ποΈ.
β‘ More Personalization β Tailored study strategies for different learning styles.
At the end of the day, this project taught me one big lesson: if something feels tedious, automate it. π οΈβ¨

Ever wish AI could just tell you what to study before an exam? Thatβs why I built CrammAI. Check it out π Here!
Soβ¦ what could you automate in your own life? π
π¬ Interested in collaborating, building a team, or exploring opportunities? Reach me here!
Happy coding, and happy cramming! ππ»π








Top comments (5)
Thankyou @monahidalgo
This is good. Nice work.
Awesome
Good work
Thankyou @capestart !