A full-stack RAG-based PDF chatbot that lets users upload a PDF and ask questions about its content. The backend processes the uploaded PDF, splits it into chunks, and uses Google Gemini through LangChain to generate answers from the document context. The frontend provides a simple React interface for uploading files and chatting with the document.
- Upload and process PDF files
- Ask questions based on the uploaded PDF content
- FastAPI backend with LangChain document processing
- Google Gemini LLM integration
- React + Vite frontend
- Axios-based API communication
- Local runtime storage for uploaded PDFs
Frontend
- React
- Vite
- Axios
- CSS
Backend
- Python
- FastAPI
- LangChain
- Google Gemini
- PyPDF
- Uvicorn
RAG PDF Chatbot/
├── Backend/
│ ├── app/
│ │ ├── main.py
│ │ └── uploads/
│ ├── requirements.txt
│ └── .env
├── Frontend/
│ ├── src/
│ ├── package.json
│ └── vite.config.js
├── .gitignore
└── README.md
- Python 3.10+
- Node.js 18+
- npm
- Google Gemini API key
Go to the backend folder:
cd BackendCreate and activate a virtual environment:
python -m venv venv
venv\Scripts\activateInstall dependencies:
pip install -r requirements.txtCreate a .env file inside the Backend folder:
GOOGLE_API_KEY=your_google_gemini_api_keyStart the backend server:
uvicorn app.main:app --reloadThe backend will run at:
http://127.0.0.1:8000
Open a new terminal and go to the frontend folder:
cd FrontendInstall dependencies:
npm installStart the frontend development server:
npm run devThe frontend will run at:
http://localhost:5173
- Start the backend server.
- Start the frontend server.
- Open the frontend in your browser.
- Upload a PDF file.
- Ask questions related to the uploaded PDF.
POST /uploadUploads and processes a PDF file.
POST /chatSends a question and returns an answer based on the uploaded PDF content.
| Variable | Description |
|---|---|
GOOGLE_API_KEY |
Google Gemini API key used by LangChain |
This project ignores local dependencies, environment variables, uploaded files, generated vector databases, build output, logs, and cache files. These files should not be pushed to GitHub.

