Skip to content

ai-pdf-chatbot-langchain

Template app that lets you chat with PDF documents using LangChain, LangGraph, OpenAI and Supabase.

Stars
16.6k
Forks
3.2k
Licence
MIT
Language
TypeScript
Last update
7 months ago
Type
App

This repository is archived and no longer maintained.

What it is

This is a starter project that lets you upload PDF files and ask questions about them in a chat window. It reads the PDFs, stores searchable vector embeddings in a Supabase database, and uses an OpenAI model (or another supported provider) to answer questions with references to the retrieved text. It is built as a template you can copy and adapt, and the README says it also accompanies the book Learning LangChain.

  • Upload a PDF and ask questions about its contents in a chat interface
  • Study how an ingestion graph and a retrieval graph are structured in LangGraph
  • Swap or customize the agent's behavior by editing the backend graph files
  • Inspect each step of the graph using LangGraph Studio during development

Great for

  • Developers learning how LangGraph ingestion and retrieval graphs fit together
  • Developers who want a working Next.js and TypeScript starting point for document Q&A
  • Students following the Learning LangChain book
  • Teams prototyping a PDF question-answering feature with their own OpenAI and Supabase accounts

Not ideal for

  • Anyone wanting a ready-made product without coding or setup, since it needs API keys and a configured Supabase database
  • Production use, because the README states the project is no longer actively maintained and issues and pull requests may go unanswered
  • Users who need a non-OpenAI setup without checking LangChain's provider support themselves, since the README only says other providers may work

How to get it

  1. 1

    Clone and build from source

    You'll need: Node.js v18+ (v20 recommended) · Yarn (npm also mentioned, but the monorepo is set up for Yarn) · Supabase project with a documents table and match_documents function · OpenAI API key

    Clone the repository

    git clone https://github.com/mayooear/ai-pdf-chatbot-langchain.git

    Install dependencies from the monorepo root

    yarn install

    Copy the backend environment template

    cp backend/.env.example backend/.env

    Copy the frontend environment template

    cp frontend/.env.example frontend/.env
  2. 2

    Run it

    • Fill in OPENAI_API_KEY, SUPABASE_URL and SUPABASE_SERVICE_ROLE_KEY in backend/.env
    • Start the backend with yarn langgraph:dev from the backend folder (port 2024 by default)
    • Start the frontend with yarn dev from the frontend folder
    • Open http://localhost:3000, upload a small PDF, then ask a question in the chat
  3. 3

    Get the most out of it

    • Enable LangSmith tracing with LANGCHAIN_TRACING_V2 and a LangSmith API key to debug each step
    • Use LangGraph Studio to visualize and test the graph before changing the UI
    • Adjust the agent logic in src/retrieval_graph.ts and src/ingestion_graph.ts
    • Review src/shared/configuration.ts to change model providers or vector stores

Downloads

Strengths

  • Clear separation of ingestion and retrieval logic into named graph files
  • Includes a web UI with streaming responses, so you can see answers appear in real time
  • MIT licensed, so you can copy and modify it freely

Trade-offs

  • Archived and not actively maintained, so bugs and dependency updates are unlikely to be addressed upstream
  • Requires several paid or account-based services (OpenAI, Supabase) and manual database setup
  • The README is truncated in places, so some setup details must be found in linked documentation

How it compares

ProjectStarsTypeLevelUpdatedBest for
ai-pdf-chatbot-langchain (this)16.6kAppintermediate7 months agoDevelopers learning how LangGraph ingestion and retrieval graphs fit together
anything-llm67.8kAppbeginner7 days agoPeople who want a private ChatGPT-style assistant over their own PDFs and text files
langchain149kFrameworkintermediate4 days agoPython developers building LLM-powered applications
langgraph44.3kLibraryintermediate4 days agoPython developers building multi-step AI agents that must survive failures or long waits
botpress15kDev toolintermediate7 days agoDevelopers who want to write integrations and bots as TypeScript code using the Botpress CLI and SDK
markitdown193kLibrarybeginner9 days agoDevelopers building LLM or text analysis pipelines that need document text

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.