Skip to content

OtterMind/Chat2DB

Repository files navigation

📣 Exciting News from the Chat2DB Team! We just open-sourced Nubase — our brand new deployment layer for Artificial Intelligence-native applications! If Chat2DB helps you manage data effortlessly, Nubase will help you deploy your AI coding tools and agents with zero friction.

Show some love and give Nubase a ⭐️ on GitHub to support our open-source journey!

Chat2DB

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

OtterMind%2FChat2DB | Trendshift

Modelscope ReadmeX Discord Twitter Telegram Whatsapp Reddit Gmail

README in English 简体中文版自述文件 日本語のREADME

1. Intelligent SQL Generation: Chat2DB Pro supports AI-driven intelligent SQL development to help you write SQL queries faster.

2. Database Management: Supports more than 10 databases, including MySQL, PostgreSQL, H2, Oracle, SQLServer, SQLite, MariaDB, ClickHouse, DM, Presto, DB2, OceanBase, Hive, KingBase, MongoDB, Redis, Snowflake, and more.

3. Intelligent Report Generation: Chat2DB Pro supports AI-driven intelligent data reporting to help you generate dashboards faster.

4. Data Structure Synchronization: Chat2DB Pro supports database table structure synchronization to help you sync database table structures faster.

Feature Comparison

Feature Community Open Source Pro
Database Types 16+ Target 100+
Supported AI Requires AI Configuration AI ready on installation
AI Capabilities Basic Varied
Visual Table Editor
SQL Console
SQL Formatting
Save Query Records
Theme Color Settings
Data Structure Sync
Database Grouping
Database Structure Import/Export
Data Import/Export
Data Migration
Copy/Clear Table
Open and Run SQL Files
UML Diagram In Development
Generate Code
Copy Results as Insert/Update
Modify Query Results
Intelligent SQL Editor
AI Table Creation
AI Data Sets
Chat2Excel
Intelligent Dashboard
Editor Settings
Custom Shortcuts
Cross-device Usage

Download and Installation

Chat2DB is a cross-platform application that supports Windows, MacOS, and Linux. You can download Chat2DB from the following links:

Community Edition Docker Installation

System Requirements

Before installing Chat2DB, ensure your system meets the following requirements:

  • Docker 19.03.0 or later
  • Docker Compose 1.25.0 or later
  • CPU >= 2 Cores
  • RAM >= 4 GiB
# Run once from a repository checkout. Re-running reuses the same valid key.
./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

docker logs --follow chat2db-community

Open http://localhost:10825. To update the container, pull the new image, remove the old container, and run the command above again.

Chat2DB Community 4.0.0 uses the independent /root/.chat2db-community directory. It does not automatically migrate data from earlier images that used /root/.chat2db.

Keep ~/.config/chat2db-community/encryption.key across container rebuilds and back it up separately. Replacing or losing it makes previously stored datasource passwords and AI model API keys unreadable. Startup with chat2db.mode other than DESKTOP, including normal Web/headless startup, fails when no valid key is provided.

The repository also includes a Compose definition:

docker compose --file docker/docker-compose.yml up --detach

Community Encryption Key

Chat2DB Community encrypts stored datasource passwords and user-configured AI model API keys with AES-256-GCM. Both use the same installation key with separate authenticated AAD values, so ciphertext from one purpose cannot be decrypted as the other. 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.

Create the default key file once from a repository checkout:

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

The default path is ~/.config/chat2db-community/encryption.key. 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 requires openssl. Its 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, persist it across upgrades and container rebuilds, and back it up separately from the datasource storage.

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. Replacing or losing the key makes previously stored datasource passwords and AI model API keys unreadable.

Code Debugging

Runtime Environment

  • Java runtime: Open JDK 17
  • Node.js runtime: Node.js 18 or later
  • Maven 3.8 or later

Clone the repository locally

$ git clone git@github.com:OtterMind/Chat2DB.git

Frontend Debugging

Use Yarn with the checked-in lockfile.
$ cd Chat2DB/chat2db-community-client
$ yarn install --frozen-lockfile
$ yarn run start:community:hot

Backend Debugging

$ 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 4.0.0 chat2db/chat2db:4.0.0

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.

  • For bugs and feature requests, please use GitHub Issues.
  • For questions, setup help, and open-ended discussions, please use GitHub Discussions.
  • If your pull request is related to an issue, please link it in the PR description.

Contact Us

Acknowledgments

Thanks to everyone who has contributed to Chat2DB~~

Image

Star History

Star History Chart

License

The primary license used by this software is the Apache License 2.0, supplemented by the Chat2DB License.

About

AI-driven database tool and SQL client, The hottest GUI client, supporting MySQL, Oracle, PostgreSQL, DB2, SQL Server, DB2, SQLite, H2, ClickHouse, and more.

Topics

Resources

License

Code of conduct

Contributing

Stars

25.9k stars

Watchers

154 watching

Forks

Packages

 
 
 

Contributors