Next.js app for natural language querying of PostgreSQL
Top 99.2% on sourcepulse
This project provides a Next.js application for querying PostgreSQL databases using natural language, with results visualized in tables and charts. It targets developers and users who need to interact with structured data without writing SQL, offering AI-powered query generation, explanation, and automatic chart configuration.
How It Works
The application leverages OpenAI's GPT-4o model via Vercel's AI SDK to translate natural language queries into executable SQL. The generated SQL is then run against a PostgreSQL database. Results are presented in a tabular format, and an AI-generated configuration is used to render an appropriate chart visualization. Users can also request AI-generated explanations of the SQL queries.
Quick Start & Requirements
pnpm install
OPENAI_API_KEY
and PostgreSQL connection strings (POSTGRES_URL
, etc.) in a .env
file.unicorns.csv
from CB Insights and place it in the project root.pnpm run seed
pnpm run dev
Highlighted Details
Maintenance & Community
This is a Vercel Labs project, indicating potential for high-quality development and integration with Vercel's ecosystem. Specific community channels or active maintenance signals are not detailed in the README.
Licensing & Compatibility
The project's license is not explicitly stated in the README. Compatibility for commercial use or closed-source linking would depend on the final license.
Limitations & Caveats
The project relies on external services (OpenAI API) which incur costs. The accuracy of AI-generated SQL and chart configurations is dependent on the model's performance and the clarity of the natural language input. The dataset is specific to unicorn companies.
7 months ago
1+ week