A full-stack document Q&A application that lets users upload a PDF, ask questions in text or voice, and receive context-grounded answers using a basic Retrieval-Augmented Generation (RAG) pipeline.
This project focuses on integrating frontend interaction (chat + voice) with a practical backend RAG workflow rather than production deployment or large-scale retrieval infrastructure.
- A React + Node.js application for PDF-based question answering
- Supports:
- PDF upload
- text-based Q&A chat
- voice input (speech-to-text)
- voice output (text-to-speech)
- Designed as a portfolio/demo project to show end-to-end AI app integration using LangChain and OpenAI
- Built the frontend chat interface with React and Ant Design
- Implemented PDF upload flow from browser to backend using multipart requests
- Added voice interaction with
react-speech-recognitionandspeak-tts - Built an Express backend for file ingestion and Q&A endpoints
- Implemented a LangChain-based RAG pipeline:
- PDF loading
- text chunking
- embedding generation
- in-memory vector retrieval
- LLM answer generation
- Frontend: React, Ant Design, Axios
- Backend: Node.js, Express, Multer, CORS
- AI / RAG: LangChain, OpenAI Embeddings, ChatOpenAI, PDFLoader
- Vector Store:
MemoryVectorStore(in-memory)
src/
+-- App.js # page layout and conversation state
+-- components/
| +-- PdfUploader.js # drag-and-drop PDF upload UI
| +-- ChatComponent.js # text/voice input and chat controls
| +-- RenderQA.js # conversation rendering
server/
+-- server.js # Express API server (/upload, /chat)
+-- chat.js # LangChain RAG pipeline
+-- uploads/ # uploaded PDF files (local)
- User uploads a PDF from the frontend.
- Backend stores the file in
server/uploads/. - User submits a question via
GET /chat. - Backend loads the PDF and splits it into chunks.
- The app creates embeddings and builds an in-memory vector store.
- LangChain retrieves relevant chunks and uses OpenAI to generate an answer.
Uploads a single file using multipart form data (file field).
Response example:
uploads/example.pdf upload successfully.
Runs Q&A against the most recently uploaded PDF and returns answer text.
Response example:
<answer text>
- Install root dependencies:
npm install- Install backend dependencies:
cd server
npm install
cd ..- Add environment variable in root
.env:
REACT_APP_OPENAI_API_KEY=your_openai_api_key- Start frontend and backend together:
npm run dev- Open:
- Frontend:
http://localhost:3000 - Backend:
http://localhost:5001
npm run dev- run frontend and backend concurrentlynpm start- start React frontendnpm run server- start backend from rootnpm run build- build frontendnpm test- run frontend tests
Backend (server/package.json):
npm run start- start Express server
- Full-stack demo with working UI + backend integration
- Uses a simple in-memory retrieval setup for clarity and fast iteration
- Backend is intentionally lightweight and focused on core RAG flow
- Good for demonstrating AI app integration and API orchestration patterns
- Only one active uploaded file is tracked at a time (global file path state)
- Vector store is rebuilt on each query (no caching/persistence)
- No authentication, user sessions, or rate limiting
- Minimal validation and error handling (demo-level)
- Not optimized for concurrent multi-user production workloads
I built this project to practice shipping an end-to-end AI application that combines frontend interaction, backend APIs, and a document-based RAG pipeline. It helped me learn how to connect user-facing product behavior (upload/chat/voice) with retrieval and LLM orchestration in a clean, testable full-stack workflow.