Skip to content

KY1: the profiles table on Workers and Supabase - #2

Merged
pullely merged 1 commit into
mainfrom
orun/KY-2-the-profiles-table-on-workers-and-supabase
Nov 4, 2026
Merged

pullely merged 1 commit into
mainfrom
orun/KY-2-the-profiles-table-on-workers-and-supabase

Conversation

@pullely

@pullely pullely commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

vercel/examples storage/postgres-kysely (de86723) in apps/web on Next.js 16.3.8, built by @opennextjs/cloudflare into one Worker with Static Assets. Vercel Postgres becomes a Supabase project's Postgres reached through the HYPERDRIVE binding: lib/kysely.ts keeps upstream's Database types, db and sql, and db is a Proxy whose every property read resolves to the current request's Kysely client (kysely-postgres-js over postgres.js, kept in a WeakMap against the request's ExecutionContext; POSTGRES_URL without a Cloudflare context). postgres.js keeps its default type fetch: kysely-postgres-js reserves a connection per query, and postgres.js 3.4.9 never resolves a reserve on a fresh connection with fetch_types off (the spike's finding, risk KY-K). The profiles table — upstream's Kysely schema compiled — and row-level security are packages/db migrations that infra/db-migrate applies after the infra/terraform/supabase project and the infra/terraform/cloudflare-hyperdrive config exist and before the Worker deploys; lib/seed.ts keeps only its three INSERTs ON CONFLICT (email) DO NOTHING, the table seeds an empty table and reads the seed back past Hyperdrive's cache, and says when the migrations have not run; pnpm db:migrate applies the same files to a local database through Kysely's Migrator, its ledger in schema kysely. /api/health answers 200 only with the table migrated and RLS on. tests/web (the per-request client and its options, timeAgo, the table's branches, the seed, the health check, the wrangler render) and tests/db (the manifest and the local migrator's list, the table's columns and a racing seed, row-level security, on PGlite). typecheck, lint, test and build are green; wrangler dev over the build seeds and lists the three profiles from a migrated database and reports the migrations pending on a blank one; the Worker is 1.45 MiB gzipped.

🤖 Generated with Claude Code

vercel/examples storage/postgres-kysely (de86723) in apps/web on Next.js 16.3.8, built by @opennextjs/cloudflare into one Worker with Static Assets. Vercel Postgres becomes a Supabase project's Postgres reached through the HYPERDRIVE binding: lib/kysely.ts keeps upstream's Database types, db and sql, and db is a Proxy whose every property read resolves to the current request's Kysely client (kysely-postgres-js over postgres.js, kept in a WeakMap against the request's ExecutionContext; POSTGRES_URL without a Cloudflare context). postgres.js keeps its default type fetch: kysely-postgres-js reserves a connection per query, and postgres.js 3.4.9 never resolves a reserve on a fresh connection with fetch_types off (the spike's finding, risk KY-K). The profiles table — upstream's Kysely schema compiled — and row-level security are packages/db migrations that infra/db-migrate applies after the infra/terraform/supabase project and the infra/terraform/cloudflare-hyperdrive config exist and before the Worker deploys; lib/seed.ts keeps only its three INSERTs ON CONFLICT (email) DO NOTHING, the table seeds an empty table and reads the seed back past Hyperdrive's cache, and says when the migrations have not run; pnpm db:migrate applies the same files to a local database through Kysely's Migrator, its ledger in schema kysely. /api/health answers 200 only with the table migrated and RLS on. tests/web (the per-request client and its options, timeAgo, the table's branches, the seed, the health check, the wrangler render) and tests/db (the manifest and the local migrator's list, the table's columns and a racing seed, row-level security, on PGlite). typecheck, lint, test and build are green; wrangler dev over the build seeds and lists the three profiles from a migrated database and reports the migrations pending on a blank one; the Worker is 1.45 MiB gzipped.

Co-Authored-By: Claude <noreply@anthropic.com>
Orun-Task: KY-2
@pullely
pullely merged commit e6232d3 into main Nov 4, 2026
2 checks passed
@pullely
pullely deleted the orun/KY-2-the-profiles-table-on-workers-and-supabase branch November 4, 2026 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants