Skip to main content

High-performance database CLI engineered for Django developers — Advanced ORM analysis, performance optimization, SSH tunneling, and seamless multi-database support (PostgreSQL, MySQL, SQLite)

Project description

DBCrust

A fast, multi-database CLI and desktop app built in Rust. Connect to PostgreSQL, MySQL, SQLite, ClickHouse, MongoDB, and Elasticsearch — or query Parquet, CSV, and JSON files with SQL. Includes SSH tunneling, Vault integration, Docker auto-discovery, and a Tauri-based GUI.

Rust License: MIT Documentation PyPI

Features

Category What you get
Databases PostgreSQL, MySQL, SQLite, ClickHouse, MongoDB, Elasticsearch
File formats Parquet, CSV, JSON — queried with SQL via Apache DataFusion
Smart CLI Context-aware autocompletion, syntax highlighting, history search, external editor
Desktop GUI Tauri app with CodeMirror SQL editor, schema explorer, Docker panel, EXPLAIN viewer
Security SSH tunneling, HashiCorp Vault dynamic credentials, encrypted password storage
DevOps Docker container auto-discovery, saved sessions, recent connections
Performance EXPLAIN visualization (text + interactive TUI), query timing
Django ORM analyzer, N+1 detection, middleware, management commands
Python API dbcrust.run_command(), dbcrust.run_cli(), PostgresClient class

Install

# Pre-built binary (macOS / Linux)
curl -fsSL https://clement-tourriere.github.io/dbcrust/install.sh | sh

# Windows
# irm https://clement-tourriere.github.io/dbcrust/install.ps1 | iex

# Python (via uv)
uv tool install dbcrust        # install globally
uvx dbcrust <connection-url>   # run without installing

# From source
cargo install --path .

Connect

# Relational databases
dbcrust postgres://user:pass@localhost/mydb
dbcrust mysql://root:pass@localhost:3306/mydb
dbcrust sqlite:///path/to/db.sqlite
dbcrust clickhouse://user:pass@localhost:8123/default

# Document databases
dbcrust mongodb://user:pass@localhost:27017/mydb
dbcrust elasticsearch://localhost:9200

# File formats (SQL via DataFusion)
dbcrust parquet:///data/sales.parquet
dbcrust csv:///logs/*.csv?header=true
dbcrust json:///events.json

# Docker auto-discovery
dbcrust docker://                         # interactive picker
dbcrust docker://my-postgres-container    # direct

# Saved sessions & recent connections
dbcrust session://production_db
dbcrust recent://

# Vault dynamic credentials
dbcrust vault://readonly@database/postgres-prod

# SSH tunneling
dbcrust postgres://user@db.internal/app --ssh-tunnel jumphost.com

Both dbcrust and dbc (short alias) are available.

Interactive commands

Once connected you get a REPL with 50+ backslash commands. Highlights:

\dt             list tables               \l        list databases
\d <table>      describe table            \c <db>   switch database
\e              toggle EXPLAIN mode       \ev       EXPLAIN TUI (interactive)
\x              expanded display          \cs       column selection
\ed             open $EDITOR              \w <f>    write last query to file
\i <f>          execute SQL file          \n        list named queries
\ns <n> <sql>   save named query          \ss <n>   save session
\s              list sessions             \r        recent connections
\savepass       save password             \vc       Vault cache status
\docker         list Docker containers    \h        help
\q              quit

Named queries support parameter substitution ($1, $*, $@) and scopes (--global, --postgres, --mysql, --sqlite, or session-local by default).

Desktop GUI

DBCrust includes a Tauri-based desktop application with:

  • SQL editor — CodeMirror with syntax highlighting, Cmd+Enter / Ctrl+Enter to run
  • EXPLAIN viewer — visual query plan display
  • Schema explorer — browse tables, columns, indexes, foreign keys
  • Docker discovery — find and connect to running database containers
  • Session manager — saved connections, recent history
  • Multi-tab — work on multiple queries in parallel
  • Settings — view and toggle configuration
  • System tray — quick access, stays running in background

Run the GUI

# Prerequisites: mise (installs Bun automatically)
mise install

# Development mode (hot-reload)
mise run gui:dev

# Production build (generates .app / .dmg / .msi)
mise run gui:build

Python integration

import dbcrust

# Execute a query
result = dbcrust.run_command("postgres://user:pass@localhost/mydb", "SELECT * FROM users LIMIT 5")

# Launch interactive CLI
dbcrust.run_cli("postgres://user:pass@localhost/mydb")

# Object-oriented client
from dbcrust import PostgresClient
client = PostgresClient(host="localhost", user="postgres", dbname="myapp")
tables = client.list_tables()

Django ORM analyzer

# settings.py — add the middleware
MIDDLEWARE = ['dbcrust.django.PerformanceAnalysisMiddleware', ...]

# Or analyze manually
from dbcrust.django import analyzer
with analyzer.analyze() as analysis:
    for book in Book.objects.all():
        print(book.author.name)  # N+1 detected

results = analysis.get_results()
# Connect using Django database settings
python manage.py dbcrust

Development

DBCrust uses mise for tool management and task running. Mise automatically installs Bun (used for the GUI frontend), commitizen, and other dev tools.

# One-time setup
mise install              # installs Bun, commitizen, pkl, etc.
mise run gui:install      # install GUI npm dependencies via Bun

# CLI
mise run build:dev        # debug build
mise run build            # release build
cargo run -- <url>        # run directly

# GUI
mise run gui:dev          # dev mode with hot-reload
mise run gui:build        # production build

# Python
mise run py:dev           # maturin develop
mise run py:build         # build wheel
mise run py:test          # pytest

# Quality
mise run fmt              # cargo fmt
mise run lint             # clippy
mise run test             # cargo test
mise run check            # fmt + lint + test

Project layout

├── src/                   # Rust CLI + library
│   ├── main.rs            # entry point
│   ├── commands.rs        # backslash command system (enum + strum)
│   ├── database_*.rs      # per-database implementations
│   ├── completion.rs      # SQL autocompletion
│   ├── explain_tui/       # interactive EXPLAIN visualizer (ratatui)
│   └── ...
├── gui/                   # Tauri desktop app
│   ├── src/               # React + TypeScript frontend
│   ├── src-tauri/         # Tauri Rust backend (bridges to dbcrust core)
│   └── package.json       # Bun-managed dependencies
├── python/                # Python bindings (PyO3 + maturin)
├── docs/                  # MkDocs documentation source
├── mise.toml              # task runner & tool config
└── Cargo.toml             # workspace root

Configuration

Config lives in ~/.config/dbcrust/:

config.toml               # settings (limits, display, SSH patterns, Vault, etc.)
named_queries.toml         # saved queries with scopes
recent.toml                # connection history
vault_credentials.enc      # encrypted Vault credential cache
history.txt                # command history

Show current config: \config inside the REPL.

Documentation

License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

dbcrust-0.27.0-cp38-abi3-win_amd64.whl (11.9 MB view details)

Uploaded CPython 3.8+Windows x86-64

dbcrust-0.27.0-cp38-abi3-musllinux_1_2_x86_64.whl (15.3 MB view details)

Uploaded CPython 3.8+musllinux: musl 1.2+ x86-64

dbcrust-0.27.0-cp38-abi3-musllinux_1_2_aarch64.whl (15.3 MB view details)

Uploaded CPython 3.8+musllinux: musl 1.2+ ARM64

