Documentation

Learn how to integrate vector search and RAG capabilities into your Next.js application.

Getting Started

Complete these steps to set up vector search in your application.

Step 1

Database Setup

Create a Postgres database with either:

  • Vercel Postgres (recommended for quick start)
  • NeonDB (recommended for production)
Step 2

Environment Variables

1# Database
2POSTGRES_URL="postgres://..."
3
4# OpenAI
5OPENAI_API_KEY="sk-..."
6
7# Inngest (optional, for background jobs)
8INNGEST_EVENT_KEY="..."
9INNGEST_SIGNING_KEY="..."
Step 3

Enable pgvector

Connect to your database and run:

1CREATE EXTENSION vector;
Step 4

Create Tables

Using Prisma schema:

1model items {
2  id        BigInt                 @id @default(autoincrement())
3  embedding Unsupported("vector")?
4  metadata  Json?                  @default("{}")
5  createdAt DateTime              @default(now())
6  updatedAt DateTime              @updatedAt
7}

Need help? Check out our GitHub repository or join our community.