A full-stack Retrieval-Augmented Generation web application that lets you upload documents (PDF, TXT, MD) and ask natural language questions about them. Answers are grounded strictly in your uploaded content — no hallucinations.
Deployed and publicly accessible. Zero cost.
- 📤 Upload documents — drag-and-drop PDF, TXT, or Markdown files
- 🔍 Semantic search — vector similarity search using pgvector + sentence-transformers
- 🤖 Blazing-fast AI answers — powered by Groq API (LLaMA 3.3 70B)
- 📎 Source citations — see exactly which documents were used
- ⚡ Background ingestion — upload returns immediately, processing happens async
- 🗑️ Document management — view status, delete documents and their vectors
- 💬 Chat interface — sleek Q&A with message history
- ☁️ Fully cloud-hosted — accessible from anywhere
| Layer | Technology |
|---|---|
| Backend | Python 3.11 · FastAPI · SQLAlchemy · Gunicorn |
| Embeddings | sentence-transformers (all-MiniLM-L6-v2) |
| LLM | Groq API (LLaMA 3.3 70B Versatile) |
| Vector Search | PostgreSQL + pgvector (cosine similarity) |
| Document Parsing | LangChain community loaders |
| Frontend | React · Vite · Tailwind CSS · Axios |
| Database | Supabase PostgreSQL (metadata + vectors) |
| File Storage | Supabase Storage |
| Backend Hosting | Render / Railway |
| Frontend Hosting | Vercel |
┌─────────────┐ HTTPS ┌──────────────────┐ REST ┌─────────────┐
│ Vercel │ ──────────────▶│ Render/Railway │ ────────────▶│ Groq API │
│ (React UI) │ │ (FastAPI Server) │ │ (LLM) │
└─────────────┘ └──────────────────┘ └─────────────┘
│
│ SQL + pgvector
▼
┌──────────────────┐
│ Supabase │
│ PostgreSQL + │
│ Storage │
└──────────────────┘
- Python 3.11+
- Node.js 18+
- A Groq API key (free)
- A Supabase project (free)
- Create a new Supabase project
- Go to SQL Editor and run:
CREATE EXTENSION IF NOT EXISTS vector; - Create a Storage bucket called
documents(set to public or use service key) - Copy your Project URL, Service Role Key, and Database URI
cd backend
cp .env.example .env
# Fill in your Groq API key and Supabase credentialscd backend
pip install -r requirements.txt
uvicorn main:app --reload --port 8000cd frontend
npm install
npm run dev- App: http://localhost:5173
- API Docs: http://localhost:8000/docs
- Push your repo to GitHub
- Create a new Web Service on Render
- Set Root Directory to
backend - Set Build Command:
pip install -r requirements.txt - Set Start Command:
gunicorn main:app -w 2 -k uvicorn.workers.UvicornWorker --bind 0.0.0.0:$PORT - Add all env vars from
.env.example
- Import your repo to Vercel
- Set Root Directory to
frontend - Set Framework Preset to
Vite - Add env var:
VITE_API_BASE_URL= your Render backend URL
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/documents/upload |
Upload a document |
GET |
/api/documents |
List all documents |
GET |
/api/documents/{id} |
Get document status |
DELETE |
/api/documents/{id} |
Delete a document |
POST |
/api/ask |
Ask a question |
POST |
/api/ask/stream |
Ask with streaming (SSE) |
GET |
/health |
Health check |
├── backend/
│ ├── main.py # FastAPI app entry point
│ ├── config.py # Central configuration (env vars)
│ ├── database.py # SQLAlchemy + pgvector models
│ ├── ingest.py # Document ingestion pipeline
│ ├── retriever.py # pgvector similarity search
│ ├── llm.py # Groq API integration
│ ├── routes/
│ │ ├── documents.py # Upload, list, delete routes
│ │ └── query.py # Q&A routes
│ ├── models/
│ │ └── schemas.py # Pydantic schemas
│ └── utils/
│ └── file_handler.py # Supabase Storage utilities
├── frontend/
│ ├── src/
│ │ ├── App.jsx # Root layout
│ │ ├── components/ # React components
│ │ ├── hooks/ # Custom hooks
│ │ └── api/ # Axios client
│ └── vite.config.js # Vite config
└── README.md
- Streaming responses with SSE (route already scaffolded)
- Conversation memory (pass last N messages to LLM)
- Hybrid search: BM25 keyword + vector search
- Reranking with cross-encoder
- Multiple knowledge bases per user
- JWT authentication
- Document preview panel