Chat2DB README

The project's README from github.com/OtterMind/Chat2DB. As one markdown file: README.md.

Chat2DB
Powered by OtterMind

An AI-powered database client and SQL workspace for developers, DBAs, analysts, and data teams.

README in English 简体中文版自述文件 日本語のREADME README en español 한국어 README

What is Chat2DB?

Chat2DB Community is a free, cross-platform database client for Windows, macOS, and Linux. It runs entirely on your machine and combines a full-featured SQL workspace with an AI assistant that you connect to your own model.

Chat2DB workspace with SQL editor and AI assistant — click to watch the intro video

Screenshots

Dashboards and charts ER diagrams
Dashboards and charts ER diagram
Visual data management Data import and export
Visual data management Data import and export

Quick Start

Option 1: Desktop App

Download the installer for your platform from GitHub Releases, install it, and start connecting to your databases. No further setup is required.

Option 2: Docker

Requirements: Docker 19.03.0+, Docker Compose 2.0.0+ (Compose V2, only for the Compose variant), 2+ CPU cores, 4+ GiB RAM.

First create the encryption key (see Encryption Key for why it matters), then start the container:

# Run once from a repository checkout. Re-running reuses the same valid key.
git clone https://github.com/OtterMind/Chat2DB.git && cd Chat2DB
./script/security/init-community-encryption-key.sh

docker run --detach \
  --name chat2db-community \
  --restart unless-stopped \
  --publish 127.0.0.1:10825:10825 \
  --volume "$HOME/.chat2db-community-docker:/root/.chat2db-community" \
  --env CHAT2DB_COMMUNITY_ENCRYPTION_KEY_FILE=/run/secrets/chat2db-community-encryption.key \
  --volume "$HOME/.config/chat2db-community/encryption.key:/run/secrets/chat2db-community-encryption.key:ro" \
  chat2db/chat2db:latest

Then open http://localhost:10825 in your browser.

Alternatively, use the bundled Compose definition:

./script/security/init-community-encryption-key.sh
docker compose --file docker/docker-compose.yml up --detach

Notes:

Security Notes

Chat2DB Community is a single-user, local-first application. It has no user accounts or authorization boundaries between users. Keep the HTTP service bound to 127.0.0.1 or ::1 and do not expose it to other users or untrusted networks.

Custom JDBC drivers are executable Java code — install them only from sources you trust. Imported configuration files, archives, SQL files, database contents, and AI responses remain untrusted data. See the Security Policy for the complete trust boundary and vulnerability reporting process.

If you find this project useful, please give us a Star ⭐️ — it really helps!

Star Chat2DB on GitHub

Encryption Key

Chat2DB Community encrypts stored datasource passwords and AI model API keys with AES-256-GCM using a per-installation key. Create it once from a repository checkout (requires openssl):

./script/security/init-community-encryption-key.sh

The key is written to ~/.config/chat2db-community/encryption.key. Back this file up separately and keep it across upgrades and container rebuilds — replacing or losing it makes previously stored datasource passwords and AI model API keys unreadable. Web/headless startup fails when no valid key is provided; only Desktop mode creates a missing key automatically.

Key configuration reference (custom paths, resolution order, validation)

The key must be valid Base64 that decodes to exactly 32 bytes. The bundled initializer generates the standard padded form: 44 Base64 characters ending in =. It is cryptographic key material, not a human-readable password. Datasource passwords and AI API keys use the same key with separate authenticated AAD values, so ciphertext from one purpose cannot be decrypted as the other.

To use a custom path, pass it to the script and configure the same path when starting Chat2DB:

./script/security/init-community-encryption-key.sh /secure/path/chat2db-community.key

java -Dloader.path=chat2db-community-server/chat2db-community-start/target/lib \
    -Dchat2db.runtime.mode=community \
    -Dchat2db.mode=WEB \
    -Dchat2db.gui=false \
    -Dchat2db.network.status=OFFLINE \
    -Dchat2db.community.encryption-key-file=/secure/path/chat2db-community.key \
    -Dserver.address=127.0.0.1 \
    -Dserver.port=10825 \
    -jar chat2db-community-server/chat2db-community-start/target/chat2db-community.jar

The script's key-file path priority is the positional argument, CHAT2DB_COMMUNITY_ENCRYPTION_KEY_FILE, then the default path. It reuses a valid regular file, rejects symbolic links and non-regular files, and refuses to overwrite an invalid file. Keep the key readable only by the Chat2DB process owner.

Key configuration is resolved in this order:

  1. JVM property chat2db.community.encryption-key containing the Base64 key.
  2. Environment variable CHAT2DB_COMMUNITY_ENCRYPTION_KEY containing the Base64 key.
  3. JVM property chat2db.community.encryption-key-file containing a key-file path.
  4. Environment variable CHAT2DB_COMMUNITY_ENCRYPTION_KEY_FILE containing a key-file path.
  5. Default file ~/.config/chat2db-community/encryption.key.

The first configured value is authoritative. A blank value, malformed Base64, a key that does not decode to 32 bytes, or an invalid key file fails startup instead of falling through to the next source. File-based configuration is recommended because it avoids placing the key value directly in process arguments or environment variables.

Automatic key-file creation depends on chat2db.mode, not chat2db.gui. Community Desktop mode (chat2db.runtime.mode=community with chat2db.mode=DESKTOP) creates the selected key file when no inline key is configured and the file is missing. Any non-Desktop mode, including normal Web/headless startup, never creates a missing key and fails until a valid key is provided or initialized. The resolved key is cached for the process lifetime, so changing key configuration requires an application restart.

Build from Source

Prerequisites

Clone the Repository

git clone https://github.com/OtterMind/Chat2DB.git

Frontend

Use Yarn with the checked-in lockfile.

cd Chat2DB/chat2db-community-client
yarn install --frozen-lockfile
yarn run start:community:hot

Backend

cd Chat2DB
mvn -B clean package -Dmaven.test.skip=true -Dchat2db.finalName=chat2db-community \
    -f chat2db-community-server/pom.xml \
    -pl chat2db-community-start -am
./script/security/init-community-encryption-key.sh
java -Dloader.path=chat2db-community-server/chat2db-community-start/target/lib \
    -Dchat2db.gui=false \
    -Dchat2db.runtime.mode=community \
    -Dchat2db.mode=WEB \
    -Dchat2db.network.status=OFFLINE \
    -Dchat2db.community.encryption-key-file="$HOME/.config/chat2db-community/encryption.key" \
    -Dserver.address=127.0.0.1 \
    -Dserver.port=10825 \
    -Dspring.profiles.active=dev \
    -jar chat2db-community-server/chat2db-community-start/target/chat2db-community.jar

Build a Local Docker Image

./docker/docker-build.sh 5.3.0 chat2db/chat2db:5.3.0

Database guides

Step-by-step guides for connecting Chat2DB Community to specific databases:

Community vs Commercial Editions

The Community edition contains the full local database client described above, including custom AI model support. The commercial Pro and Enterprise editions build on the same core and add hosted AI services, user accounts, cloud storage and multi-device sync, and team collaboration and governance features. See chat2db.ai for details.

Contributing

We welcome bug reports, feature requests, documentation improvements, testing feedback, and pull requests from the community.

Before opening an issue or submitting a pull request, please read our Contributing Guide. It explains how to report bugs, suggest improvements, and make contributions easier for maintainers to review.

Community and Support

Acknowledgments

Thanks to everyone who has contributed to Chat2DB.

Chat2DB contributors

License

Chat2DB Community version 5.3.0 and later is available under the license terms in this repository. This is a source-available license based on the Apache License 2.0 with additional conditions. Chat2DB releases published before version 5.3.0, including version 0.3.7 and the earlier historical tags, remain under the Apache License 2.0.

Chat2DB (OtterMind/Chat2DB)

Searching Database…

28.3K ·GitHub
这是什么?Chat2DB 是一款免费、跨平台、本地优先的数据库客户端和 SQL 工作台,适合开发者、DBA、分析师和数据团队使用。它把功能完整的 SQL 客户端和一个 AI 助手结合在一起,你可以接入自己的模型。
它是桌面应用还是网页服务?两者都有,还有命令行工具:Windows、macOS 和 Linux 都有桌面安装包,也有提供网页界面的 Docker 镜像,以及开源的 CLI。所有东西都在你自己的电脑上本地运行。
怎么把它跑起来?桌面版最简单:从 GitHub Releases 下载适合你系统的安装包,装好后连接数据库就行,不需要其他配置。也可以运行 Docker 镜像(需要 Docker 19.03+、2 个以上 CPU 核心、4 GiB 以上内存),然后在浏览器里打开网页界面。
安装配置上有什么坑需要注意?Docker、网页和无界面模式在用自带脚本生成加密密钥之前无法启动;只有桌面模式会自动创建密钥。请务必备份这个密钥文件——丢失或更换它之后,已保存的数据源密码和 AI API 密钥都会变得无法读取。
我的数据会留在本地吗?能不能放到共享服务器上?它是本地优先的单用户设计:没有用户账号,用户之间也没有权限隔离。README 明确提醒要把 HTTP 服务绑定在 127.0.0.1 或 ::1 上,绝不要暴露给其他用户或不可信的网络。
它是完全开源的吗?严格来说已经不算了:5.3.0 及之后的版本采用基于 Apache 2.0 的源码可用许可证,附加了一些额外条件。5.3.0 之前发布的版本仍然使用 Apache 2.0。
除了执行查询,它还能做什么?你可以浏览元数据,管理表和其他对象(DDL/DML),直接在表格里编辑数据,导入导出数据,查看 ER 图,搭建仪表盘和图表,还能使用 SQL 自动补全、格式化、保存常用 SQL 以及完整的执行历史记录。
免费的社区版和付费版有什么区别?社区版包含完整的本地客户端,包括自定义 AI 模型支持。商业版 Pro 和 Enterprise 基于相同的核心构建,额外提供托管的 AI 服务、用户账号、支持多设备同步的云端存储,以及团队协作和治理功能。
CLI 支持 MCP 实际上是什么意思?开源的 CLI 支持 MCP(Model Context Protocol,模型上下文协议)——这是 AI 工具连接外部系统的一种标准方式。这样编码代理和其他 AI 助手就能通过 CLI 操作你的数据库,而不只是通过图形界面。
Creator
OtterMind
Size
57.6 MB
Stars
28.3K
Age
3y
Commits · 90 Days