Architecture

System Architecture

Understanding how NotebookLLM's frontend, backend, and AI services work together.

High-Level Architecture

NotebookLLM System Architecture Diagram

Technology Stack

Backend

  • • FastAPI - Web framework
  • • PostgreSQL - Database
  • • Qdrant - Vector store
  • • Supabase - Auth & Storage
  • • LlamaIndex - RAG framework
  • • Procrastinate - Task queue

Frontend

  • • Next.js 14 - React framework
  • • TypeScript - Type safety
  • • Tailwind CSS - Styling
  • • shadcn/ui - Components
  • • React Query - State
  • • next-themes - Theming

AI/ML

  • • Google Gemini - LLM
  • • Cohere - Reranking
  • • Sentence Transformers
  • • Kokoro TTS - Audio
  • • Langfuse - Observability

Data Flow

Document Ingestion Flow

  1. User uploads file via frontend
  2. File stored in Supabase (private bucket)
  3. Background worker processes document
  4. Text extracted, chunked, and embedded
  5. Vectors stored in Qdrant
  6. Document status updated to COMPLETED

Chat Query Flow

  1. User sends message via chat interface
  2. Backend retrieves relevant document chunks (hybrid search)
  3. Chunks reranked using Cohere
  4. LLM generates response with citations
  5. Response streamed to frontend
  6. Message and citations saved to database

Content Generation Flow

  1. User requests content (podcast/quiz/flashcards)
  2. LLM generates content using document context
  3. For podcasts: TTS converts script to audio
  4. Generated content stored in database
  5. Audio files uploaded to public bucket
  6. Content available in Studio panel

Key Components

RAG Pipeline

Retrieval-Augmented Generation powered by LlamaIndex. Combines semantic and keyword search with reranking for accurate, cited responses.

Content Generation

AI-powered generation of podcasts, quizzes, flashcards, and mind maps using structured outputs for reliable results.

Background Processing

Procrastinate-based task queue handles long-running operations like document processing and content generation.

Authentication

Supabase Auth with JWT validation. Users provisioned automatically on first login.