Skip to content

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 TestsFrontend TestsLicense: MIT

Deploy to Render


📸 Screenshots

Analyze a lectureInteractive quiz
Video analysis — summary, chapters, takeawaysInteractive quiz
Mind map & knowledge graphLearning dashboard
Mind mapDashboard — streak, stats, quiz history
Flashcards & spaced repetitionLanding page
Flashcards / SRS reviewHero / landing page

✨ Features

📚 Core Analysis

FeatureDescription
📖 AI Summary & OverviewComprehensive summary with key takeaways extracted by Gemini AI
🗺️ Chapter TimelineClickable AI-generated timestamps — seek to any section instantly
🔥 Key MomentsAI-identified highlights: insights, definitions, examples, turning points
🧠 Interactive Quiz8–12 multiple-choice questions with explanations + video timestamps
📝 Diverse ExercisesFill-in-the-blank, True/False, Matching, and Short Answer exercises
📇 Flashcard SystemIn-app spaced-repetition study mode + export to Anki (TSV) or CSV
📜 Transcript SearchFull transcript with live sync highlighting, search, and click-to-seek
💬 AI ChatAsk follow-up questions about the lecture with full context
🌍 MultilingualOutput in 7 languages: Vietnamese, English, French, German, Japanese, Korean, Chinese

🧠 Learning & Study Tools

FeatureDescription
📅 AI Study PlanPersonalized learning schedule generated by AI based on quiz scores, SRS data, and video history
🧠 Mind MapVisual mind map generated from lecture content
🕸️ Knowledge GraphInteractive D3.js graph connecting concepts across videos
📋 Multi-Video ExamGenerate exams from multiple analyzed videos with history tracking
📚 Playlist / Course ModeAnalyze entire YouTube playlists as a course with progress tracking
📊 DashboardLearning statistics: videos analyzed, quiz scores, time spent
🔥 Streak TrackingDaily learning streak with gamification and weekly heatmap
🏆 Achievement BadgesUnlock badges for milestones (first video, streak records, quiz mastery)
📈 Progress TrackingPer-video watch progress, quiz history charts, bookmark timeline
🔖 BookmarksMark important moments during playback with custom labels
📝 NotesRich notes editor with auto-save, timestamp insertion, and Markdown export
📊 Video CompareCompare quiz scores and progress across analyzed videos
🏷️ Video TagsOrganize videos with customizable category tags
📄 PDF ExportPrint-quality study guide combining summary, chapters, quiz, and notes

🎬 Input Sources

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

🔐 Accounts & Sharing

FeatureDescription
👤 User AccountsEmail registration + login with JWT authentication
🔑 Google OAuthOne-click sign-in with Google account linking
🔒 Forgot PasswordSecure token-based password reset via email (SMTP)
☁️ Cloud SyncSync progress, notes, bookmarks, and history across devices in real-time
📤 Share NotesGenerate shareable read-only links for notes & bookmarks
👥 Study RoomsCollaborative study rooms with invite codes, shared videos, discussion threads, and progress comparison

📱 Platform

FeatureDescription
📱 PWAInstall as app on mobile/desktop with offline caching
🌙 Dark / Light ThemeToggle between premium dark and clean light modes
📱 ResponsiveOptimized for mobile, tablet, and desktop
📜 HistorySearch 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 keyecho"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.13+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:

# RequiredGEMINI_API_KEY=your_gemini_api_key_here# Optional — Google OAuthGOOGLE_CLIENT_ID=your_google_client_id# Optional — Password Reset Email (SMTP)SMTP_HOST=smtp.gmail.comSMTP_PORT=587SMTP_USER=your_email@gmail.comSMTP_PASS=your_app_passwordSMTP_FROM=your_email@gmail.com# Optional — YouTube anti-block (for cloud deploy)YOUTUBE_COOKIES_B64=base64_encoded_cookiesYOUTUBE_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 — bootstrap, middleware, SPA serving
│ ├── routes/ # API routes, split into ~15 router modules
│ │ ├── auth.py # Auth, Google OAuth, password reset
│ │ ├── analyze.py # Video / file analysis
│ │ ├── sync.py # Cloud sync
│ │ ├── srs_reminder.py # Spaced-repetition email reminders
│ │ └── ... # ai_tools, content, and more
│ ├── database.py # SQLite database (users, sync, shared notes)
│ ├── gemini_client.py # Gemini client + model fallback
│ ├── requirements.txt # Python dependencies
│ └── .env # API keys & config (never commit!)
├── frontend/
│ ├── index.html # Main SPA shell (1600+ lines)
│ ├── css/ # ~50 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 45+ more modules
│ │ └── mobile.css # Responsive breakpoints
│ ├── js/ # ~45 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

LayerTechnology
BackendPython 3.13 + FastAPI + SQLite
AI EngineGoogle Gemini 2.5 Flash (with auto-fallback to Lite)
AuthJWT + bcrypt + Google OAuth 2.0
Transcriptsyoutube-transcript-api v1.x + InnerTube fallback
File UploadGemini Files API (audio/video transcription)
Video PlayerYouTube IFrame API
VisualizationD3.js (Knowledge Graph, Mind Map)
FrontendVanilla HTML / CSS / JS (no framework)
PWAService Worker + Web App Manifest
ContainerDocker + Docker Compose
DeploymentRender / 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

VarPurpose
BCRYPT_ROUNDSPassword-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_SECRETSigning secret for auth tokens. Required in production.
TRUST_PROXYSet to trueonly 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

Contributing

Security policy

Stars

12 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages