Production-ready RAG chatbot platform — build, embed, and manage AI-powered bots with your own knowledge base.
Built from day one to handle thousands of users and bots without breaking a sweat — MongoDB Atlas connection pooling, Redis-backed Bull queues, per-IP rate limiting, gzip/brotli compression, and a horizontally scalable architecture that grows with you. AES-256 encrypted key storage, Firebase JWT auth, and a sharp neo-brutalism dashboard — deploy to Vercel + Render in under 10 minutes.
| Service | URL | Status |
|---|---|---|
| Frontend | rag-host.vercel.app | Vercel |
| Backend API | raghost-pcgw.onrender.com | Render |
The backend may take 30–60 seconds to wake from sleep on Render's free tier.
| Dashboard | Bot Configuration |
|---|---|
![]() |
![]() |
| Manage all your AI bots from one place | Powerful bot setup with templates |
| Knowledge Base | Widget Customizer V2 |
|---|---|
![]() |
![]() |
| Upload & manage documents for RAG | Live-preview widget with 9 customisation tabs |
| Analytics Dashboard | Embed & Deploy |
|---|---|
![]() |
![]() |
| Real-time metrics & performance tracking | One-click embed code for any website |
- Screenshots
- What is RAGHost?
- Features
- Tech Stack
- Architecture
- Getting Started
- Environment Variables
- Running the App
- Deployment
- API Reference
- Security
- Contributing
- License
- Contact
RAGHost is a full-stack platform for building and deploying Retrieval-Augmented Generation (RAG) chatbots. Upload documents (PDF, TXT, DOCX, Markdown), connect your Pinecone index and Gemini API key, and get an embeddable chat widget you can drop on any website in seconds.
No infra management required — deploy the frontend to Vercel and the backend to Render with the included config files. Start free, scale when you need to — the architecture supports the journey from 1 user to 100,000+.
Engineered for large user bases — the entire backend is designed with scale in mind:
| Layer | What scales it |
|---|---|
| Database | MongoDB Atlas with 2–50 connection pooling; add replica sets for read scaling |
| Caching | Redis helpers (getCachedData / setCachedData) reduce DB hits for hot data |
| Async jobs | 3 Bull queues (chat · embedding · analytics) offload heavy work off the request thread |
| Auth | Firebase Authentication — scales to millions of users, zero maintenance |
| Vector search | Pinecone — fully managed, scales to billions of vectors |
| API protection | Per-IP rate limiting on every endpoint prevents abuse at any traffic level |
| Transport | gzip/brotli compression cuts bandwidth 70–90% under load |
| Clustering | ENABLE_CLUSTERING=true spawns one worker per CPU core |
Redis and Bull queues activate automatically when REDIS_URL is set. Without it, the app runs synchronously — same code, zero config changes needed.
- Create multiple bots, each with its own knowledge base, system prompt, color theme, and API keys
- Per-bot Pinecone + Gemini key storage (AES-256 encrypted at rest)
- Collapsible sidebar dashboard — toggle between full and icon-only modes, state persisted across sessions
- Upload PDF, TXT, DOCX, and Markdown files per bot
- Documents chunked, embedded, and stored in your Pinecone index
- Live upload progress tracking; reprocess or delete individual documents
- Copy-paste HTML, React, Vue, or Vanilla JS embed snippets directly from the dashboard
- Cloud-backed embed code version history (stored in MongoDB, restore any previous version)
- A/B test copy generator — generate and compare multiple widget headline variants
- Widget config options:
botName,color,position,width,height,showAvatar,responsive, and more
- Per-bot and global message count, session count, and user metrics
- Activity over time visualized with Chart.js line charts
- Top-performing bots leaderboard
- Edit display name and avatar (12 gradient presets)
- Preferences synced to MongoDB
- Account security — change Firebase password from within the app
- Danger zone — full account deletion
- Designed for large user bases — multi-layer architecture ensures the platform stays fast as your user count and bot count grow
- MongoDB connection pooling — 2–50 configurable connections; supports Atlas replica sets for horizontal read scaling
- Redis caching layer (
config/redis.js) —getCachedData/setCachedData/deleteCachedPatternreduce database pressure for frequently accessed data - Three Bull queues auto-start with Redis:
chat-processing(50 jobs/s, exponential retry),embedding-processing(async doc chunking & vectorisation),analytics-processing(non-blocking metric writes) - CPU clustering —
ENABLE_CLUSTERING=truespawns one worker per core; double the cores, double the throughput - Per-IP rate limiting on every endpoint (configurable via env vars) — protects at any traffic scale
- gzip/brotli compression (70–90% payload reduction), code-split React bundles (~200 KB gzipped)
- Low-memory mode (
ENABLE_LOW_MEMORY=true) fits 512 MB free tier; remove the flag and the same code runs on a 16 GB production server
- Firebase Authentication (email/password)
- Password visibility toggle on all auth forms
- Rate limiting, Helmet.js headers, CORS whitelist, input sanitization
- AES-256 encryption for stored API keys
- Built-in 6-tab documentation view in the dashboard (Quick Start / Widget / API / Config / Examples / Help)
- FAQ accordion with common troubleshooting answers
- Terminal-style code blocks for all integration examples
| Technology | Version | Purpose |
|---|---|---|
| React | 18.2 | UI framework |
| Vite | 5.x | Build tool |
| TailwindCSS | 3.x | Styling (neo-brutalism design system) |
| react-chartjs-2 + Chart.js | 5.x / 4.x | Analytics charts |
| Lucide React | latest | Icons |
| Firebase SDK | 10.x | Authentication client |
| React Router | 6.x | Client-side routing |
| Technology | Version | Purpose |
|---|---|---|
| Node.js | 18+ | Runtime |
| Express | 4.x | HTTP server |
| MongoDB / Mongoose | 7.x | Primary database |
| Firebase Admin SDK | 12.x | JWT verification |
| Pinecone SDK | latest | Vector search |
| Google Gemini AI | latest | LLM + embeddings |
| Multer | 1.x | File uploads |
| pdf-parse + Mammoth | latest | Document parsing |
| Helmet + Compression | latest | Security & performance |
| Redis (Upstash) | 7+ | Session caching, rate-limit state, Bull queue backend |
| Bull | 4.x | Async job queues (document processing) |
+------------------------------------------------------------------+
| RAGHost Platform |
| |
| +-----------------+ +----------------------------------+ |
| | Frontend | | Backend (Express) | |
| | React + Vite |<-->| | |
| | TailwindCSS | | +----------+ +-------------+ | |
| | | | | Auth | | Knowledge | | |
| | Dashboard | | |(Firebase)| | Base API | | |
| | Chat Widget | | +----------+ +-------------+ | |
| | Analytics | | +----------+ +-------------+ | |
| | Documentation | | | Bot | | Chat | | |
| +-----------------+ | | Manager | | API | | |
| | +----------+ +-------------+ | |
| +-----------------+ +----------------------------------+ |
| | Embed Widget | | | |
| | (Any Website) | +---------v---+ +-----v--------------+ |
| +-----------------+ | MongoDB | | Vector Database | |
| | (Atlas) | | (Pinecone) | |
| +-------------+ +--------------------+ |
| | |
| +----------v----------+ |
| | Google Gemini AI | |
| | (LLM + Embeddings) | |
| +---------------------+ |
+------------------------------------------------------------------+
- Node.js 18+ and npm
- MongoDB Atlas account (free tier works)
- Firebase project with Authentication enabled
- Pinecone account and index (1536 dimensions, cosine metric — must match Gemini
gemini-embedding-001) - Google Gemini API key
# Clone the repository
git clone https://github.com/pavankumar-vh/RAGHost.git
cd RAGHost
# Install backend dependencies
cd backend && npm install
# Install frontend dependencies
cd ../frontend && npm installWhen creating your Pinecone index, use these exact settings:
| Setting | Value | Why |
|---|---|---|
| Dimensions | 1536 | Gemini gemini-embedding-001 output size |
| Metric | cosine | Best for semantic similarity search |
| Pod type | Starter (free) | Sufficient for most use cases |
Warning: Using any dimension other than 1536 will cause uploads to appear successful but queries will return no results.
NODE_ENV=development
PORT=5001
MONGODB_URI=mongodb+srv://<user>:<password>@cluster.mongodb.net/raghost
FIREBASE_PROJECT_ID=your-project-id
FIREBASE_CLIENT_EMAIL=firebase-adminsdk@your-project.iam.gserviceaccount.com
FIREBASE_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"
# Generate with: npm run generate-key
ENCRYPTION_KEY=your-64-char-hex-key
# Comma-separated allowed origins
CORS_ORIGINS=https://your-frontend.vercel.app,http://localhost:5173
RATE_LIMIT_WINDOW_MS=900000
RATE_LIMIT_MAX_REQUESTS=100
ENABLE_COMPRESSION=true
ENABLE_LOW_MEMORY=false
# Redis (optional) — enables Bull queues + caching helpers when set
# Get a free URL from https://upstash.com/ (format: rediss://default:<pw>@<host>:<port>)
# Omit entirely to run synchronously without cache
REDIS_URL=cd backend && npm run generate-key- Firebase Console → Project Settings → Service Accounts
- Click Generate New Private Key and copy values to
.env
VITE_API_URL=http://localhost:5001
VITE_FIREBASE_API_KEY=AIzaSy...
VITE_FIREBASE_AUTH_DOMAIN=your-project.firebaseapp.com
VITE_FIREBASE_PROJECT_ID=your-project-id
VITE_FIREBASE_STORAGE_BUCKET=your-project.appspot.com
VITE_FIREBASE_MESSAGING_SENDER_ID=123456789
VITE_FIREBASE_APP_ID=1:123456789:web:abcdefGet values from Firebase Console → Project Settings → General → Your Apps.
# Terminal 1 — Backend (http://localhost:5001)
cd backend && npm run dev
# Terminal 2 — Frontend (http://localhost:5173)
cd frontend && npm run devcd frontend && npm run build # output: frontend/dist/
cd backend && npm start # or npm run start:low-memory for 512 MBcd frontend && npx vercel --prodOr use the dashboard: import repo → Root Directory frontend → Build npm run build → Output dist → add VITE_* env vars → Deploy.
New Web Service → connect repo → Build: cd backend && npm install → Start: cd backend && npm start → add env vars → Deploy.
Free tier (512 MB): set ENABLE_LOW_MEMORY=true and start with cd backend && npm run start:low-memory.
Development: http://localhost:5001
Production: https://raghost-pcgw.onrender.com
# Dashboard endpoints (Firebase JWT)
Authorization: Bearer <firebase_jwt_token>
# External API v1 endpoints (API key)
X-API-Key: rh_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# Bots
GET /api/bots
POST /api/bots
GET /api/bots/:id
PUT /api/bots/:id
DELETE /api/bots/:id
# Chat (public)
POST /api/chat/:botId/message
GET /api/chat/:botId/history/:sessionId
# Knowledge Base
POST /api/knowledge/:botId/upload
GET /api/knowledge/:botId
DELETE /api/knowledge/:botId/:docId
POST /api/knowledge/:botId/:docId/reprocess
# Analytics
GET /api/analytics/overview
GET /api/analytics/daily?days=30
GET /api/analytics/top-bots?limit=5
GET /api/analytics/bot/:botId?days=7
# Keys
GET /api/keys/:botId
POST /api/keys/:botId
# Widget
GET /api/widget/:botId/embed-codeUse RAGHost as a backend for your own custom UI. No widget or theme required — just API key authentication.
- Create a bot in the RAGHost dashboard
- Go to API Keys → External API Keys → Generate Key
- Choose scopes:
query(chat),upload(document upload), or both - Copy the key (starts with
rh_) — it's shown once
curl -X POST https://your-backend/api/v1/query \
-H "Content-Type: application/json" \
-H "X-API-Key: rh_your_key_here" \
-d '{"message": "What is your refund policy?", "sessionId": "user-123"}'Response:
{
"success": true,
"data": {
"response": "Our refund policy allows returns within 30 days...",
"sessionId": "user-123",
"responseTime": 1230,
"contextUsed": 4,
"tokensUsed": 285
}
}curl -X POST https://your-backend/api/v1/documents/upload \
-H "X-API-Key: rh_your_key_here" \
-F "document=@./docs/faq.pdf"# Key management (Firebase auth — from dashboard)
POST /api/v1/keys # Generate API key for a bot
GET /api/v1/keys/:botId # List keys for a bot
DELETE /api/v1/keys/:keyId # Revoke a key
# Headless query (API key auth, scope: query)
POST /api/v1/query # Send message, get AI response
# Headless document upload (API key auth, scope: upload)
POST /api/v1/documents/upload # Upload PDF/DOCX/TXT/MD/CSV
GET /api/v1/documents/status/:jobId # Check processing progress
GET /api/v1/documents # List documents in knowledge base| Endpoint | Limit | Window |
|---|---|---|
| General API | 100 req | 15 min |
| Chat | 30 msg | 1 min |
| Knowledge upload | 50 uploads | 15 min |
| Auth | 10 attempts | 15 min |
{ "success": false, "error": "message", "code": "ERROR_CODE" }| Layer | Implementation |
|---|---|
| Authentication | Firebase JWT, per-request validation |
| API key storage | AES-256 encryption |
| Transport | HTTPS + HSTS (Helmet.js) |
| Rate limiting | Per-IP on all endpoints |
| CORS | Explicit whitelist only |
| Input | Schema validation + sanitization |
| XSS / injection | Helmet headers + Mongoose ODM |
- Fork →
git checkout -b feat/your-feature - Commit:
git commit -m "feat: add X"(Conventional Commits) - Push → open Pull Request
Commit types: feat · fix · docs · style · refactor · test · chore
MIT — see LICENSE.
Pavan Kumar VH · @pavankumar-vh · rag-host.vercel.app
Google Gemini AI · Pinecone · Firebase · MongoDB Atlas · Vercel · Render · Chart.js · TailwindCSS





