Skip to content

Learn how to add a Semantic Search UI to your Next.js application with Inngest and Neon

License

Notifications You must be signed in to change notification settings

inngest/nextjs-inngest-neon-auto-embeddings

Repository files navigation

YouTube video thumbnail

What we'll build

Add a semantic search in our Next.js CRM application using Neon and Inngest. Inngest will generate and store embeddings every time a contact is created.

Tech Stack

Deploying the app

Before you begin, ensure you have:

Getting Started

1. Create a Neon project

If you do not have one already, create a Neon project:

  1. Navigate to the Projects page in the Neon Console.
  2. Click New Project.
  3. Specify your project settings and click Create Project.

2. Initialize the project

To create the database and tables, first, clone the repository:

git clone [email protected]:inngest/nextjs-inngest-neon-auto-embeddings.git

Then, install the dependencies:

cd nextjs-inngest-neon-auto-embeddings
npm install

Create a .env.local file with the following variables:

DATABASE_URL=<your-neon-database-url>

Finally, run the drizzle migrations:

npx drizzle-kit generate
npx drizzle-kit migrate

You Neon database is now ready to work with your application.

3. Enabling Logical Replication on your database

The Inngest Integration relies on Neon’s Logical Replication feature to get notified upon database changes.

Navigate to your Neon Project using the Neon Console and open the Settings > Logical Replication page. From here, follow the instructions to enable Logical Replication:

Neon dashboard settings with option to enable logical replication

4. Configuring the Inngest integration

Your Neon database is now ready to work with Inngest.

To configure the Inngest Neon Integration, navigate to the Inngest Platform, open the Integrations page, and follow the instructions of the Neon Integration installation wizard:

Neon integration card inside the Inngest integrations page

The Inngest Integration requires Postgres admin credentials to complete its setup. These credentials are not stored and are only used during the installation process.

Neon authorization step inside the Inngest integrations page

You can find your admin Postgres credentials in your Neon project dashboard’s Connection Details section:

Connection details section on the Neon console dashboard

5. Deploy on Vercel

Using the following button to create a new Vercel project using this repository: Deploy with Vercel

Once your Vercel project is deployed, navigate to the Inngest Vercel Integration page and click Connect Account.

Once your Vercel project is connected, navigate to your Environment Variables page and add the following variables:

  • OPENAI_API_KEY - Your OpenAI API key
  • DATABASE_URL - Your Neon database URL

You application is now deployed on Vercel, properly linked to Neon and Inngest!


Licensed under the Apache License.

About

Learn how to add a Semantic Search UI to your Next.js application with Inngest and Neon

Topics

Resources

License

Stars

Watchers

Forks