Leverage Neon’s database-per-user and Inngest’s multi-tenancy to deploy fair and reliable RAG at scale.
Before you begin, ensure you have:
- Clone the repository:
git clone <repository-url>
- Install dependencies:
npm install
- Set up environment variables:
Create a
.env.local
file in the root directory:
# Neon Database
DATABASE_URL=
NEON_API_KEY=
# OpenAI
OPENAI_API_KEY=
# SERP API
SERP_API_KEY=
Here is how you can get the above values:
-
Neon Database URL:
- Go to your Neon project
- Navigate to Connection Details
- Copy the URL
-
Neon API Key:
- Go to your Neon Console
- Navigate to your Profile page
- Create a new API Key and copy it
-
OpenAI:
- Go to OpenAI
- Navigate to View API keys
- Copy the API Key
-
SERP API:
- Go to SERP API
- Sign up and get your API key
- Initialize the database schema:
Go over your Neon Console and navigate to the SQL Editor.
Copy the contents of db/schema.sql
and paste it into the SQL Editor.
Running the query will create the schema.
Then start the Next.js development server (npm run dev
) and navigate to http://localhost:3000/api/setup.
This will create the initial workspaces.
- Start the Next.js development server:
npm run dev
- In a separate terminal, start the Inngest dev server:
npx inngest-cli@latest dev
- Visit:
- http://localhost:3000 - Application
- http://localhost:8288 - Inngest dashboard