An Next.js application that allows you to query a PostgreSQL database with natural language.
This project is a Next.js application that allows users to query a PostgreSQL database using natural language and visualize the results. It's powered by the AI SDK by Vercel and uses OpenAI's GPT-4o model to translate natural language queries into SQL.
The database contains information about unicorn companies, including:
This data is based on CB Insights' list of unicorn companies.
To get the project up and running, follow these steps:
Install dependencies:
pnpm install
Copy the example environment file:
cp .env.example .env
Add your OpenAI API key and PostgreSQL connection string to the .env
file:
OPENAI_API_KEY=your_api_key_herePOSTGRES_URL="..."POSTGRES_PRISMA_URL="..."POSTGRES_URL_NO_SSL="..."POSTGRES_URL_NON_POOLING="..."POSTGRES_USER="..."POSTGRES_HOST="..."POSTGRES_PASSWORD="..."POSTGRES_DATABASE="..."
Download the dataset:
unicorns.csv
in the root of your projectSeed the database:
pnpm run seed
Start the development server:
pnpm run dev
Your project should now be running on http://localhost:3000.
The project is set up for easy deployment on Vercel. Use the "Deploy with Vercel" button in the repository to create your own instance of the application.
To learn more about the technologies used in this project, check out the following resources:
An Next.js application that allows you to query a PostgreSQL database with natural language.
This project is a Next.js application that allows users to query a PostgreSQL database using natural language and visualize the results. It's powered by the AI SDK by Vercel and uses OpenAI's GPT-4o model to translate natural language queries into SQL.
The database contains information about unicorn companies, including:
This data is based on CB Insights' list of unicorn companies.
To get the project up and running, follow these steps:
Install dependencies:
pnpm install
Copy the example environment file:
cp .env.example .env
Add your OpenAI API key and PostgreSQL connection string to the .env
file:
OPENAI_API_KEY=your_api_key_herePOSTGRES_URL="..."POSTGRES_PRISMA_URL="..."POSTGRES_URL_NO_SSL="..."POSTGRES_URL_NON_POOLING="..."POSTGRES_USER="..."POSTGRES_HOST="..."POSTGRES_PASSWORD="..."POSTGRES_DATABASE="..."
Download the dataset:
unicorns.csv
in the root of your projectSeed the database:
pnpm run seed
Start the development server:
pnpm run dev
Your project should now be running on http://localhost:3000.
The project is set up for easy deployment on Vercel. Use the "Deploy with Vercel" button in the repository to create your own instance of the application.
To learn more about the technologies used in this project, check out the following resources: