← all repositories
supabase-community/nextjs-openai-doc-search

Your docs, chunked, embedded, and interrogated

It turns your MDX docs into an AI search engine by retrieving relevant chunks from Postgres and feeding them into OpenAI prompts.

★1.7k stars TypeScript RAG · SearchChat Assistants
nextjs-openai-doc-search
Not currently ranked — collecting fresh signals.
star history

What it does

This Next.js starter ingests .mdx files from your pages directory, splits them into chunks, and stores 1536-dimension embeddings in a Supabase Postgres database using pgvector. At runtime, an Edge Function turns a user’s query into an embedding, performs vector similarity search to find the most relevant chunks, and injects that context into an OpenAI GPT-3 text completion prompt, streaming the synthesized answer back to the client.

The interesting bit

The build-time generate-embeddings script checksums each .mdx file to avoid regenerating embeddings for unchanged docs. That small bookkeeping detail is where the boring infrastructure work actually pays off.

Key highlights

  • Build-time embedding generation with incremental updates via file checksums.
  • Vector similarity search powered by Postgres pgvector.
  • Streams OpenAI completion responses to the client via an Edge Function.
  • Database schema and local Supabase setup managed through migrations.
  • Ships as a deployable Vercel template with Supabase integration.

Caveats

  • Explicitly targets the older OpenAI Text Completion API and GPT-3, not the newer Chat Completions format.
  • Requires documentation to be in .mdx format by default; plain .md files need renaming.
  • It is template code, not a reusable library: expect to fork and modify the plumbing.

Verdict

Worth a look if you run Next.js and Supabase and want a concrete, deployable example of doc RAG without writing the wiring from scratch. Skip it if you need a framework-agnostic or drop-in search component.

Frequently asked

What is supabase-community/nextjs-openai-doc-search?
It turns your MDX docs into an AI search engine by retrieving relevant chunks from Postgres and feeding them into OpenAI prompts.
Is nextjs-openai-doc-search open source?
Yes — supabase-community/nextjs-openai-doc-search is open source, released under the Apache-2.0 license.
What language is nextjs-openai-doc-search written in?
supabase-community/nextjs-openai-doc-search is primarily written in TypeScript.
How popular is nextjs-openai-doc-search?
supabase-community/nextjs-openai-doc-search has 1.7k stars on GitHub.
Where can I find nextjs-openai-doc-search?
supabase-community/nextjs-openai-doc-search is on GitHub at https://github.com/supabase-community/nextjs-openai-doc-search.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.