Skip to main content
RapidDev - Software Development Agency
AI ImplementationsProductivity27 min read

Build a White-Label AI Knowledge Base Tool (RAG-Powered Support Wiki)

Three paths: pay Intercom Fin $0.99/resolution (no white-label), hire RapidDev at $13K–$20K to build a branded RAG knowledge base in 4–6 weeks, or build with Lovable + pgvector + Claude in a weekend for $25 plus $30 in API credits. Research recommends hire-agency — at 20+ daily support resolutions, Intercom Fin's per-resolution markup is $500× over API cost, and no honest white-label SaaS exists in this category.

4.9Clutch rating
600+Happy partners
17+Countries served
190+Team members

Decision matrix

Should you buy, hire, or build it yourself?

Three paths to launch a Knowledge Base Tool, side-by-side. Pick the one that matches your budget, timeline, and how much control you actually need.

Subscribe to Intercom Fin or enterprise alternatives

Buy SaaS
Time to launch
1–2 days
Upfront cost
$0
Monthly cost
$0.99/resolution (Intercom Fin) or enterprise quote
Ownership
Intercom brand on all support surfaces
Customization
Custom bot persona name; no white-label dashboard or client-branded portal

Best for

A single product with fewer than 500 monthly support resolutions that already runs Intercom and doesn't need to white-label the support surface

Risks

  • No honest white-label SaaS in this category exists — Intercom Fin, Decagon, Ada, and Forethought all require the vendor brand to appear in the support interface.
  • Intercom Fin's $0.99/resolution pricing becomes very expensive at scale: 1,000 resolutions/month = $990/month vs. ~$2 in API on Claude Haiku 4.5.
  • Per-resolution cost is unpredictable — a viral product launch or a major bug can spike support volume and your monthly bill simultaneously.
  • Integration with your existing CRM, ticketing system, or customer data platform requires Intercom's API tier, adding further cost and dependency.
Recommended

Hire RapidDev

Hire agency
Time to launch
4–6 weeks
Upfront cost
$13,000–$20,000
Monthly cost
$100–$300 infra
Ownership
You own the code
Customization
Unlimited — your roadmap

Best for

A SaaS founder with 500+ monthly support resolutions who wants to embed a branded AI knowledge base in their own product, or an agency managing support for 5+ clients who needs per-tenant RAG isolation

Risks

  • The reranker integration (Voyage rerank-2.5 or Cohere Rerank 3) adds a week to the build — don't skip it; retrieval quality without reranking is noticeably worse.
  • Multi-tenant RAG requires RLS on both the `documents` and `chunks` tables — misconfiguration leaks one client's knowledge base answers to another client's users.
  • Hallucination mitigation requires explicit prompt engineering ('If the answer is not in the provided context, say so') — the LLM will otherwise invent answers confidently.
  • Ongoing document ingestion pipeline must handle edge cases (PDFs with scanned images, broken Notion exports, encoding errors) that surface only after deployment.

Build with Lovable

Build yourself
Time to launch
1 weekend
Upfront cost
$25 Lovable Pro
Monthly cost
$30–$80 API + $25 Supabase Pro
Ownership
You own the code
Customization
Limited by your Lovable and Supabase skills

Best for

A solo founder or small-team operator who wants a branded support wiki with AI search for their own product, not for resale to multiple clients

Risks

  • Lovable's first attempt at the chunk-then-embed pipeline usually embeds the full document rather than splitting it into 500-token chunks — verify this before ingesting more than 10 documents.
  • pgvector's default `ivfflat` index requires at least 1,000 rows before the index improves performance — add `SET ivfflat.probes = 10` as a query hint during development.
  • Reranker integration is not something Lovable will implement correctly on first pass — use a simpler scoring step (top-3 embedding results, no reranker) for the MVP.
  • The 'answer not found' fallback requires explicit prompt instructions and output parsing — Lovable often generates code that allows the LLM to answer from its training data when the context is sparse.

What a Knowledge Base Tool actually does

Answers customer support questions by searching indexed documentation with embeddings and generating cited, grounded responses using RAG — under your brand, not Intercom's.

A white-label AI knowledge base tool indexes your client's documentation (articles, PDFs, support tickets, Notion exports) into a pgvector database using text-embedding-3-small, then responds to incoming questions by retrieving the most relevant chunks, reranking them with Voyage rerank-2.5, and generating a grounded answer with citations using Claude Sonnet 4.6 or Claude Haiku 4.5 (depending on the tier). The system includes a source-attribution UI ('Based on article: Refund Policy'), an honest fallback when the answer is not in the knowledge base, and a thumbs-up/down feedback loop that feeds retrieval quality improvement over time. The entire pipeline runs as Supabase Edge Functions, with pgvector handling vector similarity search at no additional cost within the Supabase Pro plan.

