You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What does Neon offer, and where could it fit Patchy Cloud? We hold substantial Neon credits, so where it fits we want to use it — but fit comes first. Establish from primary sources (neon.com/docs, the API reference, the @neondatabase/* packages and the Neon CLI source): the concepts (project, branch, compute, database, role) and their limits; the platform API for programmatic creation — project-per-company versus branch-per-company versus schema-per-company for tenant isolation, with the limits and cost of each; branching for dev, test, per-PR and per-worktree databases, and what a local dev story looks like against Neon (Neon Local / proxy, versus a hermetic local Postgres); scale-to-zero behaviour and cold-start latency; Neon Auth (what it is, how it stores users and sessions, whether it belongs anywhere near our identity plans); the Data API and row-level security; the Neon MCP server; the serverless driver versus pg and what that means for @effect/sql-pg; pricing units and what our credits buy; regions and compliance.
Evaluate four fits: (a) the production database with per-company data isolation; (b) a Patchy-native database patches can use — including whether tier 1 patches could reach it with the user's identity through the Data API and RLS; (c) dev and test databases per worktree or PR in the local dev story; (d) the Effect v4 port's Postgres story. State plainly what it cannot do.
Output: docs/research/neon.md on branch research/neon. Waits on it: Company and tenancy, Integration layer, Local dev environment, Chart the Effect v4 port map.
Research written to docs/research/neon.md on branch research/neon (not merged, per #5). Every factual claim was re-checked against the cited Neon pages, the OpenAPI spec, the npm registry and the Effect 4 source on 2026-08-26; corrections were committed in af9078b.
Summary
Neon is ordinary Postgres (14–18) with storage split from compute, sold per organization on Free / Launch / Scale plans plus an invite-only Agent plan for platforms; it has been part of Databricks since May 2025 and is now branded "Lakebase Postgres" alongside beta Auth, Functions, Object Storage and AI Gateway services [51][1][3].
The unit of isolation Neon actually supports is the project: created by API in under a second, region-fixed, with its own quotas, history window and connection endpoints; an idle project costs nothing for compute (suspended computes accrue no CU-hours) and $0.35/GB-month for whatever it stores [42][5][1][2].
Branches are a versioning primitive, not a tenancy one: copy-on-write children of a parent, 10 (Launch) or 25 (Scale) included per project then $1.50/branch-month, archived once older than 14 days and untouched for 24 hours with a hard cap of 100 unarchived per project on paid plans, sharing the project's history window and quotas [1][9][7].
Fit (a) — production DB: yes. One Neon project for Patchy's own store now, company scoped in-schema (company id column + policies), keeping project-per-company for the "dedicated instances later" promise because that is exactly the model Neon's platform API, per-project quotas and Agent plan are built for. Branch-per-company is the wrong shape and is ruled out below.
Fit (b) — Patchy-native DB for patches: viable, as beta. The Data API (PostgREST-compatible, per branch, per database) validates JWTs from any JWKS URL we register, switches to the authenticated Postgres role, and exposes only auth.user_id() (= sub) to RLS policies — so a browser-side tier 1 patch can hit it with a Patchy-issued token, but company scoping must be derivable from sub, and the Data API is Beta, off-limits with IP Allow / Private Networking, and outside HIPAA [27][29][30][48].
Neon Auth is not our identity system. "Managed Better Auth" (Beta, AWS only) stores users and sessions in a neon_auth schema in our database per branch, issues 15-minute EdDSA JWTs with no custom claims, and has a partial organizations plugin (owner/admin/member only, no teams) — useful as a JWKS-issuing reference point, unfit as the source of truth for companies and cross-company membership [21][24][25].
Fit (c) — dev/test databases: split verdict. Neon branches are a good fit for per-PR CI (official GitHub Actions, schema-only branches with no production data, expires_at TTL up to 30 days) [56][64][8][10]. Per-worktree local dev is not what Neon Local is: it is a Docker proxy that needs an API key, internet and a cloud project, and creates a real branch per container. Keep a hermetic local Postgres (or PGlite) for the inner loop [56][8][10][20].
Fit (d) — Effect v4: nothing Neon-specific.@effect/sql-pg 4.0.0-rc.112 is built on pg (new Pg.Pool, pg-cursor streams, a second pg.Client for LISTEN), and Neon's own guidance for long-lived Node servers is plain pg over TCP; the serverless driver is only for edge runtimes and its HTTP mode has no interactive transactions, so it cannot back sql-pg at all [59][60][17][19].
Scale-to-zero suspends after 5 minutes (fixed on Free, disable-able on Launch, 1 min–always-on on Scale), wakes in "a few hundred milliseconds" (longer after 7+ idle days), and drops every session — LISTEN/NOTIFY, advisory locks, temp tables, prepared statements — which the port must design around [11][12][15].
Pooled connections are PgBouncer transaction mode (10,000 clients, pool 0.9 × max_connections), so SET, LISTEN/NOTIFY and session advisory locks — including the advisory lock our migrator takes — need the direct endpoint [16][62].
Credits: Neon bills per CU-hour ($0.106 Launch/Agent, $0.222 Scale), GB-month storage ($0.35), extra branches, instant-restore history ($0.20/GB-month), and egress beyond 500 GB/project; the startup program's credits last 12 months from acceptance, the Agent plan adds up to $25,000 and needs an active Scale plan plus approval. Which program our credits sit on, and their expiry, is the first open question [1][2][50][3].
Regions and compliance: eight AWS regions (two in the EU), Azure deprecated, region fixed at project creation; SOC 2 Type 2, ISO 27001/27701, GDPR, CCPA; HIPAA, IP Allow, PrivateLink and an uptime SLA only on Scale [45][47][48][1].
Open questions
Which program our credits come from (startup program, Agent plan, promo), how much remains, when they expire, and which organization they are attached to — plans and credits are per organization, and the Agent plan requires an active Scale plan plus approval [2][50][3].
Whether the Data API exposes any JWT claim beyond sub to policies (PostgREST proper sets request.jwt.claims; Neon documents only auth.user_id()). Needs a five-minute experiment on a scratch project before designing company-scoped policies [29].
Region: Frankfurt/London versus a US region is decided at project creation and cannot be changed; the Company-and-tenancy ticket should say whether residency is a per-company promise [45].
Whether @effect/sql-pg's pg-cursor streaming and separate LISTEN client work over the serverless driver's WebSocket Pool; only needed if the server moves to an edge runtime [19][59].
Extra-branch pricing on the Agent plan (1,000 branches per project, overage unstated) and the management-API rate limit at fleet scale [3].
Logical replication: the compatibility page says wal_level=logical is "coming soon" while the API and CLI expose enable_logical_replication today — check before promising CDC-style integrations [15][39][54].
Activity
allisonmahmood commentedon Aug 26, 2026
Resolution
Research written to
docs/research/neon.mdon branchresearch/neon(not merged, per #5). Every factual claim was re-checked against the cited Neon pages, the OpenAPI spec, the npm registry and the Effect 4 source on 2026-08-26; corrections were committed inaf9078b.Summary
authenticatedPostgres role, and exposes onlyauth.user_id()(=sub) to RLS policies — so a browser-side tier 1 patch can hit it with a Patchy-issued token, but company scoping must be derivable fromsub, and the Data API is Beta, off-limits with IP Allow / Private Networking, and outside HIPAA [27][29][30][48].neon_authschema in our database per branch, issues 15-minute EdDSA JWTs with no custom claims, and has a partial organizations plugin (owner/admin/member only, no teams) — useful as a JWKS-issuing reference point, unfit as the source of truth for companies and cross-company membership [21][24][25].expires_atTTL up to 30 days) [56][64][8][10]. Per-worktree local dev is not what Neon Local is: it is a Docker proxy that needs an API key, internet and a cloud project, and creates a real branch per container. Keep a hermetic local Postgres (or PGlite) for the inner loop [56][8][10][20].@effect/sql-pg4.0.0-rc.112 is built onpg(new Pg.Pool,pg-cursorstreams, a secondpg.Clientfor LISTEN), and Neon's own guidance for long-lived Node servers is plainpgover TCP; the serverless driver is only for edge runtimes and its HTTP mode has no interactive transactions, so it cannot backsql-pgat all [59][60][17][19].max_connections), soSET,LISTEN/NOTIFYand session advisory locks — including the advisory lock our migrator takes — need the direct endpoint [16][62].Open questions
subto policies (PostgREST proper setsrequest.jwt.claims; Neon documents onlyauth.user_id()). Needs a five-minute experiment on a scratch project before designing company-scoped policies [29].@effect/sql-pg'spg-cursorstreaming and separate LISTEN client work over the serverless driver's WebSocketPool; only needed if the server moves to an edge runtime [19][59].wal_level=logicalis "coming soon" while the API and CLI exposeenable_logical_replicationtoday — check before promising CDC-style integrations [15][39][54].docs(whats-new): pages published from one HTML file can run script (#…