Skip to content

tridpt/LectureDigest

Repository files navigation

LectureDigest 🎓

Transform any YouTube lecture (or uploaded audio/video) into a complete AI-powered study companion — summaries, quizzes, flashcards, mind maps, and more.

Backend Tests Frontend Tests License: MIT

Deploy to Render


📸 Screenshots

Analyze a lecture Interactive quiz
Video analysis — summary, chapters, takeaways Interactive quiz
Mind map & knowledge graph Learning dashboard
Mind map Dashboard — streak, stats, quiz history
Flashcards & spaced repetition Landing page
Flashcards / SRS review Hero / landing page

✨ Features

📚 Core Analysis

Feature Description
📖 AI Summary & Overview Comprehensive summary with key takeaways extracted by Gemini AI
🗺️ Chapter Timeline Clickable AI-generated timestamps — seek to any section instantly
🔥 Key Moments AI-identified highlights: insights, definitions, examples, turning points
🧠 Interactive Quiz 8–12 multiple-choice questions with explanations + video timestamps
📝 Diverse Exercises Fill-in-the-blank, True/False, Matching, and Short Answer exercises
📇 Flashcard System In-app spaced-repetition study mode + export to Anki (TSV) or CSV
📜 Transcript Search Full transcript with live sync highlighting, search, and click-to-seek
💬 AI Chat Ask follow-up questions about the lecture with full context
🌍 Multilingual Output in 7 languages: Vietnamese, English, French, German, Japanese, Korean, Chinese

🧠 Learning & Study Tools

Feature Description
📅 AI Study Plan Personalized learning schedule generated by AI based on quiz scores, SRS data, and video history
🧠 Mind Map Visual mind map generated from lecture content
🕸️ Knowledge Graph Interactive D3.js graph connecting concepts across videos
📋 Multi-Video Exam Generate exams from multiple analyzed videos with history tracking
📚 Playlist / Course Mode Analyze entire YouTube playlists as a course with progress tracking
📊 Dashboard Learning statistics: videos analyzed, quiz scores, time spent
🔥 Streak Tracking Daily learning streak with gamification and weekly heatmap
🏆 Achievement Badges Unlock badges for milestones (first video, streak records, quiz mastery)
📈 Progress Tracking Per-video watch progress, quiz history charts, bookmark timeline
🔖 Bookmarks Mark important moments during playback with custom labels
📝 Notes Rich notes editor with auto-save, timestamp insertion, and Markdown export
📊 Video Compare Compare quiz scores and progress across analyzed videos
🏷️ Video Tags Organize videos with customizable category tags
📄 PDF Export Print-quality study guide combining summary, chapters, quiz, and notes

🎬 Input Sources

Feature Description
▶️ YouTube URL Paste any YouTube video or playlist URL
📤 File Upload Upload audio/video files directly (MP3, MP4, WAV, M4A, WebM, OGG, FLAC, AAC, MOV — up to 200MB)

🔐 Accounts & Sharing

Feature Description
👤 User Accounts Email registration + login with JWT authentication
🔑 Google OAuth One-click sign-in with Google account linking
🔒 Forgot Password Secure token-based password reset via email (SMTP)
☁️ Cloud Sync Sync progress, notes, bookmarks, and history across devices in real-time
📤 Share Notes Generate shareable read-only links for notes & bookmarks
👥 Study Rooms Collaborative study rooms with invite codes, shared videos, discussion threads, and progress comparison

📱 Platform

Feature Description
📱 PWA Install as app on mobile/desktop with offline caching
🌙 Dark / Light Theme Toggle between premium dark and clean light modes
📱 Responsive Optimized for mobile, tablet, and desktop
📜 History Search and filter analyzed videos by name or category tags

🚀 Quick Start (Local)

Option A — Docker (Recommended)

# 1. Clone the repo
git clone https://github.com/tridpt/LectureDigest.git
cd LectureDigest

# 2. Create .env with your Gemini API key
echo "GEMINI_API_KEY=your_key_here" > backend/.env

# 3. Build & run
docker compose up --build

# 4. Open http://localhost:8000

Option B — Python

# Requirements: Python 3.9+
cd LectureDigest

# Copy env and add your API key
copy backend\.env.example backend\.env
# Edit backend\.env → set GEMINI_API_KEY=your_key_here

# Install deps & start
pip install -r backend/requirements.txt
cd backend
uvicorn main:app --reload --port 8000

# Open http://localhost:8000

Option C — Windows One-Click

# Double-click run.bat — it installs deps and starts the server automatically

Get your Gemini API Keyaistudio.google.com/app/apikey


⚙️ Configuration

All config goes in backend/.env:

# Required
GEMINI_API_KEY=your_gemini_api_key_here

# Optional — Google OAuth
GOOGLE_CLIENT_ID=your_google_client_id

# Optional — Password Reset Email (SMTP)
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your_email@gmail.com
SMTP_PASS=your_app_password
SMTP_FROM=your_email@gmail.com

# Optional — YouTube anti-block (for cloud deploy)
YOUTUBE_COOKIES_B64=base64_encoded_cookies
YOUTUBE_PROXY_URL=http://user:pass@host:port

Without SMTP configured, password reset links are printed to the server console (dev mode).


☁️ Deploy to the Internet

Render.com (Free Tier — Recommended)

  1. Push your fork to GitHub
  2. Go to render.com/deploy → connect your repo
  3. Render auto-detects render.yaml → click Deploy
  4. In the Environment tab, add: GEMINI_API_KEY = your_key_here
  5. Done! Your app is live at https://lecturedigest.onrender.com 🎉

