LectureGen lets learners assemble interactive, multi-modal lectures that match their pace and preferred learning style. The platform pairs an AI "lead instructor" with an attentive "teaching assistant" to scaffold explanations, walkthroughs, and practice in the formats that work best for each person.
- Problem: Traditional lectures and textbooks are one-size-fits-all, favor passive listening, and rarely accommodate neurodiverse learners or people who need multisensory reinforcement.
- Solution: Give learners a configurable lecture builder that mixes content blocks (concept overviews, code-first demos, comprehension checks) with presentation styles (visual summaries, audio narration, blended flows).
- Value: Higher engagement and retention through adaptive pacing, modality switching, and a "sudo teacher + TA" duo that encourages questions and hands-on practice.
- Assemble lectures interactively with AI-guided clarification questions and personalized scaffolding.
- Render content as audio-first, visual-first, or blended experiences powered by LiveKit's low-latency media stack.
- Generate diagrams, code walkthroughs, and practice prompts on demand using Zod-validated LLM outputs.
- Cache learner uploads and lecture assets for reuse across study sessions.
frontend/ (Next.js 16 + React 19)
↳ Renders the lecture builder UI, handles modality selection, and streams media.
api/ (Fastify + TypeScript)
↳ Manages lecture creation, file caching, LiveKit/WebSocket sessions, and Claude integrations.
types/ (shared Zod schemas)
↳ Ensures consistent lecture, preference, and user models across services.
LiveKit + Anthropic + Firebase
↳ Realtime TTS/STT, LLM orchestration, persistent storage, and asset hosting.
api/ Fastify service, WebSocket handlers, Claude + LiveKit helpers
app/ (reserved for future agents / orchestration tooling)
frontend/ Next.js application and UI components
types/ Shared Zod schemas compiled to JS/TS for reuse
AGENTS.md Reference for AI agent behaviors and responsibilities
test-livekit.sh Smoke test for LiveKit connectivity
- Node.js 20+
- pnpm 9+
- Access to Anthropic Claude, LiveKit, Firebase, and Google Custom Search credentials
- Sponsor integrations (see internal sponsor list) when required for specific lecture experiences
- Install dependencies at the workspace root:
pnpm install
- Create a
.envfile in the repository root (the frontend automatically loads it viadotenv). - Populate the environment variables listed below. At minimum you will need API keys for Anthropic, LiveKit, Firebase, and Google Custom Search.
- Optional: add
service-account-key.jsoninsideapi/or pointFIREBASE_SERVICE_ACCOUNT_PATHto a secure location.
| Variable | Required | Description |
|---|---|---|
BACKEND_ENDPOINT |
yes | Base URL for the Fastify API (e.g. http://localhost:4000/api/). |
NEXT_PUBLIC_BACKEND_ENDPOINT |
optional | Overrides BACKEND_ENDPOINT on the client. Use when exposing a different base URL to browsers. |
| Variable | Required | Description |
|---|---|---|
ANTHROPIC_API_KEY |
yes | Claude API key used for lecture planning, clarifying questions, and diagram synthesis. |
| Variable | Required | Description |
|---|---|---|
LIVEKIT_WEBSOCKET_URL |
yes | LiveKit server URL for realtime WebSocket sessions. |
LIVEKIT_API_KEY |
yes | LiveKit API key for authentication. |
LIVEKIT_API_SECRET |
yes | LiveKit API secret (alias: LIVEKIT_API_SECRET_KEY). |
LIVEKIT_DEFAULT_VOICE |
optional | Default TTS voice identifier (falls back to the built-in sample voice). |
LIVEKIT_REQUEST_TIMEOUT_MS |
optional | Override for LiveKit request timeout. |
LIVEKIT_INFERENCE_URL |
optional | Base URL for LiveKit's inference APIs. |
LIVEKIT_INFERENCE_API_KEY |
optional | Inference API key when using LiveKit hosted AI. |
LIVEKIT_INFERENCE_API_SECRET |
optional | Inference API secret (alias: LIVEKIT_INFERENCE_API_SECRET_KEY). |
LIVEKIT_INFERENCE_STT_MODEL |
optional | Default speech-to-text model name. |
LIVEKIT_INFERENCE_STT_LANGUAGE |
optional | Default STT locale. |
LIVEKIT_INFERENCE_TTS_MODEL |
optional | Default text-to-speech model. |
LIVEKIT_INFERENCE_TTS_VOICE |
optional | Default TTS voice override. |
| Variable | Required | Description |
|---|---|---|
FIREBASE_SERVICE_ACCOUNT_PATH |
required* | Filesystem path to a Firebase service account JSON. Required unless FIREBASE_SERVICE_ACCOUNT or GOOGLE_APPLICATION_CREDENTIALS is set. |
FIREBASE_SERVICE_ACCOUNT |
optional | Inline JSON string of credentials (mutually exclusive with the path). |
FIREBASE_PROJECT_ID |
optional | Overrides Firebase project ID if not inferred from credentials. |
FIREBASE_STORAGE_BUCKET |
optional | Overrides default storage bucket. |
NEXT_PUBLIC_FIREBASE_API_KEY |
yes | Firebase client config for the frontend. |
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN |
yes | Firebase auth domain. |
NEXT_PUBLIC_FIREBASE_PROJECT_ID |
yes | Firebase project ID exposed to the client. |
NEXT_PUBLIC_FIREBASE_APP_ID |
yes | Firebase web app ID. |
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET |
optional | Client-side storage bucket override. |
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID |
optional | Messaging sender ID for notifications. |
NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID |
optional | Analytics measurement ID. |
| Variable | Required | Description |
|---|---|---|
GOOGLE_CSE_ID |
yes | Google Custom Search engine ID for image lookup. |
GOOGLE_API_KEY |
yes | Google API key paired with the CSE. |
| Variable | Required | Description |
|---|---|---|
HOST |
optional | Interface the Fastify server binds to (defaults to 0.0.0.0). |
PORT |
optional | Fastify port (defaults to 4000). |
NODE_ENV |
optional | When set to production, suppresses verbose logging. |
- Start the full stack (Next.js + Fastify):
pnpm dev
- Run individual services:
pnpm dev:web # frontend only pnpm dev:api # backend only
- Visit
http://localhost:3000for the LectureGen UI andhttp://localhost:4000for API logs.
| Endpoint | Method | Transport | Status |
|---|---|---|---|
/api/create-lecture-initial |
POST | HTTP multipart | Persists lecture stubs, caches uploads, returns { success, lecture_id, questions[] }. |
/api/tts |
GET | WebSocket | Streams LiveKit-backed TTS (tts.result events). HTTP requests return 426. |
/api/lecture |
GET | HTTP / WebSocket | HTTP placeholder (501). WebSocket closes with 1011 (handler pending). |
/api/watch_lecture |
GET | WebSocket | Streams lecture snapshots and answers user_question_request prompts. HTTP requests return 426. |
- Web search via Google Images (powered by
GOOGLE_CSE_ID+GOOGLE_API_KEY). - External agents such as NotesGPT/DiagramGPT for bespoke diagrams.
- On-the-fly Mermaid rendering generated by Claude and rendered in the frontend.
LectureGen emphasizes adaptive pacing, multi-modal outputs (audio, visual, blended), and scaffolding that benefits neurodiverse learners and anyone needing alternatives to passive lectures.
- All runtime schemas live in
types/and are shared viaschemapackage links—validate new contracts with Zod before integrating. - Keep functions focused; prefer composing helpers in the agent loop rather than expanding single mega-functions.
- Refer to
AGENTS.mdfor the latest guidance on agent behaviors and orchestration patterns. - Before launching new lecture formats, verify sponsor integration requirements (see the internal sponsor list).
- LiveKit issues: run
./test-livekit.shfor a quick connectivity check. - Firebase credentials: ensure
service-account-key.jsonexists or setFIREBASE_SERVICE_ACCOUNT. - Missing backend URL: the frontend falls back to
BACKEND_ENDPOINT; a missing value will throw at startup (frontend/lib/env.ts).
Internal project. Do not distribute without approval.