React portfolio frontend + FastAPI RAG backend.
This repository now includes end-to-end wiring between the frontend chat widget and the RAG backend:
- Frontend chat widget calls
POST /chatandPOST /suggestions - Local Vite development uses
/apiproxy tohttp://localhost:8000 - Docker/Nginx uses
/apireverse proxy to backend service on the Compose network
frontend-v2/: React + TypeScript + Vite app, served by Nginx in Dockerrag-backend/: FastAPI app for chat, RAG retrieval, suggestions, and metricsdocker-compose.yml: Runs both services together
- Node.js 20+
- Python 3.10+
- Docker Desktop (optional, for containerized run)
- OpenAI API key
- Pinecone API key and index
Copy the backend environment file and fill in real values:
cp rag-backend/.env.example rag-backend/.envRequired values:
OPENAI_API_KEYPINECONE_API_KEYPINECONE_INDEX_NAME
Optional values:
PINECONE_NAMESPACE(default:resume-v1)CORS_ORIGINS- Rate limit and logging settings in
rag-backend/app/config.py
Place resume PDF at:
rag-backend/data/resume.pdf
Then ingest vectors:
cd rag-backend
python -m venv .venv
# Windows PowerShell
.venv\Scripts\Activate.ps1
# macOS/Linux
# source .venv/bin/activate
pip install -r requirements.txt
python scripts/ingest_resume.pyTerminal 1 (backend):
cd rag-backend
.venv\Scripts\Activate.ps1 # Windows
# source .venv/bin/activate # macOS/Linux
uvicorn app.main:app --reload --port 8000Terminal 2 (frontend):
cd frontend-v2
npm install
npm run devOpen:
- Frontend:
http://localhost:5173 - Backend docs:
http://localhost:8000/docs
How wiring works in local dev:
- Frontend calls
/api/* - Vite proxy rewrites
/api/chat->http://localhost:8000/chat
docker compose up --buildOpen:
- Frontend:
http://localhost:8080 - Backend:
http://localhost:8000 - Backend docs:
http://localhost:8000/docs
How wiring works in Docker:
- Frontend bundle uses
VITE_API_BASE_URL=/api - Nginx proxies
/api/*tohttp://backend:8000/*
-
POST /chat- Request:
{ "sessionId": "uuid-or-any-stable-id", "message": "Tell me about your projects" } - Response:
{ "reply": "..." }
- Request:
-
POST /suggestions- Request:
{ "last_user_message": "Tell me about projects", "conversation_summary": null } - Response:
{ "suggestions": ["...", "..."] }
- Request:
-
POST /rag/search(debug retrieval endpoint) -
GET /metricsandGET /metrics/json -
GET /info
- Chat UI:
frontend-v2/src/components/Console.tsx - Chat styles:
frontend-v2/src/components/Console.module.css - API client:
frontend-v2/src/services/chatApi.ts - Vite proxy:
frontend-v2/vite.config.ts - Docker build arg:
docker-compose.yml - Nginx API proxy:
frontend-v2/nginx.conf
- Start backend and frontend.
- Open the site and click
Ask AI Assistant. - Send a question like:
What are Yazhini's core skills? - Confirm assistant response appears.
- Confirm suggestions chips appear below messages.
- If backend env vars are missing,
/chatreturns server errors by design. - CORS defaults are configured in backend config for common localhost ports.
- For production, set
VITE_API_BASE_URLandCORS_ORIGINSto your deployed domains.