<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/inside-lubot-s-database-per-tenant-architecture-ov8nljmhn" -->

---
title: Inside LuBot's database-per-tenant architecture | daily.dev
description: A solo founder built LuBot, a business-analytics chat product, using Neon's branching API to give every paying customer an isolated Postgres database. Supabase...
canonical: https://daily.dev/posts/inside-lubot-s-database-per-tenant-architecture-ov8nljmhn
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Inside LuBot's database-per-tenant architecture | daily.dev
og:description: A solo founder built LuBot, a business-analytics chat product, using Neon's branching API to give every paying customer an isolated Postgres database. Supabase...
og:url: https://daily.dev/posts/inside-lubot-s-database-per-tenant-architecture-ov8nljmhn
og:image: https://api.daily.dev/og/posts/Ov8nLJmhn.png
og:image:alt: Inside LuBot's database-per-tenant architecture
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Inside LuBot's database-per-tenant architecture

**[Neon](https://daily.dev/sources/neontech)** · 5 min read · 5 upvotes · 0 comments

## Summary

A solo founder built LuBot, a business-analytics chat product, using Neon's branching API to give every paying customer an isolated Postgres database. Supabase remains the control plane for admin data (organizations, users, billing), while Neon holds tenant data provisioned automatically at Stripe checkout via a webhook that creates a deterministic-named branch, runs schema migrations, and stores the connection URL. Neon's serverless autoscaling (0.25 CU floor, 4 CU burst ceiling, suspend after 300 seconds idle) keeps idle tenants nearly free. The piece also covers pitfalls of pooled connections in PgBouncer transaction mode, notably that search_path settings do not persist across pooled connections, requiring per-query search_path settings and using direct connections for migrations. The whole tenant-resolver setup took six days to build, versus an estimated quarter for a traditional Postgres setup.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://neon.com/blog/inside-lubots-database-per-tenant-architecture>

## Questions this post answers

### Why does my search_path setting disappear on a pooled Postgres connection using PgBouncer transaction mode?

Transaction mode pooling does not preserve session state, so any SET search_path issued in one transaction is discarded once the connection returns to the pool. The next query can land on a different pooled connection with a different search_path, making tables in other schemas appear missing even though the database is healthy. The fix is to set search_path per query or at the role level rather than once per session, and to reset connections on check-in.

_Developers debugging multi-schema tenant setups can save these pooling gotchas for reference on daily.dev._

### How can I provision an isolated Postgres database per customer at checkout without months of infrastructure work?

Using Neon's branching API, a Stripe webhook triggered at checkout can create a copy-on-write Postgres branch with a deterministic name, run schema migrations against it, and store the connection URL against the user row, so the customer's next request routes to their own isolated database. One solo founder built this entire flow in six days, versus an estimated quarter of work for a traditional per-tenant Postgres setup.

_Teams weighing database-per-tenant designs can track real implementation timelines like this on daily.dev._

### How much does an idle per-tenant Postgres database cost with Neon's autoscaling versus a traditional always-on setup?

Without autoscaling and scale-to-zero, a single idle tenant database would cost about $20 a month; with Neon's serverless compute, idle tenants suspend after 300 seconds of inactivity and become practically free, since only storage remains billed. A common configuration bursts from a 0.25 CU active floor up to a 4 CU ceiling only when needed, keeping costs viable on a bootstrap budget.

_Founders costing out multi-tenant infrastructure can compare autoscaling tradeoffs like these on daily.dev._

## Similar posts on daily.dev

- [Inside a Kylon room, where people and agents build apps on Neon](https://daily.dev/posts/inside-a-kylon-room-where-people-and-agents-build-apps-on-neon-jrqtuhair) · Neon · 0 upvotes · 0 comments
- [How Neon's lakebase architecture stays resilient to cloud failures](https://daily.dev/posts/how-neon-s-lakebase-architecture-stays-resilient-to-cloud-failures-j7quhswdh) · Neon · 6 upvotes · 0 comments
- [Integrating Postgres and Auth the Easy Way: Daisy’s Neon Setup](https://daily.dev/posts/integrating-postgres-and-auth-the-easy-way-daisy-s-neon-setup-2kwtolnxo) · Neon · 0 upvotes · 0 comments

---

Tags: [#database](https://daily.dev/tags/database), [#postgresql](https://daily.dev/tags/postgresql), [#multi-tenancy](https://daily.dev/tags/multi-tenancy)

[View this post on daily.dev](https://daily.dev/posts/inside-lubot-s-database-per-tenant-architecture-ov8nljmhn)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Inside LuBot's database-per-tenant architecture","url":"https://daily.dev/posts/inside-lubot-s-database-per-tenant-architecture-ov8nljmhn","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/inside-lubot-s-database-per-tenant-architecture-ov8nljmhn"},"datePublished":"2026-09-14T14:51:44.743Z","dateModified":"2026-09-14T14:52:11.572Z","description":"A solo founder built LuBot, a business-analytics chat product, using Neon's branching API to give every paying customer an isolated Postgres database. Supabase...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/58fccd966d386d3dedf77abb1defecf1?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/58fccd966d386d3dedf77abb1defecf1?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Neon","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Neon","logo":"https://media.daily.dev/image/upload/s--65EDghou--/f_auto/v1724339118/logos/neontech","url":"https://daily.dev/sources/neontech"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/inside-lubot-s-database-per-tenant-architecture-ov8nljmhn","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":5},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"database,postgresql,multi-tenancy","timeRequired":"PT5M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Neon","item":"https://daily.dev/sources/neontech"},{"@type":"ListItem","position":3,"name":"Inside LuBot's database-per-tenant architecture"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/inside-lubot-s-database-per-tenant-architecture-ov8nljmhn#faq","mainEntity":[{"@type":"Question","name":"Why does my search_path setting disappear on a pooled Postgres connection using PgBouncer transaction mode?","acceptedAnswer":{"@type":"Answer","text":"Transaction mode pooling does not preserve session state, so any SET search_path issued in one transaction is discarded once the connection returns to the pool. The next query can land on a different pooled connection with a different search_path, making tables in other schemas appear missing even though the database is healthy. The fix is to set search_path per query or at the role level rather than once per session, and to reset connections on check-in. Developers debugging multi-schema tenant setups can save these pooling gotchas for reference on daily.dev."}},{"@type":"Question","name":"How can I provision an isolated Postgres database per customer at checkout without months of infrastructure work?","acceptedAnswer":{"@type":"Answer","text":"Using Neon's branching API, a Stripe webhook triggered at checkout can create a copy-on-write Postgres branch with a deterministic name, run schema migrations against it, and store the connection URL against the user row, so the customer's next request routes to their own isolated database. One solo founder built this entire flow in six days, versus an estimated quarter of work for a traditional per-tenant Postgres setup. Teams weighing database-per-tenant designs can track real implementation timelines like this on daily.dev."}},{"@type":"Question","name":"How much does an idle per-tenant Postgres database cost with Neon's autoscaling versus a traditional always-on setup?","acceptedAnswer":{"@type":"Answer","text":"Without autoscaling and scale-to-zero, a single idle tenant database would cost about $20 a month; with Neon's serverless compute, idle tenants suspend after 300 seconds of inactivity and become practically free, since only storage remains billed. A common configuration bursts from a 0.25 CU active floor up to a 4 CU ceiling only when needed, keeping costs viable on a bootstrap budget. Founders costing out multi-tenant infrastructure can compare autoscaling tradeoffs like these on daily.dev."}}]}
```

