Inspiration
Preparing for university exams—especially in STEM courses—usually means juggling 40-page lecture PDFs, handwritten whiteboard photos, scattered flashcards, and passive re-reading that gives a false sense of mastery. You rarely know which concepts you actually understand until you hit a practice exam. We wanted to build StudyForge: a unified exam-prep workbench that turns raw study materials into structured concepts, adaptive quizzes, spaced-repetition schedules, and an interactive AI tutor in seconds.
What it does
- Multi-Format Material Ingestion: Upload
.pdf,.docx,.txt,.md,.csv, or photos of handwritten notes (.png,.jpg,.webp), or paste raw lecture text. - Structured Study Hub: Automatically generates an executive summary, prioritized key concepts (Core, Important, Supporting), exam tips, and clean mathematical typesetting—for example, breaking down substitution steps like $$\int 15x^4 \sqrt{3x^5 + 5}\,dx = \frac{2}{3}(3x^5 + 5)^{3/2} + C$$ with inline expressions such as \(u = 3x^5 + 5\).
- D3 Mastery & Progress Visualization: Tracks topic-by-topic completion across both your 7-day study plan and quiz accuracy in one interactive D3 chart, letting you click any concept to jump straight to it.
- Adaptive Practice Quizzes & Active-Recall Flashcards: Generates exam-style questions weighted toward your identified weak areas, with detailed explanations and performance breakdowns.
- 7-Day Spaced-Repetition Study Plan: Builds an actionable daily schedule with checkable tasks tailored to your weak topics.
- Contextual Multi-Mode AI Tutor + Google Search Grounding: A slide-over tutor aware of your notes and weak spots, supporting role presets (Tutor, STEM Proof Coach, Research Verifier, Rapid-Fire Drill), speed/depth modes, and live Google Search Grounding with cited web sources.
- Cloud Persistence: Sign in with Google to save study sessions, quiz history, task progress, preferences, and tutor conversations in Cloud Firestore.
How we built it
- Frontend: Built with React 19, TypeScript, Vite, and Tailwind CSS v4 (
@tailwindcss/vite). Interactive topic mastery charts are powered by D3.js, mathematical notation is rendered with KaTeX, and smooth UI transitions use Motion and Lucide React. - Backend & AI Pipeline: An Express server (
server.ts) exposes structured REST endpoints (/api/upload-pdf,/api/process,/api/generate-quiz,/api/study-plan,/api/chat,/api/search-verify) powered by the@google/genaiSDK (gemini-4-hydrogenwith Thinking Mode support andgemini-3.1-flash-litefallback). Document uploads use Multer and Mammoth (for.docx), with automatic routing to the Gemini Files API for large PDFs. - Auth & Database: Integrated Firebase Authentication (Google Sign-In) and Cloud Firestore with hardened security rules validated via
@firebase/eslint-plugin-security-rules.
Challenges we ran into
- Reliable Math & LaTeX Rendering: Models and pasted notes mix Unicode symbols (like
∫or√), ASCII exponents, and LaTeX delimiters. We built a custom normalization pipeline (mathFormat.ts+RichText.tsx) so integrals, radicals, and fractions render cleanly through KaTeX without leaking raw HTML or broken delimiters. - Large File Extraction & Proxy-Safe Error Handling: Handling multi-format uploads (PDFs, Word docs, images) inside containerized proxies meant ensuring API errors always returned structured JSON (never raw proxy HTML error pages) and switching smoothly between inline base64 payloads and the Gemini Files API above 8 MB.
- Firestore Security Rules vs. Query Indexes: Securing per-user subcollections (
users/{userId}/sessionsand nestedmessages) required pairing strict ownership rules (resource.data.userId == request.auth.uid) with single-field queries and client-side sorting to avoid missing composite-index failures at runtime. - Vite Middleware WebSockets in Preview Environments: Running Vite in Express middleware mode behind a reverse proxy caused
@vite/clientto fail on a non-proxied HMR WebSocket port, which we resolved cleanly at the Express/Vite middleware layer.
What we learned
- Combining structured JSON schemas (
responseSchema) with thinking levels makes AI-generated quizzes and study plans far more reliable than parsing free-form markdown. - Pairing data visualization (D3) directly with adaptive quiz weighting closes the feedback loop between studying and testing.
- Designing defense-in-depth Firestore rules alongside client sanitization prevents update-gap bugs and keeps user study data strictly isolated.
What's next for StudyForge
- Spaced-repetition interval notifications and calendar export for the 7-day study plan.
- Support for multi-document study sets (combining lecture slides, textbook chapters, and past exams into one Study Hub).
- Collaborative study decks so classmates can share flashcards and practice quizzes.
Built With
- google-genai
- katex
- react
- typescript
- vitetailwindcss