Upload a PDF and chat with it using text or voice.
Stack: React · FastAPI · Convex (vector DB) · OpenAI · Vapi (voice)
rag-doc-chat/
├── convex/ # Convex schema, queries, mutations, actions
├── backend/ # FastAPI — PDF ingestion, embeddings, chat streaming
└── frontend/ # React — Upload UI, Chat UI, Voice UI
cd rag-doc-chat
code .cd frontend
npm install
npx convex devFollow the prompts — it creates a free project and gives you a CONVEX_URL.
backend/.env (copy from .env.example)
OPENAI_API_KEY=sk-...
VAPI_API_KEY=...
CONVEX_URL=https://....convex.cloud
frontend/.env (copy from .env.example)
VITE_CONVEX_URL=https://....convex.cloud
VITE_BACKEND_URL=http://localhost:8000
VITE_VAPI_API_KEY=...
VITE_VAPI_ASSISTANT_ID=...
- Go to vapi.ai → Assistants → Create
- Set webhook URL:
http://localhost:8000/vapi-webhook(or your deployed backend URL) - Copy the Assistant ID into
frontend/.env
cd backend
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
uvicorn main:app --reloadcd frontend
npm run devOpen http://localhost:5173 — upload a PDF and start chatting!
| Service | Platform |
|---|---|
| Backend | Railway (set env vars in dashboard) |
| Frontend | Vercel (set env vars in project settings) |
| Database | Convex Cloud (run npx convex deploy) |