LectureLens: AI Study Planner with Next.js + Supabase
LectureLens helps students turn raw course materials into a practical study program: concise summaries, flashcards, interactive Q&A, and a calendar-ready schedule. The app is open source and built with React, Next.js, and Supabase.
Problem
Students collect PDFs, slides, and notes—but translating them into a daily plan is time-consuming. Keeping momentum across readings, practice, and spaced repetition often falls through the cracks.
What LectureLens Does
- Summaries: Distills long-form material into digestible sections
- Flashcards: Generates Q&A cards to drill concepts
- Interactive Q&A: Ask follow-ups on any topic
- Study Plan: Builds a schedule with milestones and reviews
High-Level Architecture
The app uses Next.js (App Router) for routing and UI, with Supabase for authentication, storage, and a Postgres-backed data layer. Content processing is orchestrated server-side for reliability.
- Next.js: UI, routing, server actions
- Supabase: Auth, Postgres, and row-level security rules
- TypeScript: End-to-end types for safer feature work
AI Processing Pipeline
Although the public README focuses on core features, internally the pipeline treats each uploaded document as a sequence of processing stages designed to preserve semantic structure while limiting token usage:
- Text Extraction: Raw PDF text is segmented into logical blocks (headings, paragraphs, lists) to avoid merging unrelated concepts.
- Chunking & Normalization: Blocks are grouped into chunks under a target token budget (e.g. ~1–2k tokens) with light cleanup (whitespace, duplicate heading collapse).
- Summarization Pass: Each chunk is summarized independently; a consolidation pass merges overlapping summaries and enforces consistent terminology.
- Flashcard Generation: For factual or definition-rich segments, prompt templates produce Q&A pairs (priority: definitions → processes → edge cases). Near-duplicate cards are deduped by fuzzy matching.
- Q&A Interactive Mode: User questions reference stored chunk embeddings (future: vector index) to inject relevant context before answering.
- Schedule Synthesis: Summaries + card counts feed a heuristic that splits material into milestones (intro, drilling, review). Spaced repetition intervals are tuned by difficulty (definition vs conceptual vs procedural).
Data Model Considerations
- Documents: Metadata (title, source filename, processing state) + normalized text blocks.
- Cards: question, answer, source_block_ids[], difficulty, next_review_at.
- Schedules: milestone_day, target_blocks, review_focus (new vs mature).
Token & Performance Constraints
- Chunking prevents hitting provider token limits and reduces latency variance.
- Consolidation step avoids summary drift where later chunks rephrase earlier concepts inconsistently.
- Flashcard dedupe prevents redundant drilling (especially glossary sections repeating terms).
Challenges & Mitigations
- PDF Noise: Line-break heavy content or hyphenated words cause fragmented context → employ normalization and word rejoining heuristics.
- Duplicate Content: Slides + notes with overlapping bullet points → similarity scoring before generating cards.
- Token Budget: Large textbooks exceed single-pass limits → incremental summarization tree (chunk → section → global).
- Context Precision: Q&A answers hallucinate if context is too broad → narrow selection to top-N semantically closest blocks (future: embedding store).
- Scheduling Fairness: Over-emphasis on early dense chapters → weight milestones by normalized token density, not raw length.
Future Improvements
- Vector index for semantic retrieval (Supabase pgvector or external service).
- Adaptive spaced repetition using per-card success history.
- Export schedule to external calendars (ICS generation).
- Collaborative sets with per-user mastery scoring.
Why This Stack
Supabase provides an excellent developer experience for auth and data, while Next.js simplifies server/ client boundaries and streaming UI. Together they enable fast iteration and a clean mental model.
Roadmap Snapshot
- Calendar export (ICS + provider sync)
- Adaptive spaced repetition tuning
- Team/shared study sets with permission tiers
- Embeddings + semantic rerank for Q&A context
Feedback or ideas? Reach out — I’d love to hear them.