Skip to content

AL1: the search on Workers and Supabase - #2

Merged
pullely merged 1 commit into
mainfrom
orun/AL-2-the-search-on-workers-and-supabase
Nov 11, 2026
Merged

pullely merged 1 commit into
mainfrom
orun/AL-2-the-search-on-workers-and-supabase

Conversation

@pullely

@pullely pullely commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

algolia/algolia-supabase-vercel-starter (da3f27b) in apps/web on Next.js 16.3.8, built by @opennextjs/cloudflare into one Worker with Static Assets. The Supabase integration's POSTGRES_URL becomes a Supabase project's Postgres reached through the HYPERDRIVE binding: lib/db.ts keeps upstream's query(text, params) and runs it on one pg Client per request (a WeakMap keyed by the request's ExecutionContext, connected once, a failed connect not kept), with no ssl override; upstream's own pool over POSTGRES_URL without a Cloudflare context. next.config ships pg-cloudflare whole (outputFileTracingIncludes): the Node trace copies only its empty default export and OpenNext's bundle failed "Could not resolve pg-cloudflare". The Algolia application id and search-only key are optional Orun secrets (optionalSecretEnv), unset for the build and pushed to the Worker as secrets after it (tooling/wire/worker-secrets.mjs); lib/algolia.ts reads them per request and the page (force-dynamic) hands them to SearchExperience as props — next.config's NEXT_PUBLIC_ inlining is gone. Without them the page keeps the template's notice, naming the secrets, and lists the catalogue from Postgres under it (components/catalogue.tsx, the hit cards' markup, searchable fields only). demo/seed.sql becomes packages/db migrations 010 (its table), 020 (row-level security, guarded) and 030 (its twenty upserts, byte for byte), applied by infra/db-migrate after the infra/terraform/supabase project and the infra/terraform/cloudflare-hyperdrive config exist and before the Worker deploys; pnpm db:migrate applies the same files locally (ledger in schema local_migrations). /api/health answers 200 only with the table migrated and RLS on, and says whether search is connected. Geist comes from the geist package (next/font/google fails on GitHub's runners). tests/web (the per-request client, the Algolia config, the health check, the catalogue, the page's two states, the product queries, the real InstantSearch UI rendered in jsdom against an in-process Algolia stand-in — query, facets, the stock toggle, the app id and key it sends — and the wrangler render) and tests/db (the manifest, the local migrator, the table's columns, the demo rows held to upstream's seed by sha256, the connector's transformation, row-level security, on PGlite). typecheck, lint, test and build are green; wrangler dev over the build lists the twenty products and serves their pages from a migrated database, and with the Algolia secrets set a headless Chrome's InstantSearch renders 20 hits, the facets and the stock toggle from a stand-in. The Worker is 1147 KiB gzipped (Workers Free).

🤖 Generated with Claude Code

algolia/algolia-supabase-vercel-starter (da3f27b) in apps/web on Next.js 16.3.8, built by @opennextjs/cloudflare into one Worker with Static Assets. The Supabase integration's POSTGRES_URL becomes a Supabase project's Postgres reached through the HYPERDRIVE binding: lib/db.ts keeps upstream's query(text, params) and runs it on one pg Client per request (a WeakMap keyed by the request's ExecutionContext, connected once, a failed connect not kept), with no ssl override; upstream's own pool over POSTGRES_URL without a Cloudflare context. next.config ships pg-cloudflare whole (outputFileTracingIncludes): the Node trace copies only its empty default export and OpenNext's bundle failed "Could not resolve pg-cloudflare". The Algolia application id and search-only key are optional Orun secrets (optionalSecretEnv), unset for the build and pushed to the Worker as secrets after it (tooling/wire/worker-secrets.mjs); lib/algolia.ts reads them per request and the page (force-dynamic) hands them to SearchExperience as props — next.config's NEXT_PUBLIC_ inlining is gone. Without them the page keeps the template's notice, naming the secrets, and lists the catalogue from Postgres under it (components/catalogue.tsx, the hit cards' markup, searchable fields only). demo/seed.sql becomes packages/db migrations 010 (its table), 020 (row-level security, guarded) and 030 (its twenty upserts, byte for byte), applied by infra/db-migrate after the infra/terraform/supabase project and the infra/terraform/cloudflare-hyperdrive config exist and before the Worker deploys; pnpm db:migrate applies the same files locally (ledger in schema local_migrations). /api/health answers 200 only with the table migrated and RLS on, and says whether search is connected. Geist comes from the geist package (next/font/google fails on GitHub's runners). tests/web (the per-request client, the Algolia config, the health check, the catalogue, the page's two states, the product queries, the real InstantSearch UI rendered in jsdom against an in-process Algolia stand-in — query, facets, the stock toggle, the app id and key it sends — and the wrangler render) and tests/db (the manifest, the local migrator, the table's columns, the demo rows held to upstream's seed by sha256, the connector's transformation, row-level security, on PGlite). typecheck, lint, test and build are green; wrangler dev over the build lists the twenty products and serves their pages from a migrated database, and with the Algolia secrets set a headless Chrome's InstantSearch renders 20 hits, the facets and the stock toggle from a stand-in. The Worker is 1147 KiB gzipped (Workers Free).

Co-Authored-By: Claude <noreply@anthropic.com>
Orun-Task: AL-2
@pullely
pullely merged commit 3e94e20 into main Nov 11, 2026
2 checks passed
@pullely
pullely deleted the orun/AL-2-the-search-on-workers-and-supabase branch November 11, 2026 21:51
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