Repository navigation
AL1: the search on Workers and Supabase - #2
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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