A privacy-first, multi-user chat app built with FastAPI + React + Groq. It streams LLM responses in real time, persists conversation history, and is architected for easy extension into RAG and vector-store workflows.
| Feature | Why It Matters |
|---|---|
| Super-fast inference | Powered by Groq — sub-second token generation across a wide range of Llama and open models. |
| Multi-user, multi-session | Switch between users and conversations for different use cases; UUID-based sessions keep everything isolated. |
| Real-time streaming | Server-Sent Events (SSE) deliver assistant responses word-by-word, no polling needed. |
| Persistent history | Every message is saved locally in SQLite via SQLAlchemy — durable, portable, and easy to backup. |
| Privacy by design | Only API calls leave the machine. No chat data is fed back to Groq or any third party for training. |
| RAG / Vector-ready | Clean service layer and schema make it straightforward to plug in embeddings and a vector DB later. |
| Docker + cloud ready | One-command Docker deployment and Terraform scaffolding for GCP. |
Prerequisites: Python 3.11+, Node.js 18+, a Groq API key.
# 1. One-time setup
cd Chatbot
.\setup.ps1 # creates venv, installs deps, sets up .env
# 2. Start backend
.\run-backend.ps1
# 3. Start frontend (new terminal)
.\run-frontend.ps1Open http://localhost:5173.

# Backend
cd backend
..\venv\Scripts\Activate.ps1
uvicorn app.main:app --reload --port 8000
# Frontend
cd frontend
npm run devEdit .env in the project root:
GROQ_API_KEY=gsk_your_actual_key
GROQ_MODEL=llama-3.3-70b-versatile # swap for any Groq-supported model
DATABASE_URL=sqlite:///./chatbot.dbdocker compose up --build- UI: http://localhost:5173
- API: http://localhost:8000
- API docs: http://localhost:8000/docs
| Method | Path | Description |
|---|---|---|
GET |
/health |
Health check |
GET |
/chat/users |
List users |
GET |
/chat/users/{id}/conversations |
List user conversations |
GET |
/chat/{session_id}/history |
Load messages |
POST |
/chat/{session_id}/stream |
Send message, stream SSE response |
DELETE |
/chat/{session_id} |
Clear conversation |
Chatbot/
├── backend/ # FastAPI + SQLAlchemy + Groq
│ ├── app/
│ │ ├── main.py
│ │ ├── database.py
│ │ ├── models.py
│ │ ├── schemas.py
│ │ ├── core/config.py
│ │ ├── routers/chat.py
│ │ └── services/groq_service.py
│ └── requirements.txt
├── frontend/ # React + Vite
│ ├── src/
│ │ ├── App.jsx
│ │ ├── components/
│ │ └── services/api.js
│ └── package.json
├── docker-compose.yml
├── terraform/ # GCP secret manager scaffold
└── .env
- Closed system: Chats are stored locally in your own SQLite database.
- No data leakage: Messages are sent only to Groq for inference; they are not used to train or improve models.
- Self-hostable: Run it entirely on your machine, a VPS, or your own cloud project.
The modular structure makes it easy to add:
- Vector DB / RAG: plug in embeddings and a vector store for semantic search over chat history or documents.
- Auth layer: add JWT or OAuth to protect user sessions.
- Additional models: switch models via
GROQ_MODELor add a model-selection UI. - Export / import: backup conversations to JSON or markdown.
- Frontend: http://localhost:5173
- Swagger docs: http://localhost:8000/docs
- Health check: http://localhost:8000/health └── .env.example