The market opportunity is stark. Intercom Fin AI charges $0.99/resolution with no white-label option. Decagon and Ada are enterprise-quote-only. Forethought is enterprise-only. Zendesk AI and Freshdesk Freddy are bundled add-ons to large helpdesk platforms, not white-label products. A self-hosted Claude Haiku 4.5 + pgvector setup answers the same question for ~$0.002 — a 500× cost advantage. At 20 daily support resolutions, Intercom Fin costs $594/month; the custom build costs $1.20/month in AI inference. The custom build pays back in under 1 month at that volume.

AI capabilities involved

RAG-grounded Q&A with citations to source articles

Claude Sonnet 4.6 ($3/$15 per M) with prompt cacheClaude Haiku 4.5 ($1/$5 per M)Gemini 3.1 Pro ($2/$12 per M) for 2M-context single-shot RAG

Semantic search across documentation via embeddings

text-embedding-3-small ($0.02/M)voyage-3.5-lite ($0.02/M)gemini-embedding-2 ($0.01/M text)

Retrieval reranking for answer quality improvement

Voyage rerank-2.5 (paid, per-query)Cohere Rerank 3 (paid, per-query)GPT-5.4 nano ($0.20/$1.25 per M) as LLM reranker

Auto-summarization of newly added documents

Claude Haiku 4.5 ($1/$5 per M)GPT-5.4 mini ($0.75/$4.50 per M)DeepSeek V4 Flash ($0.14/$0.28 per M)

Conversation history with relevance feedback loop

