AI-powered document Q&A β upload any document, ask anything, get cited answers.
ChatWithDocs is a full-stack RAG (Retrieval-Augmented Generation) application that lets you chat with your documents using natural language. Powered by Google Gemini and Pinecone vector search, every answer comes with exact source citations so you always know where the information came from.
π Live Demo
- π€ Multi-format upload β PDF, DOCX, XLSX, PPTX, TXT, CSV, MD, HTML, RTF, ODT
- π Semantic search β Pinecone vector DB with Gemini embeddings
- π¬ Conversational AI β warm, helpful answers with full conversation history
- π Source citations β every answer cites exact document + page number
- π Analytics dashboard β usage stats, activity charts, top documents
- π History browser β browse, search, and continue past conversations
- π Auth β JWT-based register/login, per-user data isolation
- π³ Docker ready β production-grade Nginx + multi-stage build
User
β
βΌ
React Frontend (Vite + TailwindCSS)
β JWT auth Β· axios interceptor
βΌ
FastAPI Backend
β
βββ Auth Router β JWT Β· bcrypt
βββ Documents Router β upload Β· parse Β· chunk Β· embed
βββ Chat Router β semantic search Β· LLM generation Β· citations
βββ Analytics Router β usage stats Β· activity data
β
βββ PostgreSQL (Supabase) β users Β· documents Β· conversations Β· messages
βββ Pinecone β vector embeddings (768-dim, cosine)
βββ Google Gemini β embeddings + conversational generation
| Layer | Technology |
|---|---|
| Frontend | React 18 Β· Vite Β· TailwindCSS Β· Recharts |
| Backend | Python 3.11 Β· FastAPI Β· SQLAlchemy |
| LLM | Google Gemini (gemini-3.1-flash-lite) |
| Embeddings | Gemini Embedding 001 (768 dims) |
| Vector DB | Pinecone (serverless Β· cosine similarity) |
| Database | PostgreSQL via Supabase |
| Auth | JWT (python-jose) Β· bcrypt (passlib) |
| DevOps | Docker Β· Nginx Β· pytest (19/19 tests) |
- Python 3.11+
- Node.js 18+
- A Supabase project (free tier works)
- A Pinecone account (free tier works)
- A Google AI Studio API key
git clone https://github.com/Saanchi-Itkelwar/ChatWithDocs
cd chatwithDocs
cp .env.example .env
# Open .env and fill in your keys (see Environment Variables below)cd backend
python -m venv venv
source venv/bin/activate # Mac / Linux
# venv\Scripts\activate # Windows
pip install -r requirements.txt
uvicorn main:app --reload --port 8000API available at: http://localhost:8000
Swagger docs at: http://localhost:8000/docs
cd frontend
npm install
npm run devApp available at: http://localhost:5173
docker compose up --buildRuns the full stack β FastAPI backend + Nginx-served React frontend.
Create a .env file in the backend folder:
DATABASE_URL=postgresql://postgres:[password]@db.[ref].supabase.co:5432/postgres
PINECONE_API_KEY=your_pinecone_api_key
PINECONE_INDEX_NAME=chatwithdocs
GEMINI_API_KEY=your_gemini_api_key
JWT_SECRET=your_random_secret_string_at_least_32_chars| Variable | Where to get it |
|---|---|
DATABASE_URL |
Supabase β Project Settings β Database β Connection string |
PINECONE_API_KEY |
Pinecone console β API Keys |
PINECONE_INDEX_NAME |
Must be lowercase, e.g. chatwithdocs |
GEMINI_API_KEY |
Google AI Studio |
JWT_SECRET |
Any random string β openssl rand -hex 32 |
cd backend
source venv/bin/activate
pytest tests/ -vchatwithDocs/
βββ backend/
β βββ core/
β β βββ config.py # Pydantic settings β env vars
β β βββ database.py # SQLAlchemy engine + session
β β βββ logger.py # Structured logging
β β βββ security.py # bcrypt + JWT
β β βββ utils.py # UUID helpers
β βββ models/ # SQLAlchemy ORM models
β β βββ user.py
β β βββ document.py
β β βββ chunk.py
β β βββ conversation.py
β βββ routers/ # FastAPI route handlers
β β βββ auth.py
β β βββ documents.py
β β βββ chat.py
β β βββ analytics.py
β βββ schemas/ # Pydantic request/response schemas
β βββ services/ # Core RAG pipeline
β β βββ parser.py # Multi-format document parsing
β β βββ chunker.py # Paragraph-aware overlapping chunks
β β βββ embedder.py # Gemini embedding-001 (768 dims)
β β βββ retriever.py # Pinecone store + semantic search
β β βββ ingestion.py # Full pipeline orchestrator
β β βββ llm.py # Gemini conversational generation
β βββ tests/ # Pytest suite (19 tests)
β βββ uploads/ # Uploaded files (gitignored)
β βββ main.py # App entry point
β βββ requirements.txt
βββ frontend/
β βββ src/
β β βββ components/ # AppLayout, Sidebar, ErrorBoundary, PrivateRoute
β β βββ context/ # AuthContext (JWT + user state)
β β βββ pages/ # Dashboard, Upload, Library, Chat, History, Analytics
β β βββ services/ # Axios API client with JWT interceptor
β βββ Dockerfile # Multi-stage Nginx production build
β βββ nginx.conf
βββ .env.example
βββ docker-compose.yml
βββ README.md
Document Upload
β
βΌ
Parser β extracts text from PDF/DOCX/XLSX/etc.
β
βΌ
Chunker β paragraph-aware overlapping chunks (800 tokens, 120 overlap)
β
βΌ
Embedder β Gemini embedding-001 β 768-dim vectors
β
βΌ
Pinecone β stores vectors with document/user metadata
β
βΌ (on user question)
Semantic Search β embed query β top-5 cosine similar chunks
β
βΌ
Gemini LLM β conversational answer grounded in retrieved chunks
β
βΌ
Citations β exact source document + page number returned
| Format | Extension |
|---|---|
.pdf |
|
| Word | .docx |
| Excel | .xlsx |
| PowerPoint | .pptx |
| Plain Text | .txt |
| Markdown | .md |
| CSV | .csv |
| HTML | .html .htm |
| Rich Text | .rtf |
| OpenDocument | .odt |
Max file size: 50MB




