---
title: "Multi-Tenant RAG With One Neon Project Per User"
description: "A multi-tenant RAG pipeline for a CRM isolates each organization's contacts and embeddings in a dedicated Neon Postgres project, created via the Neon API and looked up per workspace to build connection strings on the fly."
url: "https://swe.quest/articles/multi-tenant-rag-with-one-neon-project-per-user-1e3d2bef0a9ab277"
canonical: "https://neon.com/blog/multi-tenant-rag"
source: "Neon"
published: "2024-11-19"
difficulty: "medium"
kind: "How-to"
reading_minutes: 6
tags: ["multi-tenancy","rag","postgres","resilience","typescript"]
---

# Multi-Tenant RAG With One Neon Project Per User

A post on [Neon](https://swe.quest/sources/neon.md), published 2024-11-19, 6 min read, How-to. Original: [https://neon.com/blog/multi-tenant-rag](https://neon.com/blog/multi-tenant-rag)

## Summary

A multi-tenant RAG pipeline for a CRM isolates each organization's contacts and embeddings in a dedicated Neon Postgres project, created via the Neon API and looked up per workspace to build connection strings on the fly. Noisy-neighbor and cost risks from rate-limited SERP and OpenAI calls are handled with Inngest workflows keyed by workspace ID: enrichment is throttled to 10 executions per 10 seconds per workspace, and embeddings are batched up to 100 documents per workspace before insertion into that tenant's vector store. Code samples cover project provisioning, tenant connection lookup, and the throttle and batch configuration.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Multi-tenancy](https://swe.quest/tags/multi-tenancy.md) (Architecture & design)
- [RAG & retrieval](https://swe.quest/tags/rag.md) (AI & ML)
- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)
- [Resilience](https://swe.quest/tags/resilience.md) (Distributed systems)
- [TypeScript](https://swe.quest/tags/typescript.md) (Languages)

## Prerequisites

- RAG pipelines ([easy posts on RAG & retrieval](https://swe.quest/tags/rag.md?difficulty=easy))
- PostgreSQL basics ([easy posts on PostgreSQL](https://swe.quest/tags/postgres.md?difficulty=easy))
- TypeScript/Next.js ([easy posts on TypeScript](https://swe.quest/tags/typescript.md?difficulty=easy))

## Keywords

Neon, Inngest, OpenAI, Next.js, pgvector, SERP API

## Related posts

- [Neon for Agent Platforms: A Companion Skill for the AI Agent Program](https://swe.quest/articles/neon-for-agent-platforms-a-companion-skill-for-the-ai-agent-program-6b42423040c5c41e.md): Neon · 2026-05-22 · Medium · 3 min read · PostgreSQL, Multi-tenancy, AI agents, Cloud platforms
  neon-for-agent-platforms is an open-source companion Agent Skill and set of TypeScript scripts for running fleets of Neon Postgres databases on agent platforms.
- [Inside LuBot's database-per-tenant architecture](https://swe.quest/articles/inside-lubot-s-database-per-tenant-architecture-3e140bf0d5ffcd96.md): Neon · 2026-09-14 · Medium · 5 min read · Multi-tenancy, PostgreSQL, Serverless, System design
  LuBot, a solo-founder analytics chat product, gives each paying customer an isolated Postgres database by creating a Neon branch from a Stripe webhook, with Supabase kept as the control plane for orgs, users and billing.
- [Inside a Kylon room, where people and agents build apps on Neon](https://swe.quest/articles/inside-a-kylon-room-where-people-and-agents-build-apps-on-neon-7c02cd9384e86f37.md): Neon · 2026-11-04 · Easy · 5 min read · PostgreSQL, AI agents, Multi-tenancy, Serverless, Schema migrations
  Kylon, a shared workspace where teams and AI agents build internal apps like CRMs and invoice trackers, maps its product directly onto Neon resources: one Neon project per workspace, one database per app, and one branch per draft.
- [The Noisy Neighbor Problem in Multitenant Architectures](https://swe.quest/articles/the-noisy-neighbor-problem-in-multitenant-architectures-3c851a6c15e7f85b.md): Neon · 2025-04-03 · Easy · 8 min read · Multi-tenancy, PostgreSQL, Serverless, Cloud platforms
  Noisy neighbors in a shared Postgres instance such as AWS RDS degrade performance for every tenant through CPU saturation, work\_mem and shared\_buffers pressure, disk I/O contention on EBS, exhaustion of max\_connections, and lock contention from long transactions.
- [Building an AI-powered ChatBot using Vercel, OpenAI, and Postgres](https://swe.quest/articles/building-an-ai-powered-chatbot-using-vercel-openai-and-postgres-4fd423473384581f.md): Neon · 2023-03-09 · Medium · 13 min read · RAG & retrieval, PostgreSQL, Vector search, LLMs, Serverless
  A ChatGPT-style documentation assistant (Ask Neon) is built by storing OpenAI text-embedding-ada-002 vectors in Postgres with pgvector, retrieving context by cosine distance, and feeding it to text-davinci-003 from a Vercel Edge Function.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