⚠️ Free tier spins down after 15 min of inactivity — first request takes ~30s to wake up.

Railway.app

npm install -g @railway/cli
railway login
railway link
railway up

Then set GEMINI_API_KEY in the Railway dashboard.

Fly.io

curl -L https://fly.io/install.sh | sh
fly auth login
fly launch
fly secrets set GEMINI_API_KEY=your_key_here
fly deploy

🐳 Docker Reference

# Build image
docker build -t lecturedigest .

# Run with env var
docker run -p 8000:8000 -e GEMINI_API_KEY=your_key lecturedigest

# Using docker compose
docker compose up --build        # start
docker compose down              # stop
docker compose logs -f app       # view logs

🗂️ Project Structure

LectureDigest/
├── backend/
│   ├── main.py              # FastAPI app — all API routes
│   ├── database.py          # SQLite database (users, sync, shared notes)
│   ├── requirements.txt     # Python dependencies
│   └── .env                 # API keys & config (never commit!)
├── frontend/
│   ├── index.html           # Main SPA shell (1600+ lines)
│   ├── css/                 # 35 modular CSS files
│   │   ├── base.css         # CSS variables & design tokens
│   │   ├── theme.css        # Dark/Light mode theming
│   │   ├── hero.css         # Landing page hero section
│   │   ├── quiz.css         # Quiz card styling
│   │   ├── ...              # And 30+ more modules
│   │   └── mobile.css       # Responsive breakpoints
│   ├── js/                  # 28 modular JS files
│   │   ├── core.js          # App initialization & routing
│   │   ├── analyze.js       # Video analysis flow
│   │   ├── quiz.js          # Quiz engine
│   │   ├── flashcard.js     # Flashcard study system
│   │   ├── exercises.js     # Diverse exercise types
│   │   ├── transcript.js    # Transcript search & sync
│   │   ├── notes.js         # Notes editor
│   │   ├── chat.js          # AI chat
│   │   ├── mindmap.js       # Mind map visualization
│   │   ├── knowledge-graph.js # D3.js knowledge graph
│   │   ├── exam.js          # Multi-video exam
│   │   ├── gamification.js  # Streaks & XP
│   │   ├── auth.js          # Authentication UI
│   │   ├── db-sync.js       # Cloud sync engine
│   │   ├── upload.js        # File upload handler
│   │   ├── share-notes.js   # Shareable note links
│   │   ├── pwa-install.js   # PWA install prompt
│   │   └── ...              # And 10+ more modules
│   ├── shared-notes.html    # Standalone shared notes viewer
│   ├── reset-password.html  # Password reset page
│   ├── manifest.json        # PWA manifest
│   └── sw.js                # Service worker (offline cache)
├── cloudflare-worker/       # Optional CDN worker
├── Dockerfile               # Production container
├── docker-compose.yml       # Local Docker dev
├── render.yaml              # Render.com deploy blueprint
└── run.bat                  # Windows one-click start

🛠️ Tech Stack

Layer Technology
Backend Python 3.13 + FastAPI + SQLite
AI Engine Google Gemini 2.5 Flash (with auto-fallback to Lite)
Auth JWT + bcrypt + Google OAuth 2.0
Transcripts youtube-transcript-api v1.x + InnerTube fallback
File Upload Gemini Files API (audio/video transcription)
Video Player YouTube IFrame API
Visualization D3.js (Knowledge Graph, Mind Map)
Frontend Vanilla HTML / CSS / JS (no framework)
PWA Service Worker + Web App Manifest
Container Docker + Docker Compose
Deployment Render / Railway / Fly.io

🧪 Development

Running tests

cd backend
pip install -r requirements.txt
pip install ruff          # linter (not a runtime dep)
pytest                    # full suite (230+ tests)
ruff check .              # lint

Tests run against an isolated temporary SQLite database (see backend/tests/conftest.py) — they never touch your real data and make no network or Gemini calls.

Frontend tests

npm install               # installs vitest + jsdom (dev only)
npm test                  # run Vitest once
npm run test:watch        # watch mode

Frontend tests focus on the XSS-escaping helpers and the Markdown study-guide builder. They extract individual functions from the real source files (see frontend/tests/extract.js) so a change that makes an escaper unsafe fails the suite. .github/workflows/frontend-tests.yml runs them on every push/PR touching frontend/.

Frontend has its own unit tests (Vitest) covering the XSS escapers and the Markdown-export builder:

npm install
npm test                  # Vitest (frontend)

Useful env vars for local/dev

Var Purpose
BCRYPT_ROUNDS Password-hash cost factor. Defaults to 12 (production). Tests set it to 4 for speed; you can lower it locally too. Never set it low in production.
JWT_SECRET Signing secret for auth tokens. Required in production.
TRUST_PROXY Set to true only behind a trusted reverse proxy so rate limiting reads X-Forwarded-For.

Continuous Integration

.github/workflows/backend-tests.yml runs ruff + the full pytest suite on every push to main and on pull requests touching backend/.

Architecture

See ARCHITECTURE.md for a technical overview — request flow, backend/frontend layering, the data model, API surface, caching, and sync.

Security

See SECURITY.md for hardening decisions (XSS escaping rules, CSP, input validation, rate limiting) and how to report a vulnerability. Read it before changing auth, input handling, or any code that renders user/AI content.


📝 License

MIT

About

Transform any YouTube lecture or uploaded audio/video into an AI-powered study companion — summaries, quizes, flashcards, mind maps, and more.

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors