Supabase and PostgresArchitecture and comparisonsreference
Cloudflare Workers + Supabase: an architecture reference
Every way a Cloudflare Worker talks to Supabase, which path to use for what, what each one actually costs, and where its data lives.1
All numbers below were measured from Singapore: a Worker on Cloudflare’s edge (wrangler dev --remote) against a Supabase project in Frankfurt (eu-central-1), 2026-07-14 - a ~10,000 km round trip, so the absolute latencies are distance-dominated. The ~210ms floor is mostly the Singapore-to-Frankfurt wire, not stack overhead; read the numbers for their shape, and see Reading the numbers for what generalises and what does not.
wrangler dev --remote runs the Worker on Cloudflare’s real edge with live bindings, so the matrix tracks a deployed Worker - and the patterns here run in production: a pastebin app (pasteriser.io, formerly paste.erfi.io) serves a live /recent feed through the Durable Object Realtime relay, sweeps expired rows with pg_cron, and does its CRUD (create, read, update and delete) through the RPC (remote procedure call) and PostgREST paths below - all verified live end to end.
Every latency here was measured against that setup; every claim about behaviour links to the Cloudflare or Supabase docs in References. Where a claim is empirical rather than documented (the raw-driver failure, the Realtime relay gotchas), it is called out as measured, not asserted.
TL;DR:
- Reads:
supabase-jsover PostgREST is ~210ms with a fat tail; a cacheable read through either the Worker Cache API (application programming interface) or Hyperdrive is ~10ms. The Cache API needs no extra infra and matches Hyperdrive for pure read caching. - Raw Postgres drivers (
pg,postgres.js) run from a Worker over the runtime’s TCP (Transmission Control Protocol) socket API, but against the Supavisor pooler they need pooler-specific flags (prepare: false, an SSL (Secure Sockets Layer) workaround) or the connection fails (node-postgres terminates, postgres.js hangs). Hyperdrive is the managed wire path: pooling plus read cache, over the direct connection, no driver tuning. - Writes: Hyperdrive (~172ms) beats PostgREST (~208ms) because it skips the PostgREST layer - and drops the JWT (JSON Web Token) context (
auth.uid()is null), so you own authorization in the Worker. RLS (row-level security) itself still applies by DB (database) role unless that role hasBYPASSRLS(see the security model). - Hyperdrive and the Data API share
max_connections: on Small, non-superusers are refused at 87 client backends in total; a Hyperdrive config created without--origin-connection-limitheld 60 origin connections, and idle origin connections were still open at 965 s and closed by 1265 s, past Cloudflare’s documented 10 minutes (one run). With Hyperdrive holding the rest of the slots, Data API calls beyond PostgREST’s open connections and the free slots answered 503 PGRST002 in 719-2718 ms (H03) rather than waiting. Set the limit and budget it (Connection budget with the Data API). - Auth: verifying a Supabase JWT at the edge with cached JWKS (JSON Web Key Set) is ~0ms; a
getUser()round-trip is ~207ms. Verify locally for latency, round-trip only when you need revocation. - Preview branches: each PR (pull request) gets an isolated Supabase project built from your migrations; wire it to a
wrangler versions uploadWorker preview version that never touches the production route. A branch that fails on a missingconfig.tomlenv()secret is mislabeledMIGRATIONS_FAILED- the migrations are fine, the branch just never got your custom-SMTP/OAuth secrets.
Topology
Section titled “Topology”The pattern this reference assumes is Browser -> Worker -> Supabase: the browser never holds a Supabase key, and the Worker is the trust boundary. Realtime is the one surface that usually stays browser-direct (see below).
Which path to use
Section titled “Which path to use”| You need | Use | Cost (SG (Singapore) -> FRA (Frankfurt)) | Why |
|---|---|---|---|
| RLS CRUD, Auth, Storage, the full SDK | supabase-js / PostgREST | ~210ms / call | default; RLS enforced by the key; no nodejs_compat |
| A repeated read made fast | Worker Cache API | ~10ms hit | zero extra infra, no nodejs_compat |
Real SQL (joins, transactions, COPY) or faster writes | Hyperdrive | ~10ms cached, ~172ms write | managed pooled wire path (raw drivers work too, but the pooler needs specific flags); you own authz |
| Hot-path auth | edge JWT verify (jose) | ~0ms | local after the first JWKS fetch |
| Revocation-aware auth | getUser() | ~207ms | round trip; use per sensitive route |
| Realtime | browser-direct, or a Durable Object relay | n/a | a stateless Worker cannot hold a long-lived socket |
| A per-PR database | preview branch + Worker preview version | n/a | isolated project, auto-migrated, own preview URL |
The absolute costs are the Singapore-to-Frankfurt figures below; the choice in each row is geography-independent.
The measured matrix
Section titled “The measured matrix”25-row / ~50KB reads and single-row writes, n=40/n=20, times in milliseconds, from the Singapore edge to Frankfurt.
| Path | median | p95 | notes |
|---|---|---|---|
PostgREST over HTTPS (supabase-js) | 213 | 591 | the default path; fat tail from TLS/connection variance |
| Worker Cache API in front of REST | 10 | 18 | first call ~258ms (cache fill), then edge-local; the fill only happens if Set-Cookie is stripped before put (see Storage) |
| Hyperdrive - cached read | 10 | 18 | deterministic query, default 60s TTL |
Hyperdrive - uncached read (now()) | 215 | 229 | bound by RTT, same floor as REST but tighter tail |
raw node-postgres -> Supavisor | - | - | fails: Connection terminated unexpectedly |
raw postgres.js -> Supavisor | - | - | fails: connection hangs (6s timeout) |
Writes
Section titled “Writes”| Path | median | p95 | notes |
|---|---|---|---|
PostgREST insert (supabase-js) | 208 | 264 | enforces RLS via the key |
| Hyperdrive insert | 172 | 231 | pooled direct connection, skips PostgREST - no auth.uid() context, so you own authz; RLS still applies by role |
| raw driver -> Supavisor | - | - | fails (same as reads) |
| Operation | median | p95 | notes |
|---|---|---|---|
Verify JWT at the edge (jose + cached JWKS) | ~0 | ~0 | first call 263ms (JWKS fetch), then local |
getUser() round-trip (/auth/v1/user) | 207 | 219 | revocation-aware |
| Tampered token | - | - | correctly rejected |
Reading the numbers
Section titled “Reading the numbers”These were measured Singapore edge -> Frankfurt DB, ~10,000 km apart. The first of the three conclusions below is specific to this setup; the other two generalise:
- The absolute floor is the wire. A Singapore-to-Frankfurt round trip is ~150-165ms of RTT (round-trip time) before any TLS (Transport Layer Security) handshake or query work, which is why every uncached, must-reach-the-DB path lands near ~210ms. Geography sets that floor.
- The gains are ratios, and they generalise. A cached read (~10ms) is ~20x faster than the round trip; edge JWT verify (~0ms) removes a ~207ms round trip; Hyperdrive’s pooled write (~172ms) removes the PostgREST layer from the wire. These relationships hold at any region pairing.
- Co-locate to collapse the floor. Put the Worker’s effective region and the Supabase region on the same continent - or front the DB with a read replica near the edge - and every wire number drops toward the intra-region floor (single-digit to low-tens of ms), while the cache and verify wins stay proportionally the same. Supabase offers regional placement (APAC (Asia-Pacific) is
ap-southeast-1, Singapore), so pairing the Worker’s effective region with the database region is a deployment choice.
Cutting the round trip
Section titled “Cutting the round trip”The floor is the wire, so the fixes are: remove the round trip, reduce how many you make, or shorten each one. The first two matter most; they draw on both platforms.
-
Remove it - cache / edge verify (Cloudflare). The Cache API and Hyperdrive cache serve hot reads at ~10ms with no wire at all; edge JWT verify removes the ~207ms
getUser()round trip. These changes reduce latency more than the other options, and the reduction grows with distance (see the matrix and Auth sections). -
Reduce the count - RPC / database functions (Supabase). The floor is charged per round trip, so collapsing several statements into one
.rpc()to aplpgsql/sqlfunction2 pays ~210ms once instead of N times. Push multi-step reads and writes into a function rather than chainingsupabase-jscalls across the wire. The pastebin app’sview_paste(uuid)collapses a read + aread_countbump + a conditional burn-delete (three wire round trips) into one.rpc(), and itsSELECT ... FOR UPDATEalso closes a burn-after-reading race that three separate calls could not. -
Shorten it - Smart Placement (Cloudflare). By default a Worker runs nearest the user; Smart Placement moves its execution near the origin it talks to most - your Supabase region - when that lowers total latency.3 A chatty Worker making several sequential DB calls from Singapore to Frankfurt then runs beside Frankfurt, so only one user-to-Worker hop crosses the distance and the DB calls are intra-region. Enable per app:
{ "placement": { "mode": "smart" } }It wins for multi-call Workers and is roughly neutral for single-call ones (you just move where the one hop happens).
-
Shorten it - read replicas (Supabase). A read replica in a region near the edge (
ap-southeast-1for Singapore) serves reads locally while writes stay on the primary.4 Point read-only paths at the replica; keep writes on the primary. -
Remove the distance - co-locate. If users, Worker, and DB can share a region, the wire floor drops to single-digit / low-tens of ms and most of this section is moot. Region choice is the cheapest fix when it is available.
Data plane: how a Worker reaches the database
Section titled “Data plane: how a Worker reaches the database”A Worker can reach the database in three ways.5
A. supabase-js over PostgREST (the default)
Section titled “A. supabase-js over PostgREST (the default)”createClient(url, key) then .from()/.rpc(). Every call is an HTTPS (Hypertext Transfer Protocol Secure) request to PostgREST. This is the path to prefer for most work: it carries auth, enforces Row Level Security via the anon/authenticated key, needs no nodejs_compat, and gives you the full supabase-js surface (Auth, Storage, Realtime). The cost is a full request to Frankfurt per call (~210ms from Singapore; your floor is whatever your edge-to-DB round trip is) with a fat tail.
On a read the client retries a 503 on its own and does not retry a claim rejection, measured on supabase-js 2.112.3 with .from().select() (edge-resilience W02, supabase-lab): three 503 PGRST002 answers followed by a 200 took 4 attempts and about 7.0 s; a 401 PGRST303 took exactly 1 attempt, 9 ms; a refused connection surfaced Unable to connect after about 7.0 s. The documented policy, on by default since 2.102.0, retries only GET, HEAD and OPTIONS, on 503, 520 and network failures; POST, PATCH, PUT and DELETE are never retried, and .rpc() sends POST by default, so an RPC is not retried unless it is called with { get: true } or { head: true }.6 So do not wrap .from() reads in a second retry loop; pass { get: true } for a read-only .rpc(), retry a POST .rpc() or a write yourself only where repeating it is safe, and handle a 401 yourself - the client will not.
B. Raw Postgres driver
Section titled “B. Raw Postgres driver”Raw pg and postgres.js connect from the Workers runtime over its TCP socket API (connect() from cloudflare:sockets); both Cloudflare and Supabase document driving node-postgres / Postgres.js directly from a Worker.7 Against the Supavisor pooler the connection needs pooler-specific settings: prepare: false for the transaction pooler (it keeps no prepared statements), plus an SSL/pooler workaround on the connection string. With driver defaults the handshake does not complete. For the wire protocol without that tuning, use Hyperdrive (next) - it pools, caches, and targets the direct connection.
C. Hyperdrive - the managed wire-protocol path
Section titled “C. Hyperdrive - the managed wire-protocol path”Hyperdrive is Cloudflare’s pooler + read cache living in their network.8 The Worker gets a connectionString from a binding and connects with node-postgres; Hyperdrive handles the TCP/TLS to Postgres and keeps the real pool warm near the database while traffic flows: in one run idle origin connections closed after 16 to 21 minutes and were not reopened without traffic (Connection budget). It is the managed way to run raw SQL (Structured Query Language) from a Worker - pooled and cache-eligible, faster than REST (representational state transfer) for writes and cache-eligible reads - without hand-tuning a driver against the pooler.
Reads get faster through the cache.9 A deterministic read is served from Hyperdrive’s cache near the Worker (~10ms). The moment the query is non-cacheable - a STABLE or VOLATILE function like now() (Hyperdrive caches neither), or any write - it drops to the same ~210ms RTT floor as REST. Hyperdrive’s pooling gives the tighter write path (~172ms vs 208ms) and a tighter tail; the wire stays the same length.
Connection modes and ports
Section titled “Connection modes and ports”| Mode | Host / port | IP (Internet Protocol) | Use from a Worker |
|---|---|---|---|
| Direct connection | db.<ref>.supabase.co:5432 | IPv6-only (no A record) unless IPv4 add-on | Behind Hyperdrive |
| Supavisor - transaction | aws-N-<region>.pooler.supabase.com:6543 | IPv4 | From a Worker needs prepare: false + a pooler SSL workaround; fine from a server |
| Supavisor - session | aws-N-<region>.pooler.supabase.com:5432 | IPv4 | Hyperdrive’s IPv4 fallback if direct is unreachable |
| PostgREST | <ref>.supabase.co:443 | IPv4/IPv6 | supabase-js (path A) |
Connection budget with the Data API
Section titled “Connection budget with the Data API”Hyperdrive on the direct connection and the Data API (PostgREST, which logs in as authenticator) draw on the same max_connections, and neither sees the other’s connections. The lab measured how they share it on 2026-10-23 in supabase-lab’s hyperdrive-direct experiment, modules H02 and H03. The rig is a different one from the 2026-07-14 latency matrix: one fresh Small project per run on a Pro-plan organization in ap-southeast-1, Postgres 17.11 (PostgREST 14.18, read in H02), Hyperdrive configs on db.<ref>.supabase.co:5432 with caching disabled, a Worker running select pg_sleep(s) through pg 8.23.1 with a new Client per request, Data API holds as dc_sleep_xl(s) RPCs with the legacy service_role API key, and every request sent from one Mac in Singapore. H02 ran twice (run 2 is the reference, quoted unless run 1 is named) and H03 three times. Most rows below are one run; none covers another compute size, another region, caching on, or a config pointed at Supavisor, and the Cloudflare account’s Workers plan was not recorded.
The slots on Small. Figures from H02 run 2 unless named.
| Figure | Value | How it was read |
|---|---|---|
max_connections, superuser_reserved_connections, reserved_connections | 90, 3, 0 | settings, H02a |
| Where non-superusers are refused | at 87 client backends in total; superuser backends count toward the 87 | at 87 the Management API query endpoint got 53300: remaining connection slots are reserved for roles with the SUPERUSER attribute (H02c step 45) |
| Superusers | supabase_admin only; its one client backend is postgres_exporter, so with it connected non-superusers get 86 | H02a |
| Supabase’s own client backends at idle | authenticator 2, pgbouncer 1, supabase_admin 1 | H02 run 1, before any Hyperdrive traffic |
Data API pool full (db_pool unset) | 31 authenticator backends | 30 concurrent dc_sleep_xl(100) holds, H02c |
| Left with the Data API pool full | 54, for Hyperdrive, the Management API and the dashboard’s SQL | derived: 87 - 31 - 1 (pgbouncer) - 1 (postgres_exporter), not measured as one figure |
A Hyperdrive config created without --origin-connection-limit | read back origin_connection_limit 60; held exactly 60 origin connections under 80 concurrent 60 s holds, with 18 Postgres slots still free | H02a, H02e |
The Management API query endpoint logs in as postgres, which is not a superuser (rolsuper false), so it is refused with everything else at 87. One config at the default this account read back (60) plus a full Data API pool (31) is already past 87 on Small (derived). Cloudflare’s limits page lists the per-config maximum as about 20 connections on Free and about 100 on Paid;10 whether 60 is a plan or an account default was not separated. The Data API page has the pool per compute size (pool with db_pool unset).
--origin-connection-limit capped the config, softly. The API refused a create with 1 and named its valid range as 5-1500 ([code: 2021]); creates with 5 and 15 succeeded. Cloudflare documents a minimum of 5 and a maximum that depends on the Workers plan.11 A config with limit 5 held 5 origin connections in H02 run 2, 6 in H02 run 1 and H03 run 1, and in H03 run 3 up to 9 after its warm-up alone and 11 later. Cloudflare’s pooling page says “The max_size parameter acts as a soft limit”,11 and the limits page footnotes its per-plan maximum row: “connection counts may occasionally exceed the listed limits”, because a client that cannot reach an existing pool gets a new one.10 The overrun was seen only on the limit 5 config, which also served the observer’s queries (up to 9 in H03 run 2, 11 in run 3); the default config never held more than 60 and the limit 15 config never more than 14. In H02c, 4 of 49 connections of the default config were idle while 15 of its requests failed (14 with 53300, 1 with Connection terminated unexpectedly), and its backends came from 7 client addresses; several pools is one reading of that, not measured.
What each side saw when the slots ran out.
| What ran out | Hyperdrive request (pg in the Worker) | Data API request | Management API query endpoint | Module, runs |
|---|---|---|---|---|
| The config’s own origin connection limit, Postgres not full | waited about 15 s, then 500 58000 Timed out while waiting for an open slot in the pool. (15642-17557 ms at limit 5; 15659-15964 ms at the default 60) or Connection terminated unexpectedly | depends on the Postgres slots left (next rows) | answered (H02e: 69 client backends) | H02b, H02e; run 2 |
| Postgres, Data API pool connected first | failed in under 1.2 s with Postgres’s refusal passed through: 12 x 53300 remaining connection slots are reserved for roles with the SUPERUSER attribute (741-1180 ms), 2 x 53300 sorry, too many clients already (808-810 ms), 1 x Connection terminated unexpectedly (811 ms) | the 30 holders, already connected, all answered 200 | refused with 53300 from 87 client backends (step 45), before Hyperdrive failed (step 60) | H02c; run 2 |
| Postgres, Hyperdrive connected first | 60 x 200 (the config’s limit); the other 20 hit that limit (18 x 58000 after about 15 s, 2 x Connection terminated unexpectedly) | H02e: 19 x 200, 11 x PGRST002 in 1369-2500 ms; H03 Q2: 200 for as many calls as PostgREST had pool connections plus free slots; every other call 503 PGRST002 Could not query the database for the schema cache. Retrying. in 719-2718 ms | answered before and after the burst (H02 run 2) | H02e; H03 Q2, 9 arm-runs |
In both orderings (one run each in H02; Hyperdrive-first repeated in 9 H03 arm-runs), requests beyond the connections already open and the free slots failed and the side already connected kept working, even where one of Hyperdrive’s own connections sat idle (H02c: 4 of 49) or a PostgREST connection would have freed within 5 s (H03 Q2). Cloudflare’s limits page documents the pool error as Failed to acquire a connection from the pool. and an initial connection timeout of 15 seconds;10 these runs saw the 58000 text instead, and whether the 15 s wait is that timeout was not separated. For an origin at its connection limit the same page lists Server connection attempt failed: connection_refused; these runs got Postgres’s 53300 passed through instead. H02 run 1 ran the Hyperdrive-first step without the reset (PostgREST held 31 idle connections and the default config 47 before it); afterwards all 44 Management API reads over 656 s were refused with 53300 while Data API pings answered 200, and what held the slots then could not be read.
PGRST002 instead of a wait, by arm (H03 Q2). H03 Q2 ran four arms three times each. Arm a terminated PostgREST’s authenticator backends and put no Hyperdrive load on; arm b did the same and then sent 80 concurrent 40 s holds through the default config; arm c left PostgREST’s connections alone, warmed a Data API pool of 12 and sent the same 80 holds; arm d added 15 (run 1) or 20 (runs 2 and 3) holds through the limit 15 config to arm b. 10 s into the holds came 30 concurrent dc_sleep_xl(5) calls and one dc_ping. In all 9 arm-runs with Hyperdrive load, dc_sleep_xl answered 200 exactly as often as PostgREST’s pool connections before the burst plus the free slots (20 = 1 + 19, 18 = 12 + 6, 1 = 1 + 0, and so on), and every other call answered 503 PGRST002 in 719-2718 ms; no PGRST000, PGRST001 or PGRST003 reached the client, and the ping answered 200 in 6 of the 9. The failed calls did not wait for the 5 s holds to free a connection, although PostgREST’s db_pool_acquisition_timeout was 10 s. PostgREST’s logs (run 3; run 2 shows the same first second) give the order: a 503 access line at 0.1-0.3 s (its code is discussed below), Failed to query the PostgreSQL version. with PGRST000 and FATAL: remaining connection slots ... first at 0.2-0.5 s, a failed schema-cache load 3 times per arm, PGRST002 lines between 0.5 and 2.7 s, Attempting to reconnect to the database in N seconds... 3 times between 1.5 and 8.0 s, and a new pool (Connection Pool initialized with a maximum size of 30 connections) and schema cache at 7.6-8.4 s; authenticator read 1 at 10 s. The reading: the first refused connection makes PostgREST treat the database as lost, answer PGRST002 to every request that has no connection instead of waiting, and rebuild its pool about 8 s later. A warm pool kept serving (13 of 13 authenticator backends kept, arm c), and a reset with free slots gave 30 x 200 (arm a).
This differs from the failure on the Data API page: with every pooled connection busy and Postgres slots free, a request waits and gets 504 PGRST003 after about six acquisition timeouts. When Postgres refuses PostgREST a new connection, the answer is 503 PGRST002 within about 2.7 s, the same error the Data API page measured for a db_pool above what max_connections can give (db_pool above max_connections). Each 503 the client saw left exactly 6 PostgREST access-log lines (run 3: 108, 102 and 180 for 18, 17 and 30 client 503s, ping included), the factor the Data API page measured for 504 PGRST003; the reading there, a layer in front of PostgREST sending the request again, fits, and the component was not identified (H03 did not record response headers). The first 503 line in each arm came at 0.1-0.3 s with a 234-byte body, larger than the 119-byte PGRST002 lines from arm b’s reset pings; the reading is that another 503 code came first and the resend hid it from the client (code not captured).
Freeing slots by terminating backends has its own cost. In run 3, terminating 31 idle authenticator backends made PostgREST fail five schema-cache loads with 57P01 terminating connection due to administrator command, and 9 of the 12 pings it took to get 3 good ones in a row answered 503 PGRST002. PostgREST logged those 503s from 43.0 to 16.6 s before the burst and its new pool at 16.0 s before (about 27 s from the first PGRST002 line to the new pool, derived from those offsets; its first failed schema-cache load was logged at 47.1 s before). Runs 1 and 2 needed 12 and 11 pings. After terminating 2 (arms a and d, run 3), PostgREST reconnected within 1 s and 4 s with no PGRST002 line. After a Data API burst, PostgREST’s own idle pool closed (31 to 1 authenticator) between 43 and 54 s after the holds returned in H02 run 2, and stayed open for at least 92 s idle in H02 run 1; the cause of the difference was not separated.
How long idle origin connections stay. In H02 the default config’s 60 origin connections were all still open and idle at every 15 s sample up to 891 s after its last request (watch cap 900 s). H03 Q1 (one run) loaded two configs once with 20 s holds, sent no Worker traffic for 1800 s, and read every Hyperdrive backend about every 30 s:
| Idle for | Default config (limit 60) | Limit 15 config | Limit 5 config (terminated before, no traffic) |
|---|---|---|---|
| 0 s | 54 idle | 13 idle | 0 |
| 604 s | 54 idle | 13 idle | 0 |
| 965 s | 54 idle | 13 idle | 0 |
| 1182 s | 0 | 6 idle | 0 |
| 1265 s to 1777 s (18 samples) | 0 | 0 | 0 |
Up to 965 s every connection showed a state_change age equal to the time since load end, the last pg_sleep as its query text, and the same pid as at the previous sample: nothing ran on them while idle and none was replaced. All 54 of the default config closed after 965-1182 s idle and the limit 15 config’s after 965-1265 s; none reopened, and the limit 5 config, with no traffic, never reconnected (no floor). Postgres had idle_session_timeout 0 and tcp_keepalives_idle 1800. Cloudflare’s limits page lists “Idle connection timeout | 10 minutes” in a table introduced with “These limits apply to connections between Hyperdrive and your origin database.”10 These connections outlived it by at least 365 s (965 s - 600 s). Who sent the close, Hyperdrive or something on its path, was not measured (the Postgres disconnect log lines were not read). There is no sample between 965 s and 1182 s, a 217 s gap that fits the sampling Mac pausing the process (not checked), so the close time is only bounded. The 6 limit 15 connections that outlived 1182 s were every connection from 2 of that config’s 5 client addresses, which fits a timer per source address (a reading, one run).
Settled by H04 (one 2700 s run, log_disconnections on): Hyperdrive closes its idle origin connections. All 64 closes were plain disconnection lines at LOG severity with no FATAL, no ERROR and no SSL error; Postgres did not close any. A request on one origin connection keeps only that one open; the config’s other connections close on schedule. Not settled: whether a proxy holding Hyperdrive’s TLS session sends the close; the sweep’s period and threshold (inferred from batch times, one run, one region, one Workers plan, not recorded); why the default config stopped at 54 in the H03 Q1 fill; sizes other than Small; a CONNECTION LIMIT on the Hyperdrive role as a Postgres-side cap, and the dashboard’s pool restart,11 which were not run. None of these differences from Cloudflare’s docs has been filed upstream.
Setting up Hyperdrive
Section titled “Setting up Hyperdrive”1. Least-privilege role (do not grant postgres - that hands a Worker-reachable role superuser-adjacent rights):
create role hyperdrive_user login password 'GENERATE_A_STRONG_ONE';grant usage on schema public to hyperdrive_user;grant select on all tables in schema public to hyperdrive_user;-- this covers existing tables only; for tables created later, also:-- alter default privileges in schema public grant select on tables to hyperdrive_user;-- add insert/update/execute only for exactly what the Worker needs2. Create the config against the direct connection (Hyperdrive verifies connectivity at create time), with an explicit origin connection limit:
wrangler hyperdrive create my-supabase \ --origin-connection-limit=N \ --connection-string="postgres://hyperdrive_user:PASSWORD@db.<ref>.supabase.co:5432/postgres"Size N from the project’s slots: the sum of every config’s limit, the Data API pool and Supabase’s own backends has to stay under the non-superuser ceiling (87 client backends on Small). Supabase’s own backends were counted at idle with no Auth, Storage or Realtime traffic; leave room for those services and for the dashboard’s SQL (the sizing rule is design, from the counts). A config created without the flag read back 60 in the lab’s account, more than the 54 slots (derived) Small has left once the Data API pool is full, and the limit is soft (a limit of 5 held up to 11, the only config seen above its limit). Count each config at its limit for at least 21 minutes after its last request (design, from one run in which every idle origin connection had closed by 1265 s). The measurements are in Connection budget with the Data API.
3. Bind it in wrangler.jsonc (pg needs nodejs_compat):
{ "compatibility_date": "2026-07-12", "compatibility_flags": ["nodejs_compat"], "hyperdrive": [{ "binding": "HYPERDRIVE", "id": "<config-id>" }]}4. Query (pg >= 8.16.3, fresh client per request - Hyperdrive pools the origin connections):
import { Client } from "pg";const client = new Client({ connectionString: env.HYPERDRIVE.connectionString });await client.connect();const { rows } = await client.query("select id, body from t order by id limit $1", [25]);Auth: verify at the edge, or round-trip
Section titled “Auth: verify at the edge, or round-trip”Supabase issues asymmetric JWTs (ES256 here) with a JWKS endpoint at <url>/auth/v1/.well-known/jwks.json. That gives a Worker two options with very different cost12:
- Verify locally with
joseagainst the cached JWKS -createRemoteJWKSetfetches the keys once (~263ms first call) then verifies every subsequent token in ~0ms, no round-trip. Rejects tampered tokens correctly. Use this for the hot path. getUser()hits/auth/v1/user(~207ms) and is revocation-aware - it fails immediately if the user was signed out or deleted server-side. Use it only where revocation matters (sensitive mutations), not on every request.
import { createRemoteJWKSet, jwtVerify } from "jose";const jwks = createRemoteJWKSet(new URL(`${env.SUPABASE_URL}/auth/v1/.well-known/jwks.json`));const { payload } = await jwtVerify(token, jwks, { audience: "authenticated" });// payload.sub, payload.role - ~0ms after the first JWKS fetchMeasured on the request path (edge-resilience W01, W05), 401 PGRST303 is clock skew or expiry - the skew boundary sits at iat +30 s (200) against +31 s (401) - and 401 PGRST301 is a key PostgREST does not trust. A third-party issuer’s key it has never seen takes about 30 s to become trusted after the Management API already reports resolved_jwks; a key set it has seen before warms in about 302 ms. After registering a third-party issuer, poll a real /rest/v1 call until it answers 200 before routing traffic. First-party signing-key rotation was not measured by W01 or W05.
Keys: the browser gets the anon key (public, RLS applies). The Worker holds the service_role / sb_secret_ key as a Wrangler secret and never ships it to the client. On a Hyperdrive/raw-SQL path there is no key at all - the Postgres role is the identity. RLS still applies unless that role has BYPASSRLS, but there is no auth.uid() for user-scoped policies, so you own authorization in the Worker (next section).
That covers bearer-token auth - a Worker verifying a JWT it was handed. For a Worker or Pages Function that renders authenticated HTML (HyperText Markup Language) server-side, the session lives in cookies instead: use @supabase/ssr with a getAll / setAll cookie adapter so the SSR (server-side rendering) client reads and refreshes the session from request/response cookies.13 Same trust boundary (keys stay server-side), just a cookie transport rather than a bearer header.
Security model (where auth is enforced)
Section titled “Security model (where auth is enforced)”| Path | Who enforces authorization | Key / identity |
|---|---|---|
supabase-js REST (anon) | RLS, via the anon/authenticated JWT | anon key, in the browser or Worker |
supabase-js REST (service) | Your code - service key bypasses RLS | service key, Worker-only secret |
| Hyperdrive / raw SQL | RLS still applies unless the DB role has BYPASSRLS or owns the table; there is just no auth.uid() for user-scoped policies | DB role, no JWT |
| Auth (edge verify) | jose signature + exp/aud checks | JWKS (public) |
Leaving PostgREST does not turn RLS off, and the least-privilege Hyperdrive role this doc recommends is the case where assuming it does goes wrong. RLS is a Postgres feature enforced for any role that lacks the BYPASSRLS attribute and does not own the table, no matter whether the connection arrives via PostgREST or a raw wire protocol. service_role and postgres carry BYPASSRLS (so REST-with-service-key and raw SQL as postgres both skip RLS); a purpose-made hyperdrive_user does not. What you lose by leaving PostgREST is the JWT context: auth.uid() is null, so user-scoped policies match nothing.
RLS enforcement by connection identity
Section titled “RLS enforcement by connection identity”With RLS enabled on a pastes table (two rows, both owned by user A), the same query resolves differently depending on how the connection identifies itself:
| Identity (how it connects) | Rows seen |
|---|---|
| anon key (PostgREST) | public only |
| user A JWT (PostgREST) | A’s private + public |
| user B JWT (PostgREST) | public only - cannot see A’s private |
service_role (PostgREST, BYPASSRLS) | all |
hyperdrive_user (raw SQL, no BYPASSRLS) | 0 - RLS denies by default, no policy targets that role |
A least-privilege Hyperdrive role sees nothing through RLS-enabled tables unless you add policies for it, grant it BYPASSRLS, or the table has RLS off (an RLS-disabled table returns every row to any role). Decide deliberately: BYPASSRLS makes the Worker the sole authorization gate; policies-for-the-role keeps Postgres enforcing. Either way, never hand a Worker-reachable role postgres. A third option keeps per-user auth.uid() policies working over the wire - setting request.jwt.claims yourself per transaction - covered, with measured prerequisites and edges, in RLS without Supabase Auth.
Because the Worker is the single ingress, it is also the single place to throttle: the Workers Rate Limiting binding14 (or a Durable Object counter) caps abuse at the edge before it reaches Supabase - one rate-limit surface instead of one per client path. This is the same reason the browser-direct Realtime shape is a downgrade: it opens a second ingress the Worker cannot see or throttle.
The deployment shape this suits is Browser -> Worker -> Supabase: the Worker authorizes every request and the browser holds no key. Keep the service key and the Hyperdrive connection string server-side (the Hyperdrive string lives in the config, not in Worker secrets).
Storage
Section titled “Storage”The full round-trip - create bucket -> upload -> signed URL (Uniform Resource Locator) -> fetch - runs against the Storage REST API with the service key. The CF-relevant pattern is to serve Storage objects through a Worker and cache them at the edge: the Worker mints or proxies a signed URL, fetches the object, and puts it in the Cache API.15 Objects are effectively immutable per signed URL, so the same ~10ms edge-cache behaviour as the read path applies to a hot object after the first fill.
// Worker: proxy + edge-cache a private Storage objectawait authorize(request, env); // authorize FIRST - a cache HIT must not skip authzconst cache = caches.default;const key = cacheKeyForScope(request); // scope the key so one fill can't leak across callerslet res = await cache.match(key);if (!res) { const signed = await mintSignedUrl(env, path); // service key, server-side res = await fetch(signed); res = new Response(res.body, res); res.headers.set("cache-control", "public, max-age=60"); res.headers.delete("set-cookie"); // the gateway sets __cf_bm on EVERY response; put() refuses it ctx.waitUntil(cache.put(key, res.clone()));}return res;Authorise before cache.match, and scope the cache key to what the caller may see - a cache hit that skips the auth check would serve the private object to whoever requests the same URL next. And do not put the service key or a bucket-wide token in the browser - the Worker is where the privileged Storage call happens.
Without the set-cookie delete the cache never fills, and an earlier revision of this snippet lacked it. The Supabase gateway’s Cloudflare front sets Set-Cookie: __cf_bm on every response, caches.default.put refuses any response carrying Set-Cookie,15 and the rejection lands inside waitUntil, where nothing surfaces it - so the copy-all-headers version never caches and every request is a MISS with no error anywhere (edge-resilience W04; the entity-graph demo’s edge cache hit the same failure independently). With the origin repointed at an unroutable address, a warm URL still answered 200 HIT with a byte-identical body. A cold URL fails. The Workers runtime hands the worker’s fetch() a 403 response for the unroutable origin instead of throwing, so a catch-only fallback never fires; a drill worker that treated 403 as origin failure returned 503 to the client (edge-resilience W04, W24; artifact 2026-08-16). Serve the cached copy on any non-ok origin response, not only on a throw.
Storage also exposes an S3-compatible endpoint, reachable from a Worker with a signing client like aws4fetch.16 Use it for multipart uploads of large objects or to point existing S3 tooling at a bucket, where the REST API is awkward.
Realtime
Section titled “Realtime”Realtime is a WebSocket to Supabase, with three modes worth separating17:
- Postgres Changes streams row changes from the write-ahead log (WAL) to subscribers. It authorizes per subscriber per event and is single-threaded, so throughput scales with subscriber count, not compute; at high subscriber counts it becomes the bottleneck (Supabase’s Realtime benchmarks give a per-database calculator18) and Broadcast is the path that scales.
- Broadcast is the general channel: low-latency messages client-to-client over the WebSocket, the REST endpoint, or from the database via
realtime.send()/realtime.broadcast_changes()in a trigger. It is the recommended path at scale19, and the one a server can reach without holding a socket (a Worker can POST the Broadcast REST endpoint to push). - Presence tracks shared ephemeral state (who is online, cursors); not for high-frequency updates.
Channels are public by default; opt into a private channel with private: true to gate it behind RLS policies on realtime.messages. A private channel re-sends its JWT on refresh, so keep JWT expiry short.
Where the Worker fits. A stateless Worker cannot terminate a long-lived socket. Two shapes:
- Browser-direct - the browser opens the
wss://<ref>.supabase.cosocket itself with the publishable/anon key and RLS-backed channel authorization. Simplest, and the one surface that legitimately bypasses the Worker - but it exposes the anon key, relaxes the CSP (Content Security Policy) to allow the Supabase host, and is a second surface outside the Worker. - Durable Object relay - a DO (Durable Object) holds ONE server-side subscription and fans out to browsers over a same-origin socket. Keeps the browser -> Worker -> Supabase boundary intact (no key in the browser, CSP stays
connect-src 'self', one surface), and the hibernatable WebSocket API carries thousands of browser connections cheaply on the server side.20
A relay does not get replay for free. Postgres Changes does not queue rows for a disconnected client, and Supabase documents that changes during a 30 s disconnect are gone.21 A lab run on 2026-10-10 measured it (RT02, one run, a clean client-side close rather than a network cut): a 30 s disconnect delivered 0 of 25 inserted rows on rejoin. So a relay holding the single upstream subscription needs a heartbeat row and a REST backfill on updated_at to resume (supabase-realtime-surface).
The paste-service app takes the relay route for its live /recent feed: a realtime.send() trigger on public-paste inserts, a Durable Object holding the single upstream subscription, and browsers on a same-origin /api/recent/live socket - so the anon key never reaches the browser and the CSP is unchanged.
There is one upstream subscription to Supabase, and N browser sockets fan out from the DO. The push path runs INSERT -> trigger -> Realtime -> the one upstream -> fan-out; browsers dial the DO in the other direction to set the sockets up.
The first four fail silently if missed and came from debugging; the fifth came from the lab:
- The DO subscribes with the anon JWT, not the
sb_publishable_key. Realtime silently ignoressb_*tokens as a private-channelaccess_token, so the join is unauthenticated and receives nothing. (Supabase is deprecating the legacy anon key by end of 2026; on a new-keys-only project theaccess_tokenmust be a real signed anon/user JWT - still never thesb_publishable_key.) - The DO’s outbound socket is
fetch("https://...", { headers: { Upgrade: "websocket" } }), notnew WebSocket("wss://..."). A Worker’sfetchonly upgrades anhttp(s)URL; awss://URL is rejected, so the upstream never connects. (A browserWebSocketacceptswss://, so this only bites server-side.) - Response middleware must skip the
101. A header-adding middleware that re-wraps every response withnew Response(body, init)drops the non-standardwebSocketproperty, and the browser upgrade fails with a1002. - Rejoin with Broadcast
replay. On reconnect, sendbroadcast.replay { since, limit }so anything broadcast during the gap is backfilled - private channels only, DB-originated messages, up to 25 per request, at least 72h retention; dedup on the client by id (the browser socket stays up while only the DO’s upstream reconnects, so a poll fallback would not cover it). - Never drop and recreate a table that has a live subscription. Dropping and recreating a table under Postgres Changes delivery kills events for that table name - the new OID (object identifier) does not match the channel’s metadata - while a table under a fresh name delivers in about 0.5 s (edge-resilience W12). Use stable canary tables for probes and migrate with
ALTER, not drop-and-create, on anything subscribed.
The glue - accept the browser socket, hold one upstream, fan out:
export class RecentFeedDO { private sockets = new Set<WebSocket>(); private upstream?: WebSocket; constructor(private state: DurableObjectState, private env: Env) {}
// Browser side: same-origin /api/recent/live async fetch(_req: Request): Promise<Response> { const { 0: client, 1: server } = new WebSocketPair(); server.accept(); this.sockets.add(server); server.addEventListener("close", () => this.sockets.delete(server)); this.ensureUpstream(); // lazily open the ONE upstream return new Response(null, { status: 101, webSocket: client }); }
private async ensureUpstream() { if (this.upstream) return; // http(s) scheme for fetch(), NOT new WebSocket("wss://...") const url = this.env.SUPABASE_URL.replace(/^wss:/i, "https:") + `/realtime/v1/websocket?apikey=${this.env.SUPABASE_ANON_KEY}&vsn=1.0.0`; const res = await fetch(url, { headers: { Upgrade: "websocket" } }); const ws = res.webSocket!; ws.accept(); this.upstream = ws; // phx_join the PRIVATE channel with the anon JWT as access_token ws.send(JSON.stringify({ topic: "realtime:recent:public", event: "phx_join", payload: { config: { private: true }, access_token: this.env.SUPABASE_ANON_KEY }, ref: "1" })); // phx heartbeat every 20s (protocol needs <=25s) or Realtime times the socket out. // A setInterval also blocks DO hibernation - which is why the relay bills continuously. const hb = setInterval(() => ws.send(JSON.stringify( { topic: "phoenix", event: "heartbeat", payload: {}, ref: "hb" })), 20_000); ws.addEventListener("close", () => { clearInterval(hb); this.upstream = undefined; }); ws.addEventListener("message", (e) => { const msg = JSON.parse(e.data as string); if (msg.event !== "broadcast") return; const frame = JSON.stringify(msg.payload.payload); // the row we broadcast for (const s of this.sockets) s.send(frame); // fan out }); }}The reverse path: Supabase to a Worker
Section titled “The reverse path: Supabase to a Worker”Everything above is the Worker pulling Supabase (request in, response out). The other direction - the database pushing an event to a Worker - is a separate wire with its own tools.
- Database Webhooks fire on
INSERT/UPDATE/DELETEand POST a JSON (JavaScript Object Notation) payload (type,table,record,old_record) to any URL - point one at a Worker route. They are a convenience wrapper around a Postgres trigger callingpg_net, so they are async: the triggering transaction commits first, the HTTP (Hypertext Transfer Protocol) call fires after.22 pg_netis the engine underneath -net.http_post(url, body, headers)from any function or trigger. Use it directly for conditional or shaped calls (notify only on certain rows, a different Worker per tenant). Constraints: it fires only after commit, tops out around ~200 req/s, speakshttp_get/http_post/http_deleteonly (no PATCH/PUT; POST bodies are JSON), and responses land in an unlogged table for ~6h (lost on crash) - treat it as fire-and-forget.23
Use it for cache invalidation (a row changed, so a Worker purges the Cache API / KV (key-value) entry), fan-out, and audit or notification pipelines - anything event-driven that would otherwise force the Worker to poll.
Two rules, because the target is a public Worker URL:
- Authenticate the callback. Send a shared secret header (kept in Vault, read in the trigger) and verify it in the Worker; an unauthenticated webhook endpoint is an open write.
- Make the handler idempotent. A raw
pg_netcall is sent once and not resent, so a refused call is lost, and a call that times out may still have been processed; a retry job or apgmqqueue makes delivery at-least-once and duplicates the timed-out ones (11 to 14 % of 1,000 messages processed twice or more in the lab’s two NL04 runs, 2026-10-26). Key on the row id + version and no-op on repeats. Timeouts, batching and delivery are measured in pg_net under load.
Scheduled and async work
Section titled “Scheduled and async work”Three schedulers, and the split is where the work runs:
pg_cronruns SQL on a schedule inside Postgres - zero network hop, transactional with your data. Right for data maintenance. The paste-service app burns expired rows every 5 minutes withDELETE FROM pastes WHERE id IN (SELECT id FROM pastes WHERE expires_at < now() LIMIT 1000); theLIMIT 1000matters because an unboundedDELETEtakes row locks on every expired row in one long transaction, blocking concurrent writes to them and bloating the table (MVCC (multiversion concurrency control) readers are unaffected), so the bounded batch caps lock-hold and transaction size and the next run continues. Keep jobs to 8 or fewer concurrent, each under 10 minutes.24- Cron Triggers run a Worker on a schedule (
scheduled()handler, UTC (Coordinated Universal Time), 15-min wall-time).25 Right for app logic on a timer - external calls, orchestration. If the scheduled work is “run this SQL” it belongs in pg_cron; if it is “do this app thing” it belongs here. - Workflows are the durable option when the async work is multi-step and must survive failure:
step.do()units with per-step retry and state that persists minutes to weeks.
For async writes off the request path, two queues:
- Cloudflare Queues - producer and consumer are both Workers; batch, retry per message with
ack()/retry(), dead-letter, no egress charge.26 Buffer writes to Supabase so a slow write never blocks the user’s request, and absorb spikes. - pgmq (Supabase Queues) - a durable queue inside Postgres, drained by an Edge Function on a
pg_cronschedule (or a Worker viapgmq_public).27 Use it when the queue must be transactional with your data.
Rule of thumb: cross-service, app-level async -> Cloudflare Queues; transactional-with-the-row async -> pgmq. And pg_cron can enqueue into pgmq for a scheduled producer.
Querying external systems from the database (FDW)
Section titled “Querying external systems from the database (FDW)”The reverse path above pushes an event out; Foreign Data Wrappers pull the other way, at query time. A wrapper (supabase/wrappers, several now Wasm-based) maps an external system - another Postgres, ClickHouse, BigQuery, Snowflake, Stripe, Firebase, an S3 bucket, a REST API - to a foreign table you query with plain SQL.28 The data stays in the remote system; the foreign table is a live view, so a join against auth.users reflects remote state on every query rather than a stale copy (Supabase calls this QETL (query, extract, transform, load) - query in place instead of moving gigabytes first).
Point the S3 wrapper at an R2 bucket (R2 speaks the S3 API)29 and Postgres reads R2 data directly, with no Worker in the path; or read a third-party API (Stripe subscriptions, say) from SQL instead of a Worker round trip. For bulk movement a pg_cron job can insert into warehouse.x select ... from public.x on a schedule - fine for incremental loads, but a large batch taxes the database and a dedicated ETL (extract, transform, load) tool (Fivetran, Airbyte) is the better call there.
- FDWs (foreign data wrappers) do not enforce RLS. A foreign table is not row-secured, so never place one in an API-exposed schema. Keep wrappers in a private schema (a
stripeschema, awarehouseschema); if a column must reach the API, expose it through asecurity definerfunction with explicit filters and agrant executeto a specific role, not the raw table. - Every read is a synchronous call inside your transaction. Querying a foreign table blocks on the remote system’s latency and rate limits and holds a database connection while it waits. It is for analytical and administrative queries, not a hot request path - for that, cache the result at the edge or copy it in on a schedule.
Analytical reads: R2 SQL over Iceberg in R2
Section titled “Analytical reads: R2 SQL over Iceberg in R2”The FDW path keeps Postgres in the loop; the inverse is to move cold, append-only, or analytical data out of Postgres and query it where it is cheapest to store. R2 Data Catalog turns an R2 bucket into a managed Apache Iceberg catalog behind a standard Iceberg REST interface,30 and R2 SQL is a serverless, read-only query engine over those tables - no Postgres and no Worker in the path, and R2’s zero-egress model means the query pays no transfer even when the reader sits in another cloud or region.31
Land events (paste views, audit rows, request logs) as Iceberg tables on R2 - directly, or via Cloudflare Pipelines / Logpush - and keep Postgres for the hot transactional rows. Query the history from a Worker over the HTTP API or from wrangler r2 sql query:
wrangler r2 sql query <WAREHOUSE> \ "SELECT event, count(*) FROM logs.events WHERE ts > '2026-07-01' GROUP BY event ORDER BY 2 DESC LIMIT 20"It is real SQL - SELECT / WHERE / GROUP BY / HAVING / ORDER BY / LIMIT, JOINs, CTEs (common table expressions), subqueries, window functions, set operations, and exact or approximate aggregates - but it is a read-only analytics engine.32
When it fits: high-volume append-only or event data you want to query column-wise and keep out of the primary’s storage and egress budget - a lakehouse that other engines (Spark, Snowflake, DuckDB, ClickHouse) can also read through the same Iceberg catalog. When it does not: anything transactional, row-level-secured, or on the hot request path stays in Postgres.
Edge Functions vs Workers
Section titled “Edge Functions vs Workers”Both run server-side TypeScript; the difference is where, and it maps onto the geography model above.
- A Cloudflare Worker runs at the edge nearest the user (or, with Smart Placement, nearest the DB). It has the CF primitives - Cache API, Hyperdrive, Durable Objects, R2, Queues - and it is where this reference assumes your logic lives.
- A Supabase Edge Function (Deno) runs at the edge nearest the user by default, like a Worker - so its DB/Auth/Storage calls cross the same wire. You opt into DB co-location explicitly with regional invocation (the
x-regionheader /FunctionRegion)33, which makes those calls local at the cost of user distance. Either way it has none of the CF primitives.34
Put logic next to whatever it talks to most. A function that makes many DB calls and little user I/O wants to run in the DB region - a region-pinned Edge Function, or a Worker with Smart Placement pointed at the DB region; a function that is user-facing, needs the Cache API / a Durable Object / R2, or is part of the CF stack is a Worker. They are not exclusive - a Worker at the edge can invoke an Edge Function for the DB-heavy step.
Measured Supabase-side limits (edge-resilience W13/W18, 2026-08-15/16,
from supabase-lab): the
wall clock is a 150s idle timeout - past it the invoke dies with 504
IDLE_TIMEOUT. Cold start is ~1.4s only on the first invoke after
deploy plus idle; idle-cold calls then take 121-302ms against a 98ms
warm p50. Keep-warm pings save the ~100-200ms gap and do nothing about
the 1.4s.
Preview branches: a per-PR database, wired to a Worker preview
Section titled “Preview branches: a per-PR database, wired to a Worker preview”Supabase branching gives each pull request its own full Supabase project - an isolated Postgres plus Auth, Storage, and its own ref + keys - built by replaying your supabase/migrations from the PR.35 Cloudflare has no equivalent auto-wiring, so the CF-side pattern is: provision the branch, read its connection creds, and wrangler versions upload a Worker preview version bound to that branch DB. A preview version gets its own preview URL and does not roll out to the production route, so paste.erfi.io is untouched. On PR close, delete the branch.
What binds on the CF side
Section titled “What binds on the CF side”The Worker preview is bound to the branch DB with two --var overrides at upload:
wrangler versions upload \ --var SUPABASE_URL:"https://<branch-ref>.supabase.co" \ --var SUPABASE_SECRET_KEY:"<branch secret key>"versions upload publishes to a distinct preview URL and never rolls out to the production route.36 The app’s data path is REST (supabase-js), so the two vars are the whole binding. Read the branch’s ref (for the URL) and its secret key from the Management API - GET /v1/branches/{id} and GET /v1/projects/{branch-ref}/api-keys?reveal=true - rather than supabase branches get, which needs a linked project a fresh CI (continuous integration) checkout does not have.37
Hyperdrive is a static config pointing at one database; it is not auto-repointed per branch. A Hyperdrive-backed app therefore needs a Hyperdrive config created per branch to run the branch DB over the wire protocol. A config against the branch’s (IPv6-only) direct connection carries the full Worker -> Hyperdrive -> branch DB path and holds under concurrency - around 66 req/s at p95 ~105ms / p99 ~117ms in a 6-worker test. A per-branch Hyperdrive config is another CF resource to create on open and delete on close, so unless you specifically need the wire protocol on previews, the REST binding above is the lighter path.
A config failure mislabeled MIGRATIONS_FAILED
Section titled “A config failure mislabeled MIGRATIONS_FAILED”A branching failure can look like a data-plane problem. If the full branch deploy runs (native auto-branching, or a git-associated branch create) it executes configure -> migrate -> deploy -> seed, and the branch status reflects the whole deploy. If config.toml sets custom Auth (custom SMTP (Simple Mail Transfer Protocol), external OAuth) through env() secrets, a preview branch - which does not inherit the parent’s secrets - fails the configure step with a 401, and the branch is mislabeled MIGRATIONS_FAILED even though every migration is fine. Supply the branch secrets (a secrets payload at create, or a dotenvx supabase/.env.preview), or use the bare-branch + db push route that skips configure entirely.38
The branch lifecycle, compute sizing, this trap in full (with the evidence matrix and the two-status-fields / IPv6-pooler gotchas), and the complete CI workflow live in the Supabase preview-branch guide.
Cloudflare-native alternatives
Section titled “Cloudflare-native alternatives”For several Supabase features there is a Cloudflare primitive that may fit better depending on where the data needs to live. Pick the CF side when the workload is edge-shaped; keep it in Supabase when it belongs with your relational data and RLS.
| Need | Cloudflare | Supabase | Pick Cloudflare when |
|---|---|---|---|
| Object storage | R2 (zero egress) | Storage | Heavy egress or edge serving; Storage for RLS + built-in image transforms on one platform |
| Vectors / embeddings | Vectorize39 | pgvector | Pure approximate-nearest-neighbour (ANN) search at the edge; pgvector when vectors live beside relational data and RLS |
| Edge config / cache | KV | a table / Vault | Read-mostly config at the edge with no SQL |
| Edge SQL | D1 (SQLite) | Postgres | Edge-local, low-write, per-tenant; Postgres for the real relational store. Eight workload shapes run against both, plus Turso and a Durable Object: SQLite at the edge vs Supabase Postgres |
| Analytical / columnar query | R2 SQL + Data Catalog (Iceberg)31 | Postgres analytical queries / a warehouse FDW | Big append-only / event data queried column-wise, zero-egress across engines; Postgres for transactional, RLS’d rows |
| Queue | Queues | pgmq | Cross-service async; pgmq when it must be transactional with the row write |
| Schedule | Cron Triggers | pg_cron | App logic on a timer; pg_cron for in-DB SQL |
| AI (artificial intelligence) inference | Workers AI | (embeddings via pgvector) | Edge inference near the user |
Frequently combined, not either/or: R2 for the bytes + Postgres for the metadata; Vectorize for search + Postgres for the source rows.
Cost notes
Section titled “Cost notes”- Supabase compute is a per-project floor, billed hourly whether or not the DB is busy, and not covered by the spend cap (paid plans include ~$10/mo of compute credit, about one Micro)40. A read replica is billed as a full extra database (same compute size + 1.25x disk)40. Scale-to-zero exists only on the Nano tier and is gated (Supabase for Platforms)41. “Spin up a project / replica / branch per X” has a standing cost, not a per-request one.
- Egress is a unified Supabase quota, ~$0.09/GB (gigabyte) uncached vs ~$0.03/GB cached (Storage’s CDN (content delivery network), which is Cloudflare)40. Serving large objects from Storage bills egress; serving them from R2 is egress-free - the main reason to put big / cacheable bytes behind R2 + the Cache API and keep Postgres for metadata.
- On the CF side, Queues and Hyperdrive add no egress charge, and Hyperdrive’s caching / pooling is included in the Workers plan42 - the levers in “Cutting the round trip” are mostly free.
Data residency and compliance
Section titled “Data residency and compliance”Where each hop runs and stores data matters apart from latency, and this two-provider shape spreads it across Cloudflare and the AWS (Amazon Web Services) region under Supabase.
Where the data sits at rest
Section titled “Where the data sits at rest”| Surface | Default location | Pin it to a region | Compliance note |
|---|---|---|---|
| Supabase project | Region fixed at creation (eu-central-1) | Immutable in place; clone or migrate to move (a clone keeps the region) | Choose your compliance boundary on day one |
| Read replica | The replica’s own region | That region is the choice | A replica copies data onto that soil (a US (United States) replica of an EU (European Union) primary puts EU data on US soil) - a residency decision, not just latency |
| Durable Object | Wherever it was first created | env.NS.jurisdiction("eu") (also us, fedramp) | A location hint (weur, apac) is best-effort latency placement, NOT a compliance guarantee - jurisdiction is43 |
| Edge cache (Cache API) | Whatever PoP (point of presence) served the read (global) | Don’t cache regulated data | Global by default; fine for public data |
If a DO carries regulated data (the relay’s broadcast payload is your row data), pin its jurisdiction to match the database. The paste-service app pins its relay with RECENT_FEED.jurisdiction("eu") to keep even the transient public-feed payload in the database’s region - the feed is public and low-sensitivity, but the same one-line pin is exactly what a regulated payload would rely on. The DurableObjectId is still logged outside the jurisdiction for billing.
In transit
Section titled “In transit”| Hop | Default | Make it private / in-region |
|---|---|---|
| Browser -> CF PoP -> Worker | TLS terminates at the PoP nearest the user (may be outside your region) | Regional Services (Data Localization Suite, Enterprise) pins TLS termination + request processing to a chosen region; pair it with the DO jurisdiction4445 |
| Worker -> Supabase | Public-internet TLS (PostgREST or Hyperdrive to the public hostname) | Workers VPC (beta, free during beta): a TCP VPC Service (--app-protocol postgresql) + Hyperdrive (--service-id), or a VPC Network binding to a Tunnel / Cloudflare Mesh (network_id: "cf1:network") / Magic WAN on-ramp via fetch() / connect()4647 |
| DO transport / storage | TLS in flight; AES-256 (Advanced Encryption Standard) at rest (LUKS), CF-managed keys48 | n/a |
Supabase PrivateLink (AWS PrivateLink) applies to clients inside the same AWS network, so it does not by itself cover a Cloudflare Worker.49 For managed Supabase, a Workers VPC (virtual private cloud) tunnel or on-ramp must sit in a network that already has private reach to the instance (an AWS VPC consuming Supabase PrivateLink), since you cannot run cloudflared inside Supabase’s managed network - so this is the direct path for self-hosted Supabase or your own Postgres, and a bridge-VPC exercise for managed.50 The Magic WAN (wide area network) interop guide covers the on-ramp side.
Logs and audit
Section titled “Logs and audit”| Surface | Default | Residency control / note |
|---|---|---|
| CF Customer Logs | Stored per Cloudflare’s default | Customer Metadata Boundary (Enterprise) sets the storage region |
| DO logs + analytics | US-only | No EU option - under a Customer Metadata Boundary (CMB) set to EU the DO metrics tab does not populate |
| Postgres connection logging | Off (auto-on for High-Compliance / HIPAA projects) | The SOC 2 / HIPAA audit trail5152 |
wrangler tail + broadcast payload | Carries row data | Treat as a data flow, not just a debugging aid |
HIPAA (Health Insurance Portability and Accountability Act) needs a signed BAA (business associate agreement), the add-on, and the project marked High Compliance53; PHI (protected health information) must never land in a DO or edge cache that is not itself in scope.
Minimise what you have to protect. Burn-after-read and TTL (time to live) expiry are data-minimisation controls as much as features: they bound how long content exists and give a clean answer to an erasure request. The less regulated data you persist, and the fewer regions you copy it to, the smaller the compliance surface.
- Set the Supabase project region to your residency boundary at creation; avoid cross-region read replicas unless you accept the copy.
- Pin any DO that carries regulated data with
jurisdiction("eu" | "us" | "fedramp"); never rely on a location hint for compliance. - Add Regional Services on the Worker domain if the TLS-termination region matters; do not edge-cache regulated data.
- The Worker -> database hop is public-internet TLS by default; to make it private use Workers VPC (a TCP VPC Service + Hyperdrive, or a VPC Network bound to a Tunnel / Cloudflare Mesh / Magic WAN on-ramp) into a network that can privately reach the DB. Supabase PrivateLink alone does not cover the Worker path.
- For HIPAA / SOC (System and Organization Controls) 2: BAA + add-on, connection logging on, Customer Metadata Boundary for log residency, PHI kept out of DOs and cache.
What to do about it
Section titled “What to do about it”The practices the lab measurements support, grouped by the section they belong to. Module ids are edge-resilience drills in supabase-lab unless named otherwise; a row that is a design choice rather than a result says so.
Caching
- Delete
set-cookiefrom every Supabase response beforecaches.default.put, or the cache never fills: the gateway sets__cf_bmon every response,putrefuses it, andwaitUntilswallows the rejection (W04). - Serve the cached copy on any non-ok origin response, 403 included: the Workers runtime hands the worker’s
fetch()a 403 response for an unroutable origin rather than throwing, so a>= 500orcatch-only fallback never trips (W04, W24). A cold URL during an outage fails - the drill worker, once taught to treat 403 as origin failure, returned 503 to the client (artifact 2026-08-16); pre-warm the URLs a landing page needs. - The cache TTL (
max-age=60in the Storage snippet, Hyperdrive’s 60 s default) is a design choice; no run measured staleness against hit rate.
Clients and auth
- Do not wrap
supabase-jsreads in your own retry loop, and handle401 PGRST303yourself: on a.from().select()the client rode out three 503s in 4 attempts and about 7.0 s, and gave a claim rejection exactly 1 attempt in 9 ms (W02). The built-in retry covers only GET, HEAD and OPTIONS, on 503, 520 and network failures, so a POST.rpc()and every write are sent once: pass{ get: true }for a read-only RPC, and retry a write or a POST RPC yourself only where repeating it is safe.6 - Read
401 PGRST303as skew or expiry (iat+30 s accepted, +31 s refused) and401 PGRST301as a key PostgREST does not trust (W01). - After registering a third-party issuer, poll a real
/rest/v1call until it answers 200 before flipping traffic:resolved_jwkson the Management API precedes PostgREST trust by about 30 s for a first-time issuer and about 302 ms for a key set seen before (W01, W05). First-party signing-key rotation was not measured; the same poll is cheap insurance after one. - Shorten token lifetime with
PATCH /v1/projects/{ref}/config/auth {"jwt_exp": N}and expect the first token minted after the 200 to still carry the old lifetime; the new value applied about 6.5 s later (W03). Which value to pick is a design choice. - For a warm standby, register the primary’s issuer (
https://<primary-ref>.supabase.co/auth/v1) as third-party auth on the second project: a primary-issued user token then reads the second project’s API with 200 and no secret is copied -PATCH /config/auth {jwt_secret}returns 200 and changes nothing, so copying is not on offer anyway (W05, W01).
Hyperdrive and the wire
- Set
statement_timeouton the Hyperdrive role (ALTER ROLE hyperdrive_user SET statement_timeout = '...') and handle SQLSTATE57014in the Worker. The error signature was measured through the Management query endpoint and a pooler session, not through Hyperdrive: it readcanceling statement due to statement timeoutat 3467 ms wall for a 2 s timeout, and a lock wait ended in55P03at 4533 ms for a 3 slock_timeout(W20). Do not rely on connection-time options through the Supavisor transaction pooler:PGOPTIONS/options=are dropped andshow statement_timeoutreports the role default of2minwhether set or not (pdf-corpus-graph method notes). - Create every Hyperdrive config with
--origin-connection-limit, sized so that all configs’ limits plus the Data API pool plus Supabase’s own backends stay under the non-superuser ceiling: 87 client backends on Small, superusers included. A config without the flag read back 60 and held 60, against 54 slots left on Small with the Data API pool full (derived from the counts). Leave headroom above the sum: a limit of 5 held up to 11 connections, the only config seen above its limit (hyperdrive-direct H02, H03 run 3). Supabase’s own backends were counted at idle with no Auth, Storage or Realtime traffic; leave room for those services and for the dashboard’s SQL (the sizing rule is design, from the counts). Cloudflare’s pooling page gives the same advice for database limits and multiple configs.11 - Do not count on Hyperdrive’s origin connections closing within Cloudflare’s documented 10 minute idle timeout. Idle origin connections closed after 903-1324 s (H04, one run; H03 saw 965-1265 s); none closed at or before 600 s. Hyperdrive closes them (plain
disconnectionlines; H04 run 2,log_disconnectionson). A request on one connection keeps only that one open; the config’s other connections close on schedule (H04). Budgeting each config at its limit for at least 22 minutes after its last request (1324 s) is a design choice built on the two runs. - Handle
58000 Timed out while waiting for an open slot in the pool.(after about 15 s) and53300(under 1.2 s) as different faults in the Worker: the first is the config at its own limit, the second is Postgres out of slots for every non-superuser (hyperdrive-direct H02b, H02c, H02e).Connection terminated unexpectedlycame back on both paths. - During a Hyperdrive burst, expect 503 PGRST002 from the Data API for calls beyond PostgREST’s open connections and the free slots: those got PGRST002 in 719-2718 ms instead of waiting, and PostgREST logged a new pool 7.6-8.4 s after the burst (hyperdrive-direct H03 Q2, 9 arm-runs, plain fetch; pool timing from run 3’s logs). PGRST002 has other causes (a
db_poolabovemax_connections, terminatedauthenticatorbackends), so checkpg_stat_activityfor Hyperdrive roles before acting on it. supabase-js retries a 503 on a GET read on its own (W02), not on a POST.rpc()or a write;6 whether it rides out the 8 s was not run. The PGRST003 case for a full pool with slots free is on Data API capacity. - Do not terminate
authenticatorbackends to free slots: terminating 31 idle ones gave PGRST002 on the Data API for about 27 s (from the first PGRST002 log line to the new pool, run 3 log offsets) and 11 to 12 pings to get 3 good in a row (all three runs); terminating 2 gave no PGRST002 line (hyperdrive-direct H03). Terminating idle Hyperdrive backends frees slots only until the next burst: afterhd_awas terminated to 0, the next 80 holds reopened 60 (H03 run 3). The lasting lever is the origin connection limit; terminating Hyperdrive backends with queries in flight was not run. - Do not rely on the Management API query endpoint to inspect a full database: it logs in as
postgres, which is not a superuser, and was refused with53300at 87 client backends, in H02 run 1 for all 44 reads over 656 s. Readpg_stat_activityover a session you opened before the burst and keep it open (design). Reading it through a Hyperdrive config is not reliable: in H03 run 2, 3 of 5 snapshots through the limit 5 observer config were refused with53300(reading: those snapshots needed a new origin connection; hyperdrive-direct H02, H03).
Realtime
- Never drop and recreate a table that has an active subscription: the recreated name delivers nothing, a fresh name delivers in about 0.5 s (W12). Use stable canary tables only.
- Keep a private channel’s JWT lifetime short with the
jwt_explever above; the right value is a design choice.
Scheduled work and provisioning
pg_cronresumes across a project restart with no catch-up doubling (2 rows before, 5 after, on schedule; W23), but a scheduled instant that falls inside a restart or resize is skipped, never run late, and a run in flight is recorded failed and not re-run (CB04, CB05, 2026-10-28; pg_cron behaviour). Make once-per-period jobs work out their own pending work rather than assume the previous run happened.- On a freshly provisioned project or preview branch, retry Storage
TenantNotFoundand429 SlowDownfor the first minutes instead of failing the deploy: the storage tenant lagsACTIVE_HEALTHY(W21), and health reports per service, so pollGET /v1/projects/{ref}/health?services=auth&services=rest&services=dbrather than project status. Source: supabase-lab provisioning note, 2026-08-03; platform-facts F02d asserts the same and has no recorded run.
Decision guide
Section titled “Decision guide”The same decision as a list:
- Data access - need RLS, Auth, Storage, or the SDK (software development kit):
supabase-js/ PostgREST, with RLS enforced by the key. A hot read you can cache: Worker Cache API. Joins, transactions, or faster writes: Hyperdrive, where you own authz. - Auth check - hot path, latency matters: edge JWT verify (
jose+ JWKS). Revocation must take effect now:getUser()round-trip. - Realtime push - public data, anon key in the browser OK: browser-direct socket. Keep the key server-side (CSP stays
self): Durable Object relay. - Per-PR preview - the app talks REST: preview binding (the two REST vars). The app needs the wire protocol: per-branch Hyperdrive config.
Reproducing
Section titled “Reproducing”The latency harness is not public: it is a standalone module Worker (pg, postgres, jose) in its own repository, not wired into the app. To rebuild it, recreate a least-privilege role + Hyperdrive config per the setup above and give the Worker SUPABASE_ANON_KEY / SUPABASE_SERVICE_KEY / PG_TXN / PG_SESSION / TEST_JWT as dev vars. The measurements were driven with:
wrangler dev --remote --config bench/wrangler.jsonc --port 8799curl 'http://localhost:8799/reads?n=40'curl 'http://localhost:8799/writes?n=20'curl 'http://localhost:8799/auth?n=30'The connection-budget figures come from supabase-lab’s hyperdrive-direct experiment, which provisions its own Small project, Worker and Hyperdrive configs and deletes them at the end of the run. From the lab’s root, with a Pro organization and Cloudflare credentials in the environment as its RUNLOG describes, bun harness/src/run.ts --where local --experiment hyperdrive-direct --only H02 --destructive takes about 21 minutes and --only H03 about 36.
Measured from the Singapore edge to eu-central-1 (Frankfurt), 2026-07-14. Absolute latencies are distance-dominated; the ratios and path choices generalise (see Reading the numbers).
Modules
Section titled “Modules”References
Section titled “References”-
Cloudflare, “Supabase (third-party integrations),” Cloudflare Docs. https://developers.cloudflare.com/workers/databases/third-party-integrations/supabase/ ↩
-
Supabase, “Database Functions,” Supabase Docs. https://supabase.com/docs/guides/database/functions ↩
-
Cloudflare, “Smart Placement,” Cloudflare Docs. https://developers.cloudflare.com/workers/configuration/smart-placement/ ↩
-
Supabase, “Read replicas,” Supabase Docs. https://supabase.com/docs/guides/platform/read-replicas ↩
-
Supabase, “Connecting to your database,” Supabase Docs. https://supabase.com/docs/guides/database/connecting-to-postgres ↩
-
Supabase, “How to do automatic retries with supabase-js,” Supabase Docs. https://supabase.com/docs/guides/api/automatic-retries-in-supabase-js ↩ ↩2 ↩3
-
Supabase, “Serverless drivers,” Supabase Docs. https://supabase.com/docs/guides/database/connecting-to-postgres/serverless-drivers ↩
-
Cloudflare, “Connect Hyperdrive to a Supabase Postgres database,” Cloudflare Docs. https://developers.cloudflare.com/hyperdrive/examples/connect-to-postgres/postgres-database-providers/supabase/ ↩
-
Cloudflare, “Hyperdrive query caching,” Cloudflare Docs. https://developers.cloudflare.com/hyperdrive/configuration/query-caching/ ↩
-
Cloudflare, “Hyperdrive limits,” Cloudflare Docs (fetched 2026-10-23). https://developers.cloudflare.com/hyperdrive/platform/limits/ ↩ ↩2 ↩3 ↩4
-
Cloudflare, “Hyperdrive connection pooling,” Cloudflare Docs (fetched 2026-10-23). https://developers.cloudflare.com/hyperdrive/concepts/connection-pooling/ ↩ ↩2 ↩3 ↩4
-
Supabase, “JSON Web Tokens (JWTs),” Supabase Docs. https://supabase.com/docs/guides/auth/jwts ↩
-
Supabase, “Server-side auth (@supabase/ssr),” Supabase Docs. https://supabase.com/docs/guides/auth/server-side ↩
-
Cloudflare, “Rate limiting binding,” Cloudflare Docs. https://developers.cloudflare.com/workers/runtime-apis/bindings/rate-limit/ ↩
-
Cloudflare, “Cache API,” Cloudflare Docs. https://developers.cloudflare.com/workers/runtime-apis/cache/ ↩ ↩2
-
Supabase, “S3 authentication (Storage),” Supabase Docs. https://supabase.com/docs/guides/storage/s3/authentication ↩
-
Supabase, “Realtime protocol,” Supabase Docs. https://supabase.com/docs/guides/realtime/protocol ↩
-
Supabase, “Realtime benchmarks,” Supabase Docs. https://supabase.com/docs/guides/realtime/benchmarks ↩
-
Supabase, “Broadcast,” Supabase Docs. https://supabase.com/docs/guides/realtime/broadcast ↩
-
Cloudflare, “Durable Objects: use WebSockets,” Cloudflare Docs. https://developers.cloudflare.com/durable-objects/best-practices/websockets/ ↩
-
Supabase, “Realtime or Pipelines? How to choose the right tool,” Supabase Blog, 2026-05-05 (fetched 2026-10-10). https://supabase.com/blog/realtime-or-pipelines-how-to-choose-the-right-tool ↩
-
Supabase, “Database Webhooks,” Supabase Docs. https://supabase.com/docs/guides/database/webhooks ↩
-
Supabase, “pg_net,” Supabase Docs. https://supabase.com/docs/guides/database/extensions/pg_net ↩
-
Supabase, “Cron (pg_cron),” Supabase Docs. https://supabase.com/docs/guides/cron ↩
-
Cloudflare, “Cron Triggers,” Cloudflare Docs. https://developers.cloudflare.com/workers/configuration/cron-triggers/ ↩
-
Cloudflare, “Queues,” Cloudflare Docs. https://developers.cloudflare.com/queues/ ↩
-
Supabase, “Queues (pgmq),” Supabase Docs. https://supabase.com/docs/guides/queues ↩
-
Supabase, “Foreign Data Wrappers,” Supabase Docs. https://supabase.com/docs/guides/database/extensions/wrappers/overview ↩
-
Cloudflare, “R2,” Cloudflare Docs. https://developers.cloudflare.com/r2/ ↩
-
Cloudflare, “R2 Data Catalog,” Cloudflare Docs. https://developers.cloudflare.com/r2/data-catalog/ ↩
-
Cloudflare, “R2 SQL,” Cloudflare Docs. https://developers.cloudflare.com/r2-sql/ ↩ ↩2
-
Cloudflare, “R2 SQL reference,” Cloudflare Docs. https://developers.cloudflare.com/r2-sql/sql-reference/ ↩
-
Supabase, “Edge Functions: regional invocation,” Supabase Docs. https://supabase.com/docs/guides/functions/regional-invocation ↩
-
Supabase, “Edge Functions,” Supabase Docs. https://supabase.com/docs/guides/functions ↩
-
Supabase, “Branching,” Supabase Docs. https://supabase.com/docs/guides/deployment/branching ↩
-
Cloudflare, “wrangler versions upload,” Cloudflare Docs. https://developers.cloudflare.com/workers/wrangler/commands/#versions-upload ↩
-
Supabase, “Management API: create a branch,” Supabase Docs. https://supabase.com/docs/reference/api/v1-create-a-branch ↩
-
Supabase, “Branching configuration and secrets,” Supabase Docs. https://supabase.com/docs/guides/deployment/branching/configuration ↩
-
Cloudflare, “Vectorize,” Cloudflare Docs. https://developers.cloudflare.com/vectorize/ ↩
-
Supabase, “Pricing,” Supabase. https://supabase.com/pricing ↩ ↩2 ↩3
-
Supabase, “Supabase for Platforms,” Supabase Docs. https://supabase.com/docs/guides/integrations/supabase-for-platforms ↩
-
Cloudflare, “Workers Pricing,” Cloudflare Docs. https://developers.cloudflare.com/workers/platform/pricing/ ↩
-
Cloudflare, “Durable Objects: data location and jurisdictions,” Cloudflare Docs. https://developers.cloudflare.com/durable-objects/reference/data-location/ ↩
-
Cloudflare, “Regional Services,” Cloudflare Docs. https://developers.cloudflare.com/data-localization/regional-services/ ↩
-
Cloudflare, “Data Localization Suite,” Cloudflare Docs. https://developers.cloudflare.com/data-localization/ ↩
-
Cloudflare, “Workers VPC,” Cloudflare Docs. https://developers.cloudflare.com/workers-vpc/ ↩
-
Cloudflare, “Workers VPC: VPC Services,” Cloudflare Docs. https://developers.cloudflare.com/workers-vpc/configuration/vpc-services/ ↩
-
Cloudflare, “Durable Objects: data security,” Cloudflare Docs. https://developers.cloudflare.com/durable-objects/reference/data-security/ ↩
-
Supabase, “PrivateLink,” Supabase Docs. https://supabase.com/docs/guides/platform/privatelink ↩
-
Cloudflare, “Connect Hyperdrive to a private database,” Cloudflare Docs. https://developers.cloudflare.com/hyperdrive/configuration/connect-to-private-database/ ↩
-
Supabase, “Postgres connection logging,” Supabase Docs. https://supabase.com/docs/guides/platform/postgres-connection-logging ↩
-
Supabase, “SOC 2 compliance,” Supabase Docs. https://supabase.com/docs/guides/security/soc-2-compliance ↩
-
Supabase, “HIPAA compliance,” Supabase Docs. https://supabase.com/docs/guides/security/hipaa-compliance ↩
Linked from
- @supabase/server auth modes on Edge Functions and Workers
- Caching with Cloudflare Workers: when to use what
- How this site is written
- Media transformation architecture
- pg_net on Supabase under load
- Read/write split for Postgres at the Cloudflare edge
- RLS without Supabase Auth: JWT claims over the wire
- Static site hosting on Supabase
- Supabase Auth end to end
- Supabase Data API connection pool and capacity
- Supabase data residency and sovereignty
- Supabase Pipelines (public alpha): what a PAT reaches and how the engine replicates
- Supabase read replicas: how requests reach them and what they cost
- Supabase Realtime: filters, disconnect loss, Broadcast Replay and binary
- Supabase Storage surface: direct SQL deletes, list pagination, S3 key handling
- Turso, D1, Durable Objects and Supabase Postgres from one Cloudflare Worker
- Worker-to-Worker authentication with ES256 JWTs on Cloudflare