selfhost.directory

The index of self-hostable projects — ranked, categorized and served with live updates.
Own your data and stop giving it to big tech.

sqlchat logo

Self-host sqlchat

Chat-based SQL client driven by natural language

ReleaseOpen SourceMIT
Updated3 weeks ago
LanguageTypescript
Setup difficultyEasy
Stars
5 856
Port
3000 (the Next.js web application)
Docker
sqlchat/sqlchat
Install with Docker
Chat conversation screen of the SQL clientSecond app view shown in the READMEThird app view shown in the READMEDatabase connection setting dialog

What is sqlchat?

SQL Chat is a database client whose entire interface is a conversation: you describe what you want and it produces the SQL, covering reads as well as inserts, updates and drops. It is written with Next.js and supports MySQL, PostgreSQL, MSSQL, TiDB Cloud and OceanBase, with more engines planned. The language model comes from your own OpenAI API key, from any OpenAI-compatible endpoint, or from a local Ollama deployment; users can also be allowed to bring their own key. For personal use you can run the published Docker container with just a NextAuth secret and an API key; pointing it at a Postgres database instead turns on accounts, per-user quotas, usage tracking and payments, which is how the hosted edition was operated. A one-click Vercel deployment is offered from the repository, and connecting to a database on the same machine requires host.docker.internal. Note that the container image was last updated about six months ago and the project's own domain currently serves Bytebase marketing pages rather than the client.

sqlchat alternatives

Should you self-host sqlchat?

sqlchat scores 59/100 on selfhost.directory (how scoring works) and ranks #27 of 41 in Database Management. It has 5 856 GitHub stars, +13 in the last 30 days.

There was no stable release in the past 12 months, so check the repository's recent activity before you rely on it.

Setup is easy: most people get it running in one sitting. An official Docker image is available. It is MIT-licensed and written mostly in Typescript.

Its closest alternative on selfhost.directory is supabase (90/100, 114 758 stars). It scores higher overall, so compare the two before you pick. See sqlchat vs supabase side by side.

Features

  • Billing & paymentsOnly active in database mode.
  • Bring-your-own AI model endpoint
  • Multi-database Support
  • Natural-language chat interface
  • Per-user quota enforcement
  • SQL Editor
  • Usage analytics
  • User AccountsRequires NEXT_PUBLIC_USE_DATABASE=true and a Postgres database.
  • User-supplied API keys

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.

How to install sqlchat

Install sqlchat with Docker

Environment variables
NEXTAUTH_SECRET, OPENAI_API_KEY

docker run --name sqlchat --platform linux/amd64 --env NEXTAUTH_SECRET="$(openssl rand -hex 5)" --env OPENAI_API_KEY=<> -p 3000:3000 --hostname localhost sqlchat/sqlchat

Use host.docker.internal as the host in the database connection setting when the database runs on the same machine.

How to configure sqlchat

  • OPENAI_API_KEYOpenAI API key.
  • NEXTAUTH_SECRETSecret passed to next-auth; any arbitrary string works, otherwise next-auth complains.
  • NEXT_PUBLIC_USE_DATABASESet to true to start SQL Chat with a database, which enables the account system, per-user quota enforcement, payment and usage data collection.

    values: true | false

  • DATABASE_URLPostgres connection string used to store app data when NEXT_PUBLIC_USE_DATABASE is true.
  • OPENAI_API_ENDPOINThttps://api.openai.comOpenAI API endpoint; can be pointed at a self-hosted model server such as Ollama. Can also be set in the UI.

More in Database Management

Rate this project

Click to rate — no account needed.

0 comments

Posting as guest
Loading comments…