All projects

Open source Case study

Multi-Tenant RAG Chatbot

RAG chatbot platform backend

Live GitHub
Role
Author
Type
Open source
Stack
  • Python
  • FastAPI
  • Qdrant
  • BM25
  • PostgreSQL
  • Sentence Transformers
RAG chatbot platform backendMulti-Tenant RAG Chatbot

Backend for a SaaS where organizations create chatbots trained on their own documents and websites, then embed them on their sites. Each organization is fully isolated.

The problem

Organizations want a chatbot that knows their content, sits on their website and never leaks data between customers.

What I built

A FastAPI backend with a RAG engine: hybrid search over each organization’s knowledge, source attribution on every answer, and SaaS plumbing for teams, keys, limits and billing.

Retrieval pipeline
  1. 01IngestPDF, DOCX, sites
  2. 02EmbedMiniLM, local
  3. 03Hybrid searchQdrant + BM25
  4. 04RRF mergeThreshold, dedupe
  5. 05AnswerWith sources

Highlights

  • 01

    Hybrid search + RRF

    Qdrant vector similarity and BM25 keyword search merged with Reciprocal Rank Fusion, then thresholded and de-duplicated.

  • 02

    Ingestion & crawling

    PDF, DOCX, TXT and Markdown uploads plus website crawling with sitemap discovery and robots.txt compliance.

  • 03

    Multi-tenant SaaS

    Tenant-isolation middleware, RBAC, JWT and API keys, usage limits per plan, audit log and analytics.

  • 04

    Embeddable widget

    A chat widget served per bot with domain allow-listing, plus billing through Lemon Squeezy.