Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Neon 5 min read Case study mediumAdept

Inside LuBot's database-per-tenant architecture

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. Branches get deterministic names so webhook retries are idempotent; the new branch is migrated, its connection URL is stored on the user row, and all access goes through a single tenant resolver function. Tenant computes autoscale from 0.25 to 4 CU and suspend after 300 seconds idle, avoiding roughly $20/month per idle tenant. Behind PgBouncer transaction-mode pooling, session settings like search_path do not persist, so set them per query or at the role level, use direct URLs for migrations, and reset connections on check-in.

Assumes: PostgreSQL schemasconnection poolingwebhooks

Related posts

  • Database-per-User Architecture With Shared Application Environments: How and Why

    Neon mediumAdept

    A single shared application environment serving many per-customer Neon Postgres databases keeps deployment simple, but every tenant database must stay at the same schema version and data residency is hard to offer. Tenant identification can come from a login field, a per-customer subdomain, or a lookup from the user's credentials. A catalog database maps users or JWT-carried customer IDs to Neon project IDs for connection routing, and it also holds tier and feature-flag context. Schema changes need either slow, backward-compatible rollouts using views and triggers, or pre-upgrade testing of each tenant database on branches. The control plane should be kept separate from the app so failures don't take both down.

  • A database per agent: how Turso and Neon give different answers

    Turso easyNovice

    Neon and Turso both support a database per agent but differ in the unit: Neon gives each agent a Postgres project with its own autoscaling compute that suspends after 5 minutes idle and is billed by CU-hour, while Turso treats each SQLite-compatible database as a file managed by a shared server, billed by rows read/written and storage with unlimited databases on paid plans. For bursty agent workloads with many mostly idle databases, Turso avoids per-database compute clocks and adds per-database BYOK encryption, BYOC, on-device sync, and BEGIN CONCURRENT writes (about 9,500 TPS at 64 connections in 0.8). Neon remains better for branching a full production backend per agent, and Supabase Postgres is the recommended fit for Postgres-specific needs or storage-heavy, rarely queried data.

  • The Noisy Neighbor Problem in Multitenant Architectures

    Neon easyNovice

    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. Within RDS, the mitigations range from per-tier statement_timeout values, PgBouncer connection quotas per tenant and application-level rate limiting, to schema-per-tenant throttling, up to full database-per-tenant isolation, which is costly and operationally heavy. Neon's pitch is a project per tenant: storage is shared while each tenant gets isolated compute that autoscales and scales to zero, which makes per-tenant isolation affordable.

  • One Postgres, a database per user, or both?

    Turso easyNovice

    Choosing between one Postgres database, a Turso database per user, or both comes down to where data must live, who owns it, and how many features need to read across users. Early-stage web apps default to a single Supabase Postgres with row-level security and a self-hosting exit. Local-first apps like Sample Vault give each user a Turso database synced to their machine, which provides isolation by construction and data ownership if the product disappears. Hybrid apps use Supabase to govern accounts, auth and storage while per-user Turso databases hold user data. Because database-per-user is "a bet against cross-user features", teams should list every cross-user read before adopting it; the agent delegation case shows the cost, since delegated tasks must be copied into a central database.

  • How Cedalio uses Neon for an efficient development workflow

    Neon easyNovice

    Cedalio, an ESG data verification startup, moved from DynamoDB to Postgres and picked Neon over RDS for a simpler API and console. GitHub Actions creates a Neon database branch and a Fly.io app instance for each PR, then deletes both after merge, and scale-to-zero keeps these temporary environments cheap. A one-database-per-customer design gives tenant isolation. Their backend reads the Postgres WAL, bundles and encrypts operations, stores them optionally on IPFS or Arweave, and commits a hash to a client-owned smart contract for tamper-evident auditing.

The quest for software engineering knowledge.

Look:
Layout: