Metadata-Version: 2.4
Name: dbms-cli
Version: 1.0.0
Summary: Database Server Manager — Interactive CLI to create and manage database servers via Docker
Author-email: Hafiz <hafizagha.ab@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/your-username/dbms
Project-URL: Repository, https://github.com/your-username/dbms
Project-URL: Issues, https://github.com/your-username/dbms/issues
Keywords: database,docker,cli,postgresql,mysql,mariadb
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Database
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Classifier: Topic :: Utilities
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: questionary>=2.0
Requires-Dist: rich>=13.0
Dynamic: license-file

# DBMS — Database Server Manager

> Interactive CLI to create and manage database servers via Docker.

[![PyPI version](https://img.shields.io/pypi/v/dbms-cli?color=violet&logo=pypi&logoColor=white)](https://pypi.org/project/dbms-cli/)
[![Python](https://img.shields.io/pypi/pyversions/dbms-cli?logo=python)](https://pypi.org/project/dbms-cli/)
[![Docker](https://img.shields.io/badge/Requires-Docker-2496ED?logo=docker&logoColor=white)](https://docs.docker.com/get-docker/)
[![License](https://img.shields.io/badge/License-MIT-green)](https://github.com/your-username/dbms/blob/main/LICENSE)

---

## Features

- **Interactive wizard** — step-by-step guided setup for new database servers
- **Multi-database support** — PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, SQLite
- **Docker-powered** — automatically generates and manages `docker-compose.yml`
- **Port conflict detection** — suggests the next available port if the default is taken
- **Persistent state** — server registry stored at `~/.dbms/servers.json`
- **Rich terminal UI** — colored output, progress spinners, and summary tables

---

## Supported Databases

| Database    | Default Port | Docker Image                                     |
|-------------|:------------:|--------------------------------------------------|
| PostgreSQL  | 5432         | `postgres`                                       |
| MySQL       | 3306         | `mysql`                                          |
| MariaDB     | 3307         | `mariadb`                                        |
| SQL Server  | 1433         | `mcr.microsoft.com/mssql/server`                 |
| Oracle      | 1521         | `container-registry.oracle.com/database/express` |
| SQLite      | —            | *(no Docker required)*                           |

---

## Requirements

- Python 3.10+
- [Docker](https://docs.docker.com/get-docker/) with Docker Compose (for all databases except SQLite)

---

## Installation

### Recommended — pipx (isolated, always available globally)

[pipx](https://pipx.pypa.io) installs CLI tools in isolated environments so they don't interfere with other packages:

```bash
pipx install dbms-cli
```

### pip

```bash
pip install dbms-cli
```

### From source

```bash
git clone https://github.com/your-username/dbms.git
cd dbms
pip install .
```

---

## Usage

### Interactive menu (no arguments)

```bash
dbms
```

Launches a guided menu to choose an action.

### Commands

```bash
dbms create           # Interactive wizard to create a new server
dbms list             # List all registered servers with status
dbms start  <name>    # Start a database server
dbms stop   <name>    # Stop a database server
dbms delete <name>    # Delete a server (stops container + removes files)
dbms status           # Show Docker daemon status and all servers
```

---

## Walkthrough — Creating a server

```
$ dbms create

╔══════════════════════════════════════════╗
║    DBMS — Database Server Manager        ║
║            Powered by Docker             ║
╚══════════════════════════════════════════╝

─────────────── Create a new database server ───────────────

? What is your server name? › my-postgres
? Select a database: › PostgreSQL
? [1/4] Docker image version? › 16
? [2/4] Host port? › 5432
? [3/4] Username? › admin
? [4/4] Database name? › my_postgres
? Password? › ••••••••

─────────────────────── Summary ────────────────────────────

  Server name    my-postgres
  Database       PostgreSQL
  Image          postgres:16
  Port           localhost:5432
  Username       admin
  Database name  my_postgres
  Password       ••••••••
  Folder         ./my-postgres/

? Proceed with this configuration? › Yes

✔ Server folder created
✔ docker-compose.yml generated
✔ Configuration saved
✔ Container started

Connection hint:
  psql -h localhost -p 5432 -U admin -d my_postgres
```

---

## How it works

Each server gets its own subfolder containing a generated `docker-compose.yml`. Starting and stopping a server runs `docker compose up -d` / `docker compose down` inside that folder. All server metadata is tracked in `~/.dbms/servers.json`.

**SQLite** is a special case — no Docker needed, DBMS simply creates a `.db` file in the server folder.

---

## License

[MIT](https://github.com/your-username/dbms/blob/main/LICENSE)