text-embedding-3-small ($0.02/M for query re-embedding on thumbs-down)Claude Haiku 4.5 ($1/$5 per M for query reformulation

Who uses this

  • SaaS founders and agencies whose customers need a branded AI helpdesk grounded in the customer's own documentation — not a generic LLM
  • B2B SaaS companies that want to offer AI support as a feature within their product without paying Intercom Fin's per-resolution pricing at scale
  • Customer-success teams at agencies that manage support for 5–20 clients, each with their own knowledge base, who need per-tenant isolation
  • Internal knowledge-management teams at professional-services firms building a branded Q&A system over their own SOPs and methodology documents
  • Martech platforms that want to add AI search over their documentation as a differentiated feature versus competitors using off-the-shelf helpdesk tools

SaaS alternatives on the market

Real products you can sign up for today — with current 2026 pricing, honest pros and cons.

Intercom Fin

Intercom-native SaaS teams with moderate support volume (under 500 resolutions/month) that don't need to white-label the support surface

No

$0.99/resolution (on top of Intercom plan, from $39/seat/mo)

Pros

  • +Best-in-class handoff from AI to human agent — seamlessly escalates unresolved conversations to your support team.
  • +Integrates directly with Intercom's helpdesk, ticketing, and CRM — no separate integration required.
  • +Multi-language support across 43 languages with automatic detection.
  • +Source citations in answers link to the specific help article the answer came from.

Cons

  • No white-label tier — Intercom branding appears on all support widgets and bot personas.
  • Per-resolution pricing is unpredictable and compounds with volume: 1,000/mo = $990, 5,000/mo = $4,950.
  • Requires Intercom as the base platform — if you use Zendesk, Freshdesk, or HubSpot Support, Fin is not an option.
  • Cannot customize the underlying AI model or retrieval strategy — locked into Intercom's proprietary RAG implementation.
At 1,000 resolutions/month, Fin costs $990/month vs. ~$2 in API for equivalent Claude Haiku 4.5 performance — a 495× markup that makes the custom build economics obvious.

Decagon

Enterprise SaaS companies with complex support workflows that need AI agents to take actions, not just answer questions

No

Enterprise quote only

Pros

  • +Deeply agentic — can take actions (process refunds, update accounts) not just answer questions.
  • +Strong reasoning on complex multi-step support queries.
  • +Native integrations with Salesforce, Zendesk, HubSpot, and major CRMs.
  • +SOC 2 Type II certified — suitable for enterprise security reviews.

Cons

  • No white-label tier — Decagon brand on all support surfaces.
  • Enterprise-only pricing with high minimum contract thresholds.
  • Onboarding requires a professional services engagement — not self-serve.
  • Overkill for a product whose support volume doesn't justify an enterprise contract.
No self-serve tier, no white-label, and enterprise-minimum contract — effectively inaccessible for sub-$1M ARR companies.

Forethought

Large enterprise support teams that need AI-assisted triage and routing for human agents, not an end-user-facing RAG chatbot

No

Enterprise quote only

Pros

  • +Strongest intent-detection model for support ticket routing and triaging.
  • +Native integrations with Zendesk, Salesforce, ServiceNow, and Freshdesk.
  • +Workflow automation for ticket summarization, suggested responses, and auto-tagging.
  • +Enterprise-grade analytics on support volume, resolution rates, and AI deflection.

Cons

  • No white-label tier — Forethought brand on all agent-facing surfaces.
  • Enterprise-only pricing — not accessible for teams under 50 agents.
  • Primarily agent-assist focused (showing suggested replies to human agents) rather than end-user-facing RAG chatbot.
  • Requires existing helpdesk platform (Zendesk/Salesforce) to be useful — not standalone.
Forethought is an agent-assist tool, not an end-user chatbot — the architecture, use case, and buyer are completely different from a white-label knowledge base.

The AI stack

A production RAG knowledge base pipeline has five distinct components: document ingestion, chunking, embedding, vector retrieval, and answer generation. The retrieval quality is determined by the combination of embedding model, chunk size, and reranker — not by the generation model, which is comparatively cheap.

01

Document embeddings (retrieval layer)

Converts document chunks into vectors for semantic similarity search

text-embedding-3-small (OpenAI)

$0.02/M tokens

Default embedding layer for all knowledge bases with English-primary documentation

+ Best cost-to-quality ratio for English-language documentation; 1536-dim vectors; negligible cost at knowledge-base scale English-only optimization; weaker on technical jargon-heavy documentation than fine-tuned alternatives

voyage-3.5-lite (Voyage AI)

$0.02/M tokens

Technical SaaS documentation where domain-specific retrieval quality matters

+ Stronger retrieval on technical and domain-specific content; built-in reranking integration with Voyage rerank-2.5 Requires a separate Voyage API key and billing relationship

Gemini 3.1 Pro (2M context, 'single-shot RAG')

$2/$12 per M tokens

MVPs with small knowledge bases where retrieval infrastructure setup time is a bottleneck

+ For small knowledge bases (<500K tokens), you can stuff the entire KB into a single 2M-context call and skip the chunking/retrieval layer entirely Expensive for large knowledge bases; latency increases with context size; not economically viable above 200K tokens of documentation

Our pick: text-embedding-3-small as the default. For knowledge bases with highly technical content (API docs, engineering runbooks), upgrade to voyage-3.5-lite for better domain-specific retrieval precision.

02

Vector database

Stores embedding vectors and enables fast approximate nearest-neighbor retrieval

pgvector on Supabase

Included in Supabase Pro ($25/mo); no additional cost up to ~5M vectors

All builds with fewer than 5M document chunks — covers virtually every knowledge base use case

+ No additional service; SQL-native with RLS for multi-tenant isolation; cosine_distance query in standard SQL Performance degrades above 5M vectors without careful HNSW index tuning

Qdrant Cloud

Free up to 1GB; $9/mo for 4GB; scales to enterprise

Large enterprise knowledge bases with millions of document chunks per tenant

+ Purpose-built for vector search; faster than pgvector at >5M vectors; built-in payload filtering for multi-tenant scoping Additional service to manage; data is outside your Supabase environment

Our pick: pgvector on Supabase for all builds. Only migrate to Qdrant when a single tenant's knowledge base exceeds 2M chunks — which requires hundreds of thousands of documents.

03

Retrieval reranker

Re-scores the top-20 embedding retrieval results to surface the most relevant chunks before passing them to the LLM

Voyage rerank-2.5 (Voyage AI)

Per-query pricing (contact for current rates)

Production knowledge bases where answer quality is the primary selling point

+ Consistently improves retrieval precision by 20–40% over embedding-only search; designed to pair with voyage-3.5-lite embeddings Additional API dependency and cost; not justified for knowledge bases with fewer than 500 documents

Cohere Rerank 3

Per-query pricing (contact for current rates)

Multi-language knowledge bases where documentation spans multiple languages

+ Strong cross-lingual reranking; good for multi-language knowledge bases Slightly less precise than Voyage rerank-2.5 on English-only content

GPT-5.4 nano LLM reranker

$0.20/$1.25 per M tokens

MVP builds that want reranking without adding another API vendor

+ No additional API dependency; can be implemented with a simple prompt asking the model to score each chunk's relevance Slower than dedicated reranking APIs; latency adds to total response time

Our pick: Voyage rerank-2.5 for production builds where quality matters. GPT-5.4 nano LLM reranker for MVPs. Skip reranking entirely only on knowledge bases under 100 documents where all chunks are highly relevant.

04

Answer generation LLM

Generates a grounded, cited answer from the top-k retrieved chunks

Claude Haiku 4.5 (with prompt caching)

$1/$5 per M tokens (cold); $0.10/M cache hit

Default answer generation layer for all tiers — cost is ~$0.002/answer at typical RAG context sizes

+ Best cost for RAG answer generation; prompt cache reduces system-prompt cost by 90% on the static RAG instructions; 200K context handles large retrieved contexts 200K context cap; slightly below Sonnet 4.6 on complex multi-step reasoning over retrieved documents

Claude Sonnet 4.6 (with prompt caching)

$3/$15 per M tokens (cold); $0.30/M cache hit

Premium tier for complex knowledge bases (legal, engineering, clinical) where multi-source synthesis is frequent

+ Better reasoning on complex multi-document questions requiring synthesis across multiple sources; 1M context 5× more expensive than Haiku 4.5 for straightforward factual retrieval

Gemini 3.1 Flash-Lite

$0.25/$1.50 per M tokens

High-volume free tiers where cost is paramount and answer complexity is low

+ Cheapest answer generator; 1M context; free tier available Below Claude models on nuanced answer quality and instruction-following for RAG-specific prompts

Our pick: Claude Haiku 4.5 with prompt caching for the default tier (~$0.002/answer). Claude Sonnet 4.6 for premium plans where complex multi-document synthesis justifies the 5× cost. Cache the RAG system prompt (chunking instructions, citation format, hallucination guardrails) as a single persistent cache block.

Reference architecture

The pipeline has two phases: ingestion (one-time document processing) and inference (per-query retrieval and generation). The ingestion phase is cheap and runs in the background. The inference phase runs on every user query and must return in under 2 seconds — which requires pre-computed embeddings and fast pgvector retrieval. The hardest engineering challenge is preventing hallucination when the knowledge base doesn't contain the answer.

01

Document is uploaded to the knowledge base

React frontend + Supabase Storage

Admin uploads PDF, markdown, HTML, or TXT files to Supabase Storage. File metadata (filename, type, tenant_id, source_url) is inserted into the `documents` table with status='pending'.

02

Document is parsed and chunked

Supabase Edge Function (ingest-document)

The Edge Function downloads the file, extracts text (PDF via pdf-parse, HTML via unfluff, markdown as-is), and splits it into 500-token chunks with 50-token overlap using the tiktoken library. Each chunk is inserted into `document_chunks` (tenant_id, document_id, chunk_index, text, token_count) with status='pending'.

03

Chunks are embedded into vectors

Supabase Edge Function (embed-chunks) — runs in batch

A scheduled job processes pending chunks in batches of 100. Each batch is sent to text-embedding-3-small. The returned 1536-dim vector is written to `document_chunks.embedding` (pgvector column). Status updated to 'indexed'. Supabase auto-generates the HNSW index on the embedding column.

04

Document auto-summary is generated

Supabase Edge Function (summarize-document)

After all chunks are indexed, Claude Haiku 4.5 receives the full document text (up to 100K chars) and generates a 2–3 sentence summary stored in `documents.ai_summary`. This summary is displayed in the admin UI and optionally exposed in the chat widget header.

05

User submits a question in the chat widget

React chat widget → Supabase Edge Function (query-kb)

The user types a question in the embedded chat widget (hosted on your product's domain). The question is posted to the `query-kb` Edge Function along with the tenant_id, session_id, and conversation history (last 3 turns).

06

Query is embedded and retrieval runs

Supabase Edge Function → OpenAI → pgvector

The Edge Function embeds the user question with text-embedding-3-small. It runs a pgvector cosine_distance query against `document_chunks` filtered by tenant_id, returning the top 20 most similar chunks. The top 20 are passed to Voyage rerank-2.5, which returns a re-scored list; the top 5 are selected as context.

07

Claude generates a grounded answer with citations

Supabase Edge Function → Anthropic API

The top 5 chunks, the user question, and the conversation history are sent to Claude Haiku 4.5 with a prompt-cached system prompt containing: 'Answer using only the provided context. If the answer is not in the context, say I don't have information about that in our knowledge base. Always cite the source article title.' The response includes inline citations (Article: [title]) and a hallucination-safe fallback.

08

Answer is returned with source attribution

React chat widget

The chat widget displays the answer with clickable source-article badges below the response text. The conversation is stored in `chat_sessions` for the feedback loop. If the user clicks thumbs-down, the query and retrieved chunks are flagged in `feedback_events` for retrieval quality analysis.

Estimated cost per request

~$0.002 per RAG answer on Claude Haiku 4.5 with cached system prompt (query embed $0.0001 + retrieval free + rerank ~$0.0005 + Haiku answer $0.0014); ~$0.008 on Sonnet 4.6 with cold cache

Cost calculator

Drag the sliders to model your actual usage. The numbers update in real time so you can stress-test economics before writing a single line of code.

Assumes a white-label knowledge base product with per-tenant monthly subscriptions. Defaults model 20 active client tenants with 200 daily queries each. AI cost per query is ~$0.002 — the dominant costs are Supabase hosting and document storage.

20 tenants
1200
200 queries
102,000

Estimated monthly cost

$71.40

$857 per year

Supabase Pro (DB + Auth + pgvector + Storage)$25.00
Vercel Pro (frontend + Edge Functions)$20.00
Monitoring (Sentry + PostHog)$26.00
text-embedding-3-small (query embedding per query)$0.02
Voyage rerank-2.5 (per query rerank, ~20 chunks)$0.10
Claude Haiku 4.5 (answer generation, cache hit)$0.28
Fixed: $71.00/moVariable: $0.40/mo

Calculator notes

  • At 20 tenants × 200 queries/day × 30 days = 120,000 queries/mo at $0.002 each = $240/mo in AI costs against $71 fixed infra.
  • Intercom Fin comparison: 120,000 queries at $0.99/resolution = $118,800/mo vs. $240/mo — the economics only work this dramatically because Fin charges per resolution, not per query attempt.
  • Document ingestion cost is one-time per document: ~$0.0001 per 500-token chunk (embedding). A 100-page knowledge base = ~200 chunks = $0.02 total ingestion cost.
  • Prompt caching on the RAG system prompt (assuming 90% cache hit rate at active tenants) reduces answer generation cost from $0.005/query cold to ~$0.0014/query — budget the cold-cache cost for the first query of each session.

Build it yourself with vibe-coding tools

By Sunday evening you'll have a working Lovable app where admins upload documents, AI indexes them into pgvector, and end users ask questions and get cited answers — all under your brand, on your domain.

Time to MVP

12–16 hours (1 weekend)

Total cost to MVP

$25 Lovable Pro + $30 Anthropic + $0 OpenAI (embedding free tier)

You'll need

Lovable Pro account ($25/mo)Supabase project with pgvector extension enabled (run `CREATE EXTENSION vector` in SQL editor)OpenAI API key for text-embedding-3-smallAnthropic API key for Claude Haiku 4.5 (answer generation)Optional: Voyage AI account for reranking (upgrade path)

Starter prompt

Lovable Prompt

Build a white-label AI knowledge base (RAG-powered support wiki) using Vite + React + Supabase + Tailwind CSS with these pages: 1. AUTH: Supabase email/password login. Users belong to a `tenant_id` in their profile. Two roles: 'admin' (can manage documents) and 'viewer' (can only chat). 2. ADMIN DOCUMENT MANAGER (/admin/documents): Admins can upload PDF, TXT, and Markdown files (drag-and-drop or file picker). Each uploaded file appears in a list with columns: filename, status (pending/indexing/indexed/failed), document_count (chunk count), ai_summary (auto-generated), and uploaded_at. A 'Delete' button removes the document and all its chunks. Clicking a document shows a preview panel with the ai_summary and a list of its chunks. 3. EDGE FUNCTION (ingest-document): Accepts a document_id. Downloads the file from Supabase Storage. Extracts text (for PDF, use the pdf-parse npm package; for MD/TXT, read as string). Splits text into 500-character chunks with 50-character overlap. Inserts each chunk into the `document_chunks` table (tenant_id, document_id, chunk_index, text). Calls OpenAI text-embedding-3-small API with each chunk (batch up to 100 at a time). Stores the returned embedding vector in `document_chunks.embedding` (vector(1536) pgvector column). After all chunks are embedded, calls Claude Haiku 4.5 with the first 5,000 chars of the document to generate a 2-sentence summary. Stores the summary in `documents.ai_summary`. 4. CHAT WIDGET PAGE (/chat or embeddable as a web component): A clean chat interface with a message input, send button, and message thread. User messages appear on the right; AI responses on the left with source attribution badges below each response (showing the document title the answer came from). An 'I don't have information about that in our knowledge base' fallback message when no relevant chunks are found. 5. EDGE FUNCTION (query-kb): Accepts: question (string), tenant_id, session_id, conversation_history (last 3 turns array). Steps: (a) embed the question with text-embedding-3-small, (b) run pgvector cosine_distance query: SELECT text, document_id FROM document_chunks WHERE tenant_id = $tenant_id ORDER BY embedding <=> $query_embedding LIMIT 5, (c) fetch document titles for the returned document_ids, (d) call Claude Haiku 4.5 with system prompt: 'You are a support assistant. Answer using ONLY the context below. If the answer is not in the context, say exactly: I don\'t have information about that in our knowledge base. Always cite the source at the end as Source: [document title].' Include the retrieved chunks and conversation history. Return the answer text and an array of source document titles. 6. FEEDBACK: Each AI response has thumbs-up/thumbs-down buttons. On thumbs-down, insert a row in `feedback_events` (session_id, question, chunks_used, response, tenant_id). Show a simple feedback count on the admin page. All tables need RLS: document_chunks and documents filtered by tenant_id. Admins can insert/delete; viewers can only SELECT their tenant's chunks via the Edge Function (not directly).

Paste this into Lovable

Follow-up prompts (run in order)

  1. 1

    Add multi-tenant support so each client gets their own isolated knowledge base. Add a `tenants` table (name, slug, plan, created_at). The admin document manager shows only this tenant's documents. The chat widget URL includes the tenant slug (e.g., /chat/acme-corp). The query-kb Edge Function uses the tenant_id from the URL param — validate it against the `tenants` table before running any queries. Tenant admins can only see and manage their own documents.

  2. 2

    Add a reranking step to the query-kb Edge Function. After retrieving the top 20 chunks via pgvector, implement a simple LLM reranker: call GPT-5.4 nano with a prompt asking 'Rate the relevance of each of these 20 text chunks to the question on a scale of 1-10. Return a JSON array of {chunk_index, score}.' Sort by score descending and pass only the top 5 chunks to Claude Haiku for answer generation. Log whether the reranker changed the top-5 selection in the `query_logs` table for analysis.

  3. 3

    Add a 'Related Questions' feature at the bottom of each chat response. After Claude generates an answer, make a second call to Claude Haiku 4.5 asking: 'Based on this question and context, suggest 3 related follow-up questions the user might ask. Return as a JSON array of strings.' Display these as clickable chips below the AI response. Clicking a chip sends it as the next user message.

  4. 4

    Add an analytics dashboard for admins at /admin/analytics. Show: (1) total queries this month per day as a line chart, (2) top 10 most-asked questions (from query_logs), (3) thumbs-down rate this month as a percentage, (4) most-cited documents (which document titles appear most in source attributions from query_logs). Use a simple Recharts bar/line chart library for visualizations.

  5. 5

    Add Stripe billing for white-label resellers. Create a Billing page showing the current plan (Free: 1 tenant, 100 queries/day; Pro: $49/mo, 5 tenants, 2,000 queries/day; Agency: $149/mo, unlimited tenants). Implement plan-based rate limiting in the query-kb Edge Function: check the tenant's plan and query count for today against the limit. Return a 429 with message 'Daily query limit reached — upgrade your plan' when exceeded. A Stripe Checkout integration allows upgrading directly from the Billing page.

Expected output

A working branded AI support wiki where admins upload documents, AI indexes them in under 60 seconds per document, and end users receive cited answers to their questions — with a 'not found' fallback that prevents hallucination.

Known gotchas

  • !Lovable's first attempt at the pgvector query will use the wrong SQL syntax for cosine distance — the correct operator is `<=>` for cosine_distance in pgvector, not `<->` (which is L2 distance). Verify the generated SQL before testing.
  • !The pgvector HNSW index must be created after the extension is enabled: `CREATE INDEX ON document_chunks USING hnsw (embedding vector_cosine_ops)` — without this, cosine_distance queries run as full table scans and will timeout above 10,000 chunks.
  • !Claude Haiku 4.5 will hallucinate if the context chunks are sparse relative to the question — the hallucination guardrail prompt (`Answer using ONLY the context below`) must be in the system prompt, not the user message, to reliably prevent this behavior.
  • !Supabase Edge Functions have a 150MB memory limit and a 60-second execution timeout — large PDF ingestion (50+ pages) can exceed the timeout. Break the ingest into two separate calls: one for text extraction and chunking, one for embedding.
  • !The tenant_id scoping in the pgvector query is critical for multi-tenant isolation — Lovable frequently generates a query that embeds the tenant filter as a WHERE clause on the document_chunks table but misses adding the same filter when joining to `documents` for the source title lookup.
  • !OpenAI's text-embedding-3-small has a maximum input length of 8,191 tokens — chunks exceeding this will fail silently (OpenAI truncates them). Add a pre-check to ensure no chunk exceeds 500 tokens before embedding.

Compliance & risk reality check

A knowledge base tool indexes and serves customer-facing content. The main compliance risks are hallucination liability for incorrect support answers, GDPR on indexed customer data, and HIPAA if the tool is used in healthcare support contexts.

Important

Hallucination liability for support answers

When an AI knowledge base gives a confidently wrong answer (e.g., 'Your refund will arrive in 3 days' when the actual policy says 14 days), the customer may rely on that answer and suffer financial harm. This is a product liability risk even if your ToS disclaims accuracy. The hallucination rate on Claude Haiku 4.5 with strong RAG guardrails is ~2–5% on well-indexed knowledge bases.

Mitigation: Implement two mandatory safeguards: (1) 'Answer using ONLY the provided context' in the system prompt with explicit instructions to return 'I don't have information about that' when context is insufficient; (2) always surface source citations so users can verify answers against original articles. Add an 'Escalate to human' button visible on every response for queries the AI answers with low confidence.

Critical

GDPR Article 17 right-to-erasure on indexed customer data

If your knowledge base indexes support tickets, chat transcripts, or other customer-generated content containing personal data (names, emails, order IDs), those records are subject to GDPR erasure requests. When a customer requests deletion of their data, you must delete not only the source ticket but also all document chunks derived from it, plus the embedding vectors for those chunks.

Mitigation: Implement a document deletion cascade: when a document is deleted from `documents`, a database trigger must also delete all rows in `document_chunks` with the matching document_id. Test this cascade with a real deletion before indexing any personal data. For indexed support tickets, store the original ticket ID in the `documents` table so deletion requests can be matched to indexed documents.

Important

SOC 2 for enterprise buyers

Enterprise SaaS buyers (5,000+ employee companies) routinely require SOC 2 Type II certification before approving a new knowledge base or support tool. SOC 2 requires documented access controls, change management, incident response, and availability monitoring. Without it, you will fail most enterprise security reviews.

Mitigation: Supabase Pro is SOC 2 Type II compliant (covering the database layer). Vercel is SOC 2 Type II compliant (covering the frontend). Anthropic's API has enterprise security documentation. For the full SOC 2 audit, use a tool like Vanta ($12,000–$20,000/yr) to automate evidence collection and prepare for the Type II audit, which takes 6–12 months.

Critical

HIPAA if used in healthcare support contexts

A knowledge base tool used by healthcare organizations to answer patient questions about appointments, medications, or clinical procedures processes PHI (Protected Health Information). This requires a HIPAA BAA with every vendor in the stack — Anthropic (via AWS Bedrock), Supabase (BAA on Team plan), and Cloudflare.

Mitigation: Do not market this tool for healthcare support without first routing Claude through AWS Bedrock (which has a cloud-level HIPAA BAA) and executing a BAA with Supabase on their Team plan. Disable the conversation history logging feature (which stores PHI) unless you implement HIPAA-compliant data retention and access controls.

Build vs buy: the real math

4–6 weeks

Custom build time

$13,000–$20,000

One-time investment

1–3 months

Breakeven vs buying

At 600 support resolutions/month, Intercom Fin costs $594/month with no white-label option. A Claude Haiku 4.5 + pgvector custom build at the same volume costs ~$24/month in AI inference ($0.002 × 600 × 20 clients). A $15K RapidDev build pays back in 26 months from subscription revenue alone — but the comparison is wrong: the real question is whether you're replacing an existing Intercom Fin spend. If you're currently paying $594/mo for Fin, the custom build pays back in 3 months from savings, plus you gain a product asset worth far more than the build cost. As model prices fall (Claude Haiku already dropped 67% from Haiku 3.5 to 4.5), the per-query cost will continue to decrease, making the margin advantage wider every quarter.

Skip the DIY — RapidDev builds the production version

A Lovable MVP gets you a demo. Production needs auth that doesn't leak data, AI calls that don't bankrupt you, observability when models drift, and code you can audit. That's what we ship.

1

Discovery call (free)

30 min

We map your exact Knowledge Base Tool use case: who uses it, target volume, AI model choice, integrations, compliance scope. You get a detailed scope document and fixed-price quote within 48 hours.

2

AI-accelerated build

4–6 weeks

Our engineers use Claude Code, Lovable, and custom tooling to ship 3–5x faster than agencies. You see weekly progress in a staging environment — not a black box.

3

Launch + handoff

1 week

We deploy to your infrastructure, transfer the GitHub repo, set up CI/CD and monitoring, and train your team. You own 100% of the source code, prompts, and model configurations.

What you get

Full source code (GitHub repo)
Deployed on your infrastructure
Audited prompts & model configs
Cost monitoring + budget alerts
3 months of bug-fix support
Direct Slack channel with engineers

Timeline

4–6 weeks

Investment

$13,000–$20,000

vs SaaS

ROI in 1–3 months

Get your free estimate

30-min call. Fixed-price quote within 48 hours. No commitment.

Frequently asked questions

How much does it cost to build a white-label AI knowledge base tool?

A RapidDev custom build runs $13,000–$20,000 for a 4–6 week project covering multi-tenant document ingestion, pgvector chunking and embedding, Voyage reranking, Claude Haiku 4.5 answer generation with hallucination guardrails, source attribution UI, feedback loop, and Stripe billing. A Lovable DIY build costs $25 Lovable Pro plus ~$30 in Anthropic API credits for the first month, with no reranking layer.

How long does it take to ship a RAG-powered knowledge base product?

A Lovable MVP with document upload, pgvector indexing, and AI Q&A with citations takes one weekend — roughly 12–16 hours including setup. A RapidDev production build with multi-tenant isolation, reranking, feedback analytics, and Stripe billing takes 4–6 weeks. The reranker integration (Voyage rerank-2.5) adds 3–4 days but improves answer relevance by 20–40% — it is worth the time.

How does RAG prevent the AI from making up answers?

RAG (Retrieval-Augmented Generation) constrains the AI to answer only from the documents you've indexed. The system prompt contains an explicit instruction: 'Answer using ONLY the provided context below. If the answer is not in the context, say I don't have information about that in our knowledge base.' Claude Haiku 4.5 follows this instruction reliably when the guardrail is in the system prompt. Without this constraint, the LLM will answer from its training data and produce confident but wrong answers.

What is the difference between a knowledge base and a document management system?

A knowledge base (this page) is answer-oriented: users ask natural-language questions and get cited AI answers. A document management system (DMS) is storage-and-workflow oriented: it organizes documents with version control, access permissions, e-signatures, and retention policies. A knowledge base is a great first product; a DMS is what you build when clients need structured document workflows on top of the search layer.

Can RapidDev build this for my SaaS product or agency?

Yes. RapidDev has shipped 600+ production applications including RAG-based AI products with multi-tenant document isolation. The standard knowledge base build at $13K–$20K includes document ingestion, pgvector semantic search, Voyage reranking, Claude Haiku 4.5 generation with hallucination guardrails, source attribution UI, conversation history, thumbs-down feedback loop, and Stripe subscription billing. Book a free 30-minute consultation at rapidevelopers.com.

How do I keep client knowledge bases isolated from each other in a multi-tenant product?

Every Supabase table (`documents`, `document_chunks`, `chat_sessions`) has a `tenant_id` column with an RLS policy that restricts SELECT, INSERT, UPDATE, and DELETE to rows where `tenant_id` matches the authenticated user's workspace ID. The pgvector cosine_distance query includes `WHERE tenant_id = $tenant_id` as a mandatory filter before the embedding similarity sort. Without both of these safeguards, one client's knowledge base content can appear in another client's AI answers.

How should I handle questions the AI can't answer from the knowledge base?

The AI should return the exact message 'I don't have information about that in our knowledge base' rather than attempting to answer from training data. Below this message, display three options: 'Search our help articles' (keyword search fallback), 'Contact support' (links to your support email or ticket form), and optionally 'Ask the team' (creates a support ticket with the unanswered question pre-filled). Log all unanswered queries in `feedback_events` so you can identify documentation gaps and add new articles.

RapidDev

Want the production version?

  • Delivered in 4–6 weeks
  • You own 100% of the code
  • AI cost monitoring built in
Get a free estimate

30-min call. No commitment.

Matt Graham

Written by

Matt Graham · CEO & Founder, RapidDev

1,000+ client projects delivered. Columbia University & Harvard Business School alumnus, U.S. Navy veteran. About the author →

Want this built for you?

We ship production apps at a fixed price — $13K–$25K, 6–10 weeks, source code yours. You've seen what it takes; we do it every week.

Get a fixed-price quote

We put the rapid in RapidDev

Need a dedicated strategic tech and growth partner? Discover what RapidDev can do for your business! Book a call with our team to schedule a free, no-obligation consultation. We'll discuss your project and provide a custom quote at no cost.