| Crates.io | dbctl |
| lib.rs | dbctl |
| version | 0.1.0 |
| created_at | 2025-07-19 06:20:05.786364+00 |
| updated_at | 2025-07-19 06:20:05.786364+00 |
| description | A CLI tool to manage Dockerized databases like PostgreSQL, Redis, and MariaDB |
| homepage | |
| repository | https://github.com/Akshay2642005/dbctl.git |
| max_upload_size | |
| id | 1759963 |
| size | 49,568 |
A flexible, user-friendly, and type-safe CLI + TUI tool written in Rust to create, run, and manage Dockerized databases (PostgreSQL, Redis, MariaDB, and more).
Built with love for learners and power users alike. ๐
dbctl simplifies database development and testing by providing:
Fast creation of Docker containers for popular databases
Easy management via both CLI and interactive TUI modes
Type-safe input collection and validation
Powerful insights with stats, logs, and connection details
Configuration persistence with JSON-based profiles
๐ PostgreSQL - Full-featured, robust relational database
๐ Redis - In-memory data structure store
๐ฌ MariaDB - Community-developed fork of MySQL
โ Extensible architecture for adding more database types
# Install from crates.io
cargo install dbctl
# Create a PostgreSQL database
dbctl create postgres --name mypg --user admin --password secret --port 5432
# Launch the interactive TUI wizard
dbctl wizard
| Week | Focus | Goals |
|---|---|---|
| 1 | โ Setup + CLI/TUI Basics | Rust, project layout, clap, ratatui |
| 2 | ๐ข๏ธ PostgreSQL support | Database trait, default configs |
| 3 | ๐ณ Docker integration | Launch & manage containers |
| 4 | โ๏ธ CLI Command: Create | Launch Postgres via CLI |
| 5 | ๐จ TUI Wizard | Select DB & enter info visually |
| 6 | ๐งฉ Add Redis, MariaDB | Implement additional backends |
| 7 | ๐ Stats & Logging | Show container stats, logs, inspect |
| 8 | ๐งช Error Handling & Polish | thiserror, tracing, UX |
cargo newtracingthiserrorclap)ratatui)bollard)Start Postgres container
Start Redis container
Start MariaDB container
View stats/logs of container
Return container ID + connection URL
Stop and remove containers
Load config from file
Save config to file
Update config (edit mode)
dbctl/
โโโ Cargo.toml
โโโ README.md
โโโ src/
โ โโโ main.rs # Entry point
โ โโโ cli/ # CLI command handling
โ โ โโโ mod.rs
โ โโโ tui/ # Terminal UI components
โ โ โโโ mod.rs
โ โโโ db/ # Database implementations
โ โ โโโ mod.rs
โ โ โโโ postgres.rs
โ โ โโโ redis.rs
โ โ โโโ mariadb.rs
โ โโโ docker/ # Docker interaction
โ โ โโโ engine.rs
โ โโโ config/ # Configuration handling
โ โ โโโ models.rs
โ โโโ output.rs # Output formatting
โ โโโ utils.rs # Utility functions
โ โโโ error.rs # Error types
# Create a PostgreSQL database
$ dbctl create postgres \
--name mypg \
--user admin \
--password secret \
--port 5432
โ
Database 'mypg' started in Docker
๐ URL: postgres://admin:secret@localhost:5432/mypg
๐ Container ID: 17afc8c9d16
# List running database containers
$ dbctl list
# View container logs
$ dbctl logs mypg
# Stop and remove a container
$ dbctl remove mypg
The TUI provides an interactive wizard for configuring and launching databases:
+------------------------------------------+
| Select a Database to Launch |
| > PostgreSQL |
| Redis |
| MariaDB |
+------------------------------------------+
+------------------------------------------+
| ๐งพ PostgreSQL Setup |
| Name : mypg |
| Username : admin |
| Password : ****** |
| Host : localhost |
| Port : 5432 |
| SSL? : [ No ] |
+------------------------------------------+
| [ Create Database ] |
+------------------------------------------+
โ
Success! Container Started
๐ URL: postgres://admin:secret@localhost:5432/mypg
๐ Container ID: 17afc8c9d16
Configurations can be saved as JSON profiles for reuse:
{
"type": "postgres",
"name": "mypg",
"user": "admin",
"password": "secret",
"host": "localhost",
"port": 5432,
"db_name": "mypg",
"ssl": false
}
Load saved configurations:
$ dbctl create --from-file postgres-dev.json
Rust toolchain (stable)
Docker installed and running
# Clone the repository
git clone https://github.com/yourusername/dbctl.git
cd dbctl
# Build and install
cargo install --path .
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)This project is licensed under the MIT License - see the LICENSE file for details.