Voltar ao ranking

sqlchat/sqlchat

TypeScriptsqlchat.ai

Chat-based SQL Client and Editor for the next decade

chatgptmysqlopenaipostgressqlsqlclientsqleditorclickhousecockroachdboraclesnowflakesqlite
Crescimento de estrelas
Estrelas
5.8k
Forks
504
Crescimento semanal
Issues
22
2k4k
mar. de 2023abr. de 2024jun. de 2025jul. de 2026
Artefatosnpmnpm install sqlchat
README

SQL Chat banner

SQL Chat

vercel

English | 中文 | Español

What

SQL Chat is a chat-based SQL client, which uses natural language to communicate with the database to implement operations such as query, modification, addition, and deletion of the database.

Screenshot

Screenshot

Screenshot

Why

As we enter the Developer Tools 2.0 era, there is a massive opportunity to rebuild the existing tools using the chat-based interface. SQL Client is no exception. Instead of navigating across many UI controls, a chat-based interface is much more intuitive. Of course, only if that works, and our goal is to deliver that experience.

How

SQL Chat is built by Next.js, it supports the following databases and will add more over time:

  • MySQL
  • PostgreSQL
  • MSSQL
  • TiDB Cloud
  • OceanBase

sqlchat.ai

IP Whitelisting

If you use sqlchat.ai to connect to your database, you need to add 0.0.0.0 (allow all connections) to the database whitelist IP. Because sqlchat.AI is hosted on Vercel which uses dynamic IP. If this is a concern, please consider the self-host option below.

Data Privacy

See SQL Chat Privacy Policy.

Self-host

Docker

If you just want to run for your own use, supply the following options:

  • NEXTAUTH_SECRET
  • OPENAI_API_KEY
docker run --name sqlchat --platform linux/amd64 --env NEXTAUTH_SECRET="$(openssl rand -hex 5)" --env OPENAI_API_KEY=<<YOUR OPENAI KEY>> -p 3000:3000 --hostname localhost sqlchat/sqlchat
  • Pass an arbitrary string to NEXTAUTH_SECRET otherwise next-auth will complain.
  • If you chat to the database on the same host, you need to use host.docker.internal as the host in the database connection setting.

Startup options

TL;DR

  • If you just want to use for yourself, then run without database. Check .env.nodb.
  • If you want to offer a similar service as sqlchat.ai, then run with database, check .env.usedb. The database is used to store account, usage info.
  • OPENAI_API_KEY: OpenAI API key. You can get one from here.

  • OPENAI_API_ENDPOINT: OpenAI API endpoint. Defaults to https://api.openai.com. Use Ollama to set up self-host AI model and set the endpoint to it.

  • NEXT_PUBLIC_ALLOW_SELF_OPENAI_KEY: Set to true to allow users to bring their own OpenAI API key.

  • NEXT_PUBLIC_USE_DATABASE: Set to true to start SQL Chat with database. This will enable following features:
    1. Account system.
    2. Per-user quota enforcement.
    3. Payment.
    4. Usage data collection.
  • DATABASE_URL: Applicable if NEXT_PUBLIC_USE_DATABASE is true. Postgres connection string to store data. e.g. postgresql://postgres:YOUR_PASSWORD@localhost:5432/sqlchat?schema=sqlchat.

Local Development

  1. Install dependencies

    pnpm i
    
  2. Generate prisma client

    pnpm prisma generate
    
  3. Make a copy of the example environment variables file:

    cp .env.usedb .env
    
  4. Add your API key and OpenAI API Endpoint(optional) to the newly created .env file.

Setup database

You can skip this section with NEXT_PUBLIC_USE_DATABASE=false if you don't build features requiring database

  1. Start a Postgres instance. For mac, you can use StackbBricks, DBngin or Postgres.app.

  2. Create a database:

    CREATE DATABASE sqlchat;
    

    In .env file, assign the connection string to environment variable DATABASE_URL and DATABASE_DIRECT_URL. This article explains why we need two URLs.

  3. Set up database schema

    pnpm prisma migrate dev
    
  4. (Optional) Seed data

    pnpm prisma db seed
    

Star History

Star History Chart

Community

Follow us on Twitter

sqlchat

Sponsors

Common Error Message

Please sign up to get free quota

See this issue.

You exceeded your current quota, please check your plan and billing details

openai quota

Your OpenAI Key has run out of quota. Please check your OpenAI account.

Failed to request message, please check your network

network error

Please make sure you have a stable network connection which can access the OpenAI API endpoint.

ping api.openai.com

If you cannot access the OpenAI API endpoint, you can try to set the OPENAI_API_ENDPOINT in UI or environment variable.

Repositórios relacionados
NousResearch/hermes-agent

The agent that grows with you

PythonPyPIMIT Licenseaiai-agent
hermes-agent.nousresearch.com
218.5k41.3k
f/prompts.chat

f.k.a. Awesome ChatGPT Prompts. Share, discover, and collect prompts from the community. Free and open source — self-host for your organization with complete privacy.

HTMLOtherchatgptai
prompts.chat
166.2k21.5k
langflow-ai/langflow

Langflow is a powerful tool for building and deploying AI-powered agents and workflows.

PythonPyPIMIT Licensereact-flowchatgpt
langflow.org
152.2k9.6k
langchain-ai/langchain

The agent engineering platform.

PythonPyPIMIT Licenseaianthropic
docs.langchain.com/langchain/
142.3k23.7k
f/awesome-chatgpt-prompts

This repo includes ChatGPT prompt curation to use ChatGPT and other LLM tools better.

HTMLCreative Commons Zero v1.0 Universalchatbotchatgpt
prompts.chat
121.3k16.3k
microsoft/generative-ai-for-beginners

21 Lessons, Get Started Building with Generative AI

Jupyter NotebookMIT Licenseaichatgpt
113.3k60.8k
ChatGPTNextWeb/NextChat

✨ Light and Fast AI Assistant. Support: Web | iOS | MacOS | Android | Linux | Windows

TypeScriptnpmMIT Licensechatgptnextjs
nextchat.club
88.5k59.4k
OpenHands/OpenHands

🙌 OpenHands: AI-Driven Development

PythonPyPIOtheragentartificial-intelligence
openhands.dev
81.6k10.4k
lobehub/lobehub

🤯 LobeHub is your Chief Agent Operator, organizing your agents into 7×24 operations by hiring, scheduling, and reporting on your entire AI team.

TypeScriptnpmOtherchatgptopenai
lobehub.com
80.6k15.7k
ChatGPTNextWeb/ChatGPT-Next-Web

A cross-platform ChatGPT/Gemini UI (Web / PWA / Linux / Win / MacOS). 一键拥有你自己的跨平台 ChatGPT/Gemini/Claude LLM 应用。

TypeScriptnpmchatgptnextjs
nextchat.dev/chat
78.5k60k
dair-ai/Prompt-Engineering-Guide

🐙 Guides, papers, lessons, notebooks and resources for prompt engineering, context engineering, RAG, and AI Agents.

MDXMIT Licensedeep-learningprompt-engineering
promptingguide.ai
76.8k8.4k
openai/openai-cookbook

Examples and guides for using the OpenAI API

Jupyter NotebookMIT Licenseopenaichatgpt
cookbook.openai.com
74.8k12.7k