An early RAG prototype: upload a PDF, it is split, embedded and stored in a local FAISS index, then you chat with an OpenAI model grounded in the document's own text.


PDF Chat is an early prototype I built to learn retrieval-augmented generation (RAG). You upload a PDF, the app indexes it, and you can then ask questions in a chat window and get answers grounded in the document's own text rather than the model's general knowledge.
Solo project. I wrote the Next.js client and two iterations of the Express backend, the later one with documented upload and chat endpoints.
The front end is a Next.js app whose API routes act as a thin proxy: the upload route parses the multipart form and forwards the file, and the chat route forwards the question. The backend is Express with Helmet, Morgan and Multer, using LangChain's PDF loader, recursive text splitter, OpenAI embeddings, FAISS vector store and retrieval QA chain. Upload and chat are separate routes, and the vector store is loaded lazily from disk on the first question.