Start with the runtime, not a copied connection string
Drizzle’s Supabase guide confirms that the ORM can connect to a Supabase Postgres database. The connection mode depends on where the code runs. A string copied from a tutorial may point at the wrong endpoint or assume network support your host does not have.
Use the selector below to locate the relevant documentation. It does not inspect your project or validate credentials.
Executed local example · 28 October 2026
A successful query does not prove safe access
Using the same Drizzle query, our synthetic two-tenant database first returned both tenants’ rows. Enabling row-level security with a tenant policy restricted those reads. But running as the table owner still exposed all rows until forced RLS was enabled. A privileged BYPASSRLS role continued to bypass the policy.
14 of 14 expected outcomes observed. This is a small reproducible example, not a security certification or a score for either product. Denied writes and zero-row updates are successful checks here because denial was the expected result.
| Case | Observed result | Check |
|---|---|---|
| 1. Grants, RLS off | Both rows visible | Expected outcome observed |
| 2. RLS on, no policy | No rows visible | Expected outcome observed |
| 3. Tenant A read | Only A’s row | Expected outcome observed |
| 4. Tenant B read | Only B’s row | Expected outcome observed |
| 5. Own insert | New A row returned | Expected outcome observed |
| 6. Cross-tenant insert | Denied: 42501 | Expected outcome observed |
| 7. Cross-tenant update | Zero rows updated | Expected outcome observed |
| 8. Reassign row tenant | Denied: 42501 | Expected outcome observed |
| 9. Cross-tenant delete | Zero rows deleted | Expected outcome observed |
| 10. Table owner | All three rows visible | Expected outcome observed |
| 11. Owner with FORCE RLS | No rows visible | Expected outcome observed |
| 12. BYPASSRLS role | All three rows visible | Expected outcome observed |
| 13. Aborted transaction | Inserted row rolled back | Expected outcome observed |
| 14. Other tenant intact | B’s original body unchanged | Expected outcome observed |
Download the runnable local example
The ZIP contains the source, exact dependency lockfile, README and actual results. Tested with Node v25.6.1, Drizzle ORM 0.45.4 and PGlite 0.5.13 running PostgreSQL 18.6 in WebAssembly. Install the pinned dependencies, then run npm test. No hosted account or paid API is needed.
What this tells you before choosing a connection
An ORM constructs queries; the database role and policies determine access. Test the role your application really uses. A successful admin query does not validate an end-user policy, and a successful UPDATE can affect zero rows.
What remains untested
The fixture compares a tenant column with PostgreSQL current_user. It does not reproduce Supabase auth.uid(), JWT handling, the Data API, service keys, poolers, concurrency or a live deployment. The rollback case aborts one local transaction; it is not a migration rehearsal. Keep browser, ordinary-user and privileged server paths separate and validate each in your own authorized environment.
PostgreSQL role and RLS rules · Drizzle’s PGlite driver · PGlite local runtime · Supabase’s separate authentication and RLS guidance
Edited by Clinton Feyisitan · Review scope: Local fixture executed; four official documentation pages read 28 October 2026. Source receipts and limits.
Local planning helper
Find the documented connection route
Choose an environment to see its documented route and checks.
Keep the server and browser paths separate
For browser access, Supabase’s Data API and client libraries use the project URL and an appropriate API key rather than a database password. Row Level Security policies govern that access. Never place a privileged connection string or administrative secret in browser code.
For server-side Drizzle, take the endpoint from the project’s Connect panel. Confirm its port, username, network support and pool mode. Keep credentials in approved server-side secret storage.
Check pooling and migrations separately
Supabase documents transaction pooling for short-lived functions and a direct route for migration, backup and restore tools. Drizzle’s Postgres.js transaction-pooling example uses prepare: false. Session features and prepared statements cannot simply be assumed to carry over between modes.
A connection that works for one query does not prove a migration, rollback or access policy works. Keep those as separate checks.
A checklist before live data
- Record driver version, runtime and the selected connection mode.
- Check network support from the actual host.
- Use synthetic rows to test the intended read/write path.
- Test allowed and denied access through the real application path.
- Inspect a schema change on a disposable database, then rehearse rollback.
- Record the result and unresolved limits before enabling live traffic.
These steps are proposed. The selector was tested locally; no live Supabase database, provider account or migration was executed for this article.