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.
- Next.js - React framework
- Neon - Serverless Postgres database
- Inngest - Serverless Workflow engine
- Drizzle - Database ORM
- OpenAI - Embedding API
Before you begin, ensure you have:
If you do not have one already, create a Neon project:
- Navigate to the Projects page in the Neon Console.
- Click New Project.
- Specify your project settings and click Create 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.
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:
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:
The Inngest Integration requires Postgres admin credentials to complete its setup. These credentials are not stored and are only used during the installation process.
You can find your admin Postgres credentials in your Neon project dashboard’s Connection Details section:
Using the following button to create a new Vercel project using this repository:
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 keyDATABASE_URL
- Your Neon database URL
You application is now deployed on Vercel, properly linked to Neon and Inngest!
Licensed under the Apache License.