Chat with your documents using Retrieval-Augmented Generation (RAG). Upload PDFs, Word docs, or text files and ask questions — powered by LangChain, FastAPI, and a React frontend.
- Upload and index multiple documents (PDF, DOCX, TXT)
- Semantic search using vector embeddings (FAISS / ChromaDB)
- Conversational memory — ask follow-up questions
- Source citations with every answer
- Clean React UI with streaming responses
| Layer | Technology |
|---|---|
| Backend | Python, FastAPI, LangChain |
| Embeddings | OpenAI text-embedding-ada-002 / HuggingFace |
| Vector Store | FAISS (local) / ChromaDB |
| LLM | OpenAI GPT-4 / Claude (Anthropic) |
| Frontend | React, Vite, TailwindCSS |
| Deployment | Railway (backend) + Vercel (frontend) |
rag-document-chat/
├── backend/
│ ├── app/
│ │ ├── main.py # FastAPI entry point
│ │ ├── routes/
│ │ │ ├── upload.py # Document upload & indexing
│ │ │ └── chat.py # Chat & retrieval endpoint
│ │ ├── services/
│ │ │ ├── embedder.py # Embedding logic
│ │ │ ├── retriever.py # Vector store retrieval
│ │ │ └── llm.py # LLM chain setup
│ │ └── models.py # Pydantic schemas
│ ├── requirements.txt
│ └── .env.example
├── frontend/
│ ├── src/
│ │ ├── components/
│ │ │ ├── ChatWindow.jsx
│ │ │ ├── FileUpload.jsx
│ │ │ └── MessageBubble.jsx
│ │ ├── App.jsx
│ │ └── main.jsx
│ ├── package.json
│ └── .env.example
└── docker-compose.yml
cd backend
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env # Add your API keys
uvicorn app.main:app --reloadcd frontend
npm install
cp .env.example .env
npm run dev# backend/.env
OPENAI_API_KEY=your_key_here
ANTHROPIC_API_KEY=your_key_here # optional, for Claude
CHROMA_PERSIST_DIR=./chroma_db
MAX_UPLOAD_SIZE_MB=20- Upload — Documents are chunked and embedded into a vector store
- Query — User question is embedded and top-k similar chunks are retrieved
- Generate — LLM generates an answer grounded in retrieved context
- Cite — Response includes source document + page references
User Question
│
▼
[Embedding Model] ──► [Vector Store] ──► [Top-K Chunks]
│
▼
[LLM + System Prompt]
│
▼
Answer + Source Citations
# Backend → Railway
railway login && railway up
# Frontend → Vercel
vercel --prodMIT