dbcrust-0.27.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (14.5 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ x86-64

dbcrust-0.27.0-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (15.3 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ i686

dbcrust-0.27.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (15.1 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

dbcrust-0.27.0-cp38-abi3-macosx_11_0_arm64.whl (12.2 MB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

dbcrust-0.27.0-cp38-abi3-macosx_10_12_x86_64.whl (12.0 MB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

Details for the file dbcrust-0.27.0-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: dbcrust-0.27.0-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 11.9 MB
  • Tags: CPython 3.8+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for dbcrust-0.27.0-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 236ed639882879eda43b4ee33ccae058e905b74b2865ffb6aa1363c8ea9da1e9
MD5 0bf23628f49725a88d8d9aa2f6f7295f
BLAKE2b-256 2c05ff4ff229215a3beb044a536bb368d027258e6c436e33193fa9cbd82b2031

See more details on using hashes here.

Provenance

The following attestation bundles were made for dbcrust-0.27.0-cp38-abi3-win_amd64.whl:

Publisher: release.yml on clement-tourriere/dbcrust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dbcrust-0.27.0-cp38-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for dbcrust-0.27.0-cp38-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 b8126ac30dbdd60dcf976d9e0a27a4aeba4258fae2fee4ddbda355a024ac0f04
MD5 91d3c6bd2876f5a35c8b3f9ce4204b97
BLAKE2b-256 8db500d8d827958133954f748e0fbe331fc90b17d2947dce130d469f3b9263b7

See more details on using hashes here.

Provenance

The following attestation bundles were made for dbcrust-0.27.0-cp38-abi3-musllinux_1_2_x86_64.whl:

Publisher: release.yml on clement-tourriere/dbcrust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dbcrust-0.27.0-cp38-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for dbcrust-0.27.0-cp38-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 a842694c8bd9e8036ebe05ef89d3f73611ee15977fc786bad09283b0e1b08506
MD5 5d74033f3dffcc12fdcf8b2c04fa2cf6
BLAKE2b-256 e3c651e9455a5565fc8ad3cb4856cd537e8a4cdebce5ba1290ec1fd28a6a4ac3

See more details on using hashes here.

Provenance

The following attestation bundles were made for dbcrust-0.27.0-cp38-abi3-musllinux_1_2_aarch64.whl:

Publisher: release.yml on clement-tourriere/dbcrust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dbcrust-0.27.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for dbcrust-0.27.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d0a248ad06b45c8a2eef39893794c9256838e14fc79089fd0546e6ee7babe62e
MD5 43a6070699afa6954b37c575ca385809
BLAKE2b-256 4051465a609f967498dd1743d16f46c1c1ed6d2fb4ee5ff60a3d315a7b09ddc4

See more details on using hashes here.

Provenance

The following attestation bundles were made for dbcrust-0.27.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on clement-tourriere/dbcrust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dbcrust-0.27.0-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for dbcrust-0.27.0-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 058ffd3eca238638ecb42c3fa7b16538ca7e73d4b08992c69e2ffc4e4c9180d0
MD5 6ecb1dec8b31abc506f7dc97ca8235ed
BLAKE2b-256 0b859ebedda13403d6f8d65f8b229985813f7c05ee2aab5a040859e4e551fde7

See more details on using hashes here.

Provenance

The following attestation bundles were made for dbcrust-0.27.0-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl:

Publisher: release.yml on clement-tourriere/dbcrust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dbcrust-0.27.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for dbcrust-0.27.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 604a4c1563935d529f95c8f499a14baa8437c3af187edd94dce7946b95cfec64
MD5 c24485d5f916f4586fbe948d0fd54fce
BLAKE2b-256 a2ec6f818886fcdb60849d08f2bf0a3bbe770a1985c35d23d039cc79c1afc355

See more details on using hashes here.

Provenance

The following attestation bundles were made for dbcrust-0.27.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on clement-tourriere/dbcrust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dbcrust-0.27.0-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dbcrust-0.27.0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7a5255131e0e85d0f1ad77674f3392fdbfc0573fb4058877b0d4ee769955d4a8
MD5 2e00c4c7ac6d830337f03baeffa5dfde
BLAKE2b-256 0c13992f472693fd6d3430a777064cc6878b21928bfe753efe4d643e80ffc8c6

See more details on using hashes here.

Provenance

The following attestation bundles were made for dbcrust-0.27.0-cp38-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on clement-tourriere/dbcrust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dbcrust-0.27.0-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for dbcrust-0.27.0-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 4cb4ece9a19199b625651fcb8170e171375a283a586f3585c4714a24d3876d14
MD5 bcf2643cc114a3da4b1445c691cf0419
BLAKE2b-256 12e6c706192beb82fcf3234581e32cf6d3a490393b847df006790d2910ce0349

See more details on using hashes here.

Provenance

The following attestation bundles were made for dbcrust-0.27.0-cp38-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on clement-tourriere/dbcrust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page