Skip to main content

Supabase Knowledge Search

Z-Shell Knowledge Search indexes public wiki documentation into Supabase so maintainers can run source-linked semantic search across the docs.

GitHub repositories and the wiki remain the source of truth. Supabase stores derived metadata, chunks, and embeddings only.

Secretsโ€‹

  • SUPABASE_URL: Supabase project API URL.
  • SUPABASE_DB_URL: direct Postgres connection string for server-side ingestion.
  • SUPABASE_SECRET_KEY: server-only sb_secret_* API key for maintainer CLI calls.
  • SB_SECRET_KEY: the same sb_secret_* value exposed to the knowledge-search Edge Function.
  • OPENAI_API_KEY: embedding provider key.

Do not expose server-side secrets in browser code.

Indexโ€‹

pnpm knowledge-search:index

The indexer scans docs/, community/, and ecosystem/ Markdown and MDX files, chunks the content, generates embeddings, and upserts rows into the private docs_search schema.

Queryโ€‹

pnpm knowledge-search:query "release policy"

The query command calls the knowledge-search Edge Function with SUPABASE_SECRET_KEY in the apikey header and prints source-linked results.

Access Controlโ€‹

The docs_search schema is private. Public search uses the public.match_public_docs function, which returns only sources marked public.

The knowledge-search Edge Function has verify_jwt = false because Supabase secret keys are API keys, not JWTs. The function checks the apikey header itself before running a query.