Tenant isolation by design
A tenant identifier on every record, enforced by PostgreSQL row-level security, with a separate vector namespace per tenant for the AI knowledge base.
CASE STUDY · MULTI-TENANT SAAS
A multi-tenant SaaS combining a CRM, an AI agent with a knowledge base, and WhatsApp automation, built so each customer’s data stays strictly their own.
A SaaS product needs more than a customer database and an AI chat window. Each business needs its own workspace, its own knowledge and reliable follow-up, all on a shared platform. This project brings those capabilities together with tenant isolation designed into the system.
A strong fit for: Founders and product teams building a shared CRM, AI-assisted customer service or WhatsApp-led SaaS product for multiple businesses.
Many business customers needed to use one product at the same time: a CRM to manage leads, an AI assistant that answers from each customer’s own knowledge, and WhatsApp as a main channel to their own customers. The hard part was not any single feature. It was keeping every customer’s data, conversations and AI knowledge completely separate on one shared system, and handing a conversation to a person when the AI should not answer.
A tenant identifier on every record, enforced by PostgreSQL row-level security, with a separate vector namespace per tenant for the AI knowledge base.
Role-based access control so each user sees only what their role allows.
Leads from every channel flow into pipelines, with duplicate detection so the team does not chase the same person twice.
Retrieval-augmented answers drawn only from the customer’s own content, with a clean hand-off to a person when the AI should not answer.
Approved message templates, Meta webhooks and an omnichannel inbox, so the team handles every channel in one place.
Workflow automation, inbound and outbound webhooks, a REST API and a SOAP/XML adapter that connects a legacy ERP.
ARCHITECTURE & IMPLEMENTATION
How the documented stack supports the business workflow, from the application layer to integrations and operational controls.
Python · FastAPI / Django · Celery · Redis
The application combines APIs with asynchronous processing for automation. Background work supports follow-up sequences and integrations, while the system exposes REST endpoints and inbound and outbound webhooks.
PostgreSQL RLS · tenant_id · Role-based access · MFA / SSO
Every table carries a tenant identifier, with row-level security enforcing data boundaries. Role-based permissions and MFA / SSO form part of access control. The architecture must preserve the same boundaries across the user interface, APIs and background processing.
LangChain / LlamaIndex · Qdrant / pgvector · RAG
Each tenant has a separate vector namespace. The AI agent retrieves knowledge from PDFs, websites and Q&A, with strict grounding. Negative sentiment or a customer request can trigger a hand-off to a human agent.
WhatsApp Business API · Meta webhooks · Kanban pipelines
Approved message templates and real-time webhooks connect WhatsApp conversations to a unified agent inbox. Custom fields, duplicate detection and lead pipelines support the operational CRM workflow around those conversations.
React / Next.js · Tailwind · Docker · SOAP / XML adapter
The web application provides the customer-facing workspace. A SOAP / XML adapter connects a legacy ERP, and Docker is part of the delivery stack. The product connects existing business systems with the new SaaS experience.
An illustrative walkthrough of the capabilities described in this project.
If you are building a product for several customers, or adding AI and WhatsApp to a business system, the decisions that matter most are made early: how data is separated, how AI answers stay within each customer’s knowledge, and how a human takes over. This project shows that work handled end to end by one senior architect. See the related article, how to build a multi-tenant SaaS without leaking customer data.
Client details are withheld. The diagram is a simplified, generic illustration and contains no client data.
BUILD A SYSTEM AROUND YOUR BUSINESS
If you want to turn a business workflow into a SaaS product, the foundation matters: who can see what, how AI uses customer knowledge and what happens when a person needs to take over. I can design and implement those foundations alongside the features your customers will use.
Share who your customers are, what they need to manage and how AI or WhatsApp fits the service. We can define a first product milestone with tenant isolation and the core workflow in scope.
Work directly with Itzhak Shaul, founder of Methodspire and Principal Software Architect with 30+ years of hands-on experience. Start with a focused conversation about the workflow, constraints and delivery scope.
Discuss a similar systemEmail me about your project