A minimal Next.js starter for instant, typo-tolerant search over Postgres data. Algolia indexes and searches the products, Supabase stores them, and the Algolia connector keeps the index in sync — no sync code in the app. Deploy it, seed the database, connect the two from their dashboards, and search is live.
Live demo: algolia-supabase-vercel-starter.vercel.app
The button installs both integrations on your new project — Supabase provisions a Postgres database, Algolia provisions an application — and injects their environment variables. No manual configuration.
Create and seed a products table by pasting demo/seed.sql into
the Supabase SQL Editor (open your project → SQL Editor) and running it —
this demo uses a 12-column table mixing searchable and internal-only fields.
The
demo/folder holds the sample dataset and transformation used by this walkthrough — replace them with your own data when adapting the template.
Create the connector from the Algolia dashboard → Data sources → Connectors → Supabase:
- Connect Supabase - connect to Supabase directly to prefill all the database values from the Advanced Configuration section
- Transformation — paste
demo/transform.jsinto the wizard's transformation editor; it mapsidtoobjectID, returns only the searchable attributes, and derivesin_stockfromquantity— a transformation can compute fields, not just strip them. Check the preview: the internal-only fields (cost_price,supplier_id,internal_notes,stock_location) must be gone. - Destination — set the index name to
products. - Task — run a full reindex. Add a schedule if you want recurring syncs.
Reload your deployment — search is live.
The sidebar filters need faceting enabled. In the Algolia dashboard, open index
products → Configuration → Facets and add:
category,price,rating— searchable facets for the sidebarin_stock— set as filter-only (powers the "Hide out of stock" toggle)
git clone https://github.com/algolia/algolia-supabase-vercel-starter && cd algolia-supabase-vercel-starter
npm install
npx vercel link # link to the project you deployed
npx vercel env pull .env.local
npm run devOpen http://localhost:3000.
The integrations inject these environment variables. The Algolia integration may
use bare (ALGOLIA_*) or NEXT_PUBLIC_-prefixed names — next.config.ts
maps either shape. Only the two Algolia search values are exposed to the browser:
| Variable | Purpose | Browser-safe? |
|---|---|---|
NEXT_PUBLIC_ALGOLIA_APP_ID |
Identifies your Algolia application | ✅ exposed as NEXT_PUBLIC_ALGOLIA_APP_ID |
NEXT_PUBLIC_ALGOLIA_SEARCH_API_KEY |
Search-only key used by the frontend | ✅ exposed as NEXT_PUBLIC_ALGOLIA_SEARCH_API_KEY |
POSTGRES_URL |
Supabase connection string for the product page | ❌ server-side only |
NEXT_PUBLIC_ALGOLIA_WRITE_API_KEY |
Indexing key | ❌ unused by the app; the connector indexes from the dashboard |
NEXT_PUBLIC_ prefix
would inline it into the browser bundle if referenced. This app never references it.
Key files:
app/page.tsx— landing page rendering the search experiencecomponents/search/search-experience.tsx— InstantSearch UI (algoliasearchlite client)app/products/[id]/page.tsx— product page served from Supabase, showing the DB-only fields
- Add authentication before exposing any write path — this template is read-only.
- Enable incremental sync with a soft-delete column so removals propagate to the index.
- Trigger the connector task from the Ingestion API as a server-side extension instead of the dashboard schedule.
