Inspiration

Students waste hours manually creating flashcards while generic AI chatbots hallucinate answers that contradict their actual class notes. We wanted to fix both — instantly.

What it does

SnapStudy converts any handwritten note, PDF, or text file into type-aware flashcards, an adaptive quiz, and a RAG-powered chat assistant — all grounded strictly in the student's own uploaded notes. Zero hallucinations. Zero manual effort.

How we built it

  • Frontend: React 18 + Vite + Tailwind CSS, deployed as a PWA on Vercel
  • Backend: Node.js + Express with 5 dedicated AI endpoints
  • AI: Google Gemini API — gemini-3.5-flash for unified single-pass note ingestion (OCR + flashcard generation in 1 API call), gemini-3.5-flash-lite for real-time RAG chat and remediation
  • Database: Supabase Postgres (JSONB regions + cards) + Supabase Storage bucket for note images, with Firebase fallback
  • Hallucination control: Strict JSON schema enforcement (responseMimeType: application/json, temperature: 0.2) + note context injection in every prompt

Challenges we ran into

  • Reducing Gemini API calls — solved by merging region detection + card generation into a single unified prompt (2–3× fewer calls)
  • Preventing LLM hallucinations — solved by injecting OCR'd note text as a bounded context block and physically cropping note regions with Sharp.js for grounded remediation
  • Multi-key rate-limit management — built an automatic API key pool failover system across 6+ keys

Accomplishments that we're proud of

  • Zero hallucinations by architecture — the RAG chat literally cannot answer outside the student's notes
  • Single-pass ingestion reducing API overhead by 50–67% per upload
  • Full PWA — installable, offline-capable, works on any device including $50 Android phones
  • Supabase integration with Row Level Security ensuring complete data isolation per user

What we learned

  • Prompt engineering at temperature: 0.2 with responseMimeType: application/json is the most reliable way to eliminate LLM drift
  • Client-side HTML5 Canvas compression (80–90% size reduction) is critical before any multimodal API call
  • RAG grounding is only as strong as the quality of the retrieved context — OCR region structure matters enormously

What's next for SnapStudy

  • Spaced repetition scheduling based on quiz session history already stored in Supabase
  • Teacher portal to share note decks with entire classrooms
  • Multi-language handwriting support and LaTeX formula rendering
  • Analytics dashboard showing which concepts students struggle with most

Built With

Share this project:

Updates

Submission history