Skip to content

MegaPortal/closevector-nextjs-demo

Repository files navigation

CloseVector + Next.js Starter

A Next.js template that uses CloseVector as the database, CloseVector is a vector database that enables vector similarity search, which can run on both browser and server side.

This demo is a rewritten version of postgres-pgvector provided by Vercel.

This demo aims to demonstrate how to use CloseVector in Next.js, and how to use CloseVector to implement a simple search engine. Also, it demonstrates the inserting performance of CloseVector

Demo

https://closevector-nextjs-demo.vercel.app/

1|300X300 2|300X300 3|300X300

How to Use

Getting CloseVector Access Key

If you want to use the embedding API provided by CloseVector, as demonstrated in this demo, you need to obtain an access key from CloseVector.

Alternatively, you can implement your own embedding using the OpenAI API by extending the class CloseVectorEmbeddings and passing it to useCloseVectorManager.

Deploying

You can choose from one of the following two methods to use this repository:

One-Click Deploy

Deploy with Vercel

Clone and Deploy

Execute create-next-app with pnpm to bootstrap the example:

pnpm create next-app --example https://github.com/MegaPortal/closevector-nextjs-demo

Once that's done, copy the .env.example file in this directory to .env.local (which will be ignored by Git):

cp .env.example .env.local

Then open .env.local and set the environment variables to match the ones in your Vercel Storage Dashboard.

Next, run Next.js in development mode:

pnpm dev

Deploy it to the cloud with Vercel (Documentation).