Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📄 DocChat — RAG Document Chat with Convex + Vapi

Upload a PDF and chat with it using text or voice.

Stack: React · FastAPI · Convex (vector DB) · OpenAI · Vapi (voice)


Project Structure

rag-doc-chat/
├── convex/          # Convex schema, queries, mutations, actions
├── backend/         # FastAPI — PDF ingestion, embeddings, chat streaming
└── frontend/        # React — Upload UI, Chat UI, Voice UI

Prerequisites


Setup

1. Clone & open in VS Code

cd rag-doc-chat
code .

2. Init Convex

cd frontend
npm install
npx convex dev

Follow the prompts — it creates a free project and gives you a CONVEX_URL.

3. Set environment variables

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=...

4. Create a Vapi Assistant

  • 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

5. Run the backend

cd backend
python -m venv venv
source venv/bin/activate        # Windows: venv\Scripts\activate
pip install -r requirements.txt
uvicorn main:app --reload

6. Run the frontend

cd frontend
npm run dev

Open http://localhost:5173 — upload a PDF and start chatting!


Deploy

Service Platform
Backend Railway (set env vars in dashboard)
Frontend Vercel (set env vars in project settings)
Database Convex Cloud (run npx convex deploy)

About

AI-powered document assistant — upload any PDF and chat with it using text or voice. Built with a full RAG pipeline, Google Gemini 1.5 Flash, and Web Speech API.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages