drixio 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 TerKSDev
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
package/README.md CHANGED
@@ -1,168 +1,262 @@
1
1
  # Drixio
2
2
 
3
- Drixio is a lightweight database manager for local development. It provides a
4
- terminal UI, a browser-based Studio, and scriptable CLI commands for inspecting
5
- and changing SQLite, PostgreSQL, and MySQL databases.
3
+ <div align="center">
6
4
 
7
- ## Requirements
5
+ **The developer-first, zero-overhead database manager & Studio for SQLite, PostgreSQL, MySQL, SQL Server, and MongoDB.**
8
6
 
9
- - Node.js 22 or newer
10
- - SQLite, PostgreSQL, or MySQL, depending on the database you want to use
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
8
+ [![Node.js](https://img.shields.io/badge/Node.js-%3E%3D22.0.0-brightgreen.svg)](https://nodejs.org/)
9
+ [![Database](https://img.shields.io/badge/Databases-SQLite%20%7C%20PostgreSQL%20%7C%20MySQL%20%7C%20MSSQL%20%7C%20MongoDB-orange.svg)](#)
11
10
 
12
- ## Install and connect
11
+ [Features](#-key-features) [Quick Start](#-quick-start) • [Drixio Studio](#-drixio-studio) • [AI Copilot](#-byok-ai-copilot) • [Safety & Doctor](#-table-recycle-bin--safety) • [CLI Reference](#-cli-commands) • [License](#-license)
13
12
 
14
- Run Drixio from a project that contains a supported database:
13
+ </div>
14
+
15
+ ---
16
+
17
+ ## ⚡ Why Drixio?
18
+
19
+ Traditional database GUIs are often bloated, electron-heavy, subscription-locked, or blind to common production mistakes. **Drixio** is designed from the ground up for modern developers: lightning-fast startup, terminal-native agility, a sleek browser-based Studio, and unique built-in superpowers like zero-overhead BYOK AI, soft-delete Table Recycle Bin, Schema Health Doctor, deterministic PII data masking, and native SSH bastion tunneling.
20
+
21
+ ---
22
+
23
+ ## ✨ Key Features
24
+
25
+ - 🧠 **Zero-Overhead BYOK AI Copilot**: Bring your own API key (DeepSeek, OpenAI, Ollama local LLMs, Groq). Zero middleman proxy, zero telemetry, schema-aware SQL generation, and instant error debugging.
26
+ - 🚇 **SSH Bastion Tunneling**: Securely bridge database connections through remote jump servers / bastion hosts (password & private key PEM support).
27
+ - ♻️ **Table Recycle Bin & Pre-Drop Snapshots**: Dropping a table never means catastrophic data loss. Recover soft-deleted tables with 1 click. Dual-layer auto-snapshot saved locally to `.drixio/trash/`.
28
+ - 🩺 **Schema Health Doctor**: Deep architectural linter and performance auditor. Detects missing PKs, unindexed foreign keys, redundant duplicate indexes, and unconstrained categoricals with 1-click remediation SQL.
29
+ - 🛡️ **Deterministic PII Data Masking**: Export production data safely for local staging/dev. Pseudonymizes emails, phones, names, IPs, and credentials (`[PROTECTED]`) while preserving relational joins across tables.
30
+ - 🛡️ **Production Shield & Safe Mode**: Intercepts destructive queries (`DELETE`/`UPDATE` without `WHERE`, `DROP`, `TRUNCATE`) with impact analysis and confirmation modals.
31
+ - 📊 **High-Performance Data Grid**: Virtualized inline editing, multi-row bulk actions, column sorting, smart type casting, and JSON preview.
32
+ - 📥 **Smart Import & Export Wizard**: Resilient CSV/JSON import with auto-type inference, multi-line quoted field support, and one-click data dictionary generation.
33
+ - 🗺️ **Interactive Visual ERD**: Pan-and-zoom entity relationship diagram with real-time foreign key mapping and persistent canvas layouts.
34
+ - ⚡ **Schema Diff & Migrations**: Compare schemas against live databases or git-tracked snapshots, preview Up/Down migration DDL, and apply changes safely.
35
+ - 🖥️ **1-Click Desktop App Launcher**: Double-click an icon on your desktop to silently boot the backend and open Drixio in a clean, frameless App window. No terminal commands needed.
36
+ - ⌨️ **Command Palette (Ctrl+K)**: Universal keyboard-first navigation for tables, views, tools, and SQL console snippets.
37
+
38
+ ---
39
+
40
+ ## 🚀 Quick Start
41
+
42
+ Run Drixio directly inside any project containing a supported database:
15
43
 
16
44
  ```bash
17
45
  npx drixio
18
46
  ```
19
47
 
20
- Drixio looks for a database in this order:
48
+ Drixio automatically discovers your database in the following order:
49
+ 1. SQLite files in root, `prisma`, `db`, `database`, `src/db`, or `src/database`
50
+ 2. Prisma schema at `prisma/schema.prisma`
51
+ 3. Environment variables in `.env` (`DATABASE_URL`, `POSTGRES_URL`, `MYSQL_URL`, etc.)
52
+
53
+ You can also pass a connection URL directly for any of the 5 supported engines:
21
54
 
22
- 1. SQLite files in the project root, `prisma`, `db`, `database`, `src/db`, or
23
- `src/database`
24
- 2. A Prisma schema in `prisma/schema.prisma`
25
- 3. A connection URL in `.env`
55
+ ```bash
56
+ # SQLite
57
+ npx drixio "file:./drixio.sqlite"
26
58
 
27
- The following environment variable names are recognized: `DATABASE_URL`,
28
- `DB_URL`, `POSTGRES_URL`, `POSTGRES_PRISMA_URL`, and `MYSQL_URL`.
59
+ # PostgreSQL
60
+ npx drixio "postgresql://postgres:password@localhost:5432/mydb"
29
61
 
30
- You can also pass a connection URL directly:
62
+ # MySQL
63
+ npx drixio "mysql://root:password@localhost:3306/mydb"
31
64
 
32
- ```bash
33
- npx drixio "postgresql://user:password@localhost:5432/mydb"
34
- npx drixio "mysql://user:password@localhost:3306/mydb"
35
- npx drixio "file:./database.sqlite"
65
+ # Microsoft SQL Server (MSSQL)
66
+ npx drixio "mssql://sa:Password123!@localhost:1433/master"
67
+
68
+ # MongoDB (NoSQL)
69
+ npx drixio "mongodb://localhost:27017/drixio_dev"
36
70
  ```
37
71
 
38
- ## Interfaces
72
+ ### 🐳 Local Multi-DB Docker Compose
39
73
 
40
- ### Interactive TUI
74
+ Clone and instantly start all 4 server databases locally:
41
75
 
42
- Running `npx drixio` opens the terminal interface. It includes database setup,
43
- table browsing and editing, table creation and modification wizards, and a SQL
44
- REPL.
76
+ ```bash
77
+ pnpm db:up # Starts PostgreSQL (5432), MySQL (3306), MSSQL (1433), MongoDB (27017)
78
+ pnpm db:status # Check running containers
79
+ pnpm db:down # Stop and clean up
80
+ ```
45
81
 
46
- ### Drixio Studio
82
+ ---
47
83
 
48
- Open the browser-based interface with:
84
+ ## 🖥️ Drixio Studio
85
+
86
+ Launch the browser-based studio on an auto-selected local port (`51213`+):
49
87
 
50
88
  ```bash
51
89
  npx drixio studio
52
- npx drixio studio "postgresql://user:password@localhost:5432/mydb"
53
90
  ```
54
91
 
55
- Studio starts a local server, opens the browser automatically, and chooses an
56
- available port starting at `51213` (or the value of `PORT`). It includes:
57
-
58
- - **Connect Workbench**: Zero-config database setup, dialect switching (SQLite, PostgreSQL, MySQL), pre-flight overview, live connection diagnostics, and smart `DATABASE_URL` auto-fill.
59
- - **Data View**: High-performance grid with pagination, inline editing, column sorting, search filtering, and CSV/JSON export/import.
60
- - **Schema & Table Manager**: Visual table inspector, column editor, foreign key explorer, table creation wizards, and modern ORM generator (Prisma & Drizzle).
61
- - **SQL Console**: Multi-tab SQL runner with intelligent autocomplete, query history, Safe Mode guard for destructive queries (DELETE/UPDATE without WHERE, DROP, TRUNCATE), and built-in SQL Snippets manager.
62
- - **Schema Diff & Migrations**: Visual schema comparison against snapshots or external databases, live preview of Up / Down migration DDL, and one-click apply.
63
- - **Status & Analytics**: Real-time database metrics, table size breakdown, and row distribution statistics.
64
- - **Interactive ERD**: Pan-and-zoom entity relationship diagram with table node dragging and relation link visualization.
65
- - **Command Palette (Ctrl+K)**: Universal quick search and command dispatcher for navigating tables, switching views, and triggering operations.
66
-
67
- ## CLI commands
68
-
69
- All commands use the database detected from the current project unless a
70
- connection URL is supplied where noted.
71
-
72
- | Command | Description |
73
- | ---------------------------------------------- | ------------------------------------------------------------------------ |
74
- | `npx drixio tables` | List all tables with row counts in terminal. `ls` is an alias. |
75
- | `npx drixio describe [table]` | Inspect table columns, types, PKs, FKs, and indexes. `desc` is an alias. |
76
- | `npx drixio query "<sql>"` | Run SQL and print the result as a table. |
77
- | `npx drixio exec <file.sql>` | Execute a SQL script file. |
78
- | `npx drixio export [table]` | Export one table or all tables as CSV or JSON. |
79
- | `npx drixio import [file]` | Import a `.csv` or `.json` file into a table. |
80
- | `npx drixio seed [table] [count]` | Generate realistic mock rows for a table. `mock` is an alias. |
81
- | `npx drixio truncate [table]` | Delete all rows from a table and reset its sequence. |
82
- | `npx drixio backup` | Create a timestamped backup directory with schema and data JSON files. |
83
- | `npx drixio restore [dir\|file]` | Restore database from a backup directory, JSON dump, or SQL script. |
84
- | `npx drixio diff [target]` | Compare schemas with snapshot or DB & generate Up/Down migration SQL. |
85
- | `npx drixio snippets` | List saved SQL snippets and templates. `snip` is an alias. |
86
- | `npx drixio run [snippet]` | Interactively execute a saved snippet or parametric query. |
87
- | `npx drixio diagram` | Generate `drixio_schema.md` with Mermaid schema output. |
88
- | `npx drixio generate-types` | Generate `drixio-types.d.ts` from the database schema. |
89
- | `npx drixio generate-orm [prisma\|drizzle]` | Generate Prisma (`schema.prisma`) or Drizzle (`schema.ts`) ORM schema. |
90
- | `npx drixio init [sqlite\|postgres\|mysql]` | Create or configure a local database and save `DATABASE_URL` to `.env`. |
91
- | `npx drixio drop-db [sqlite\|postgres\|mysql]` | Permanently delete a local database after confirmation. |
92
-
93
- ### Common options
92
+ ### Studio Modules
94
93
 
95
- ```bash
96
- npx drixio tables
97
- npx drixio tables --json
98
- npx drixio describe users
99
- npx drixio export users --format csv
100
- npx drixio export --format json --schema-only
101
- npx drixio import data.json --table users
102
- npx drixio diff --snapshot
103
- npx drixio diff "postgres://..." --apply
104
- npx drixio run snip_recent_records
105
- npx drixio --version
106
- npx drixio --help
107
- ```
94
+ | View | Capabilities |
95
+ | --- | --- |
96
+ | **Data Editor** | Inline row editing, multi-row selection, bulk masked export, JSON cell modal, custom filter builders. |
97
+ | **SQL Console** | Monaco-powered SQL editor, auto-completion, execution plan analysis, multi-tab query manager, Safe Mode guard. |
98
+ | **Schema Manager** | Visual column & constraint designer, foreign key inspector, index viewer, and ORM generator (Prisma & Drizzle). |
99
+ | **Visual ERD** | Pan, zoom, and rearrange table nodes with foreign key connection lines. |
100
+ | **Health Doctor** | Audit schema quality (0-100 score), view performance antipatterns, and copy/run 1-click remediation SQL. |
101
+ | **Recycle Bin** | View soft-deleted tables, review row count & deletion timestamps, restore instantly, or purge cleanly. |
102
+ | **Status & Analytics** | Real-time database metrics, table size breakdown, and row distribution statistics. |
103
+
104
+ ---
105
+
106
+ ## 🧠 BYOK AI Copilot
107
+
108
+ Drixio includes a **Bring-Your-Own-Key (BYOK)** AI assistant that lives directly in your browser and local server:
109
+
110
+ - **Supported Providers**: DeepSeek (V3 & R1), OpenAI (GPT-4o, GPT-4o-mini), Ollama (Local offline models), Groq, or any OpenAI-compatible API endpoint.
111
+ - **Zero Privacy Leakage**: Your API key is stored locally in your browser's `localStorage`. Drixio does not run an intermediary AI proxy server.
112
+ - **Context-Aware**: Injects current table schemas, column types, and foreign key relations into prompts for pinpoint SQL generation.
113
+ - **Built-in Workflows**:
114
+ - 📝 Natural Language to SQL (`"Find all users with active subscriptions who haven't logged in for 30 days"`)
115
+ - ⚡ Query Optimizer & Performance Diagnosis
116
+ - 🐞 Execution Error Auto-Fixer (1-click diagnostic when a query fails)
117
+ - 📖 Query Explanation in plain English
118
+
119
+ ---
108
120
 
109
- - `-v, --version` prints the drixio version.
110
- - `--help` displays command help and options.
111
- - `--json` outputs result as structured JSON (supported by `tables`, `describe`).
112
- - `--format csv|json` selects the export format.
113
- - `--schema-only` exports table definitions without data.
114
- - `--table <name>` selects the destination table for imports or ORM generation.
115
- - `--out <file>` specifies output file path for ORM schemas, diff SQL, or snapshots.
116
- - `--snapshot` exports a schema snapshot JSON for git tracking or offline comparison.
117
- - `--apply` automatically executes and applies generated migration SQL to the current database.
118
- - `--reverse` generates rollback (down) migration SQL.
119
- - `--print` prints generated ORM or schema directly to terminal.
120
- - `--force`, `-y` skips confirmation prompts during restore or database drops.
121
+ ## ♻️ Table Recycle Bin & Safety
121
122
 
122
- Exports are written to `drixio_exports/` in the current directory. Backups are
123
- written to a timestamped `drixio_backup_<timestamp>/` directory. Snapshots and custom
124
- snippets are stored in `.drixio/`.
123
+ Accidental `DROP TABLE` commands in dev or staging can destroy days of test fixtures. Drixio implements an enterprise-grade safety net:
125
124
 
126
- ## Local database setup
125
+ 1. **Soft-Delete Recycle Bin**:
126
+ - When dropping a table via Studio or API, tables are renamed into a protected `_drixio_trash_*` namespace.
127
+ - Deleted tables retain their exact rows, structure, and indexes.
128
+ - 1-click restoration restores the table back to its original name.
129
+ 2. **Pre-Drop File Snapshot**:
130
+ - Simultaneously, a complete schema + record JSON dump is automatically written to `.drixio/trash/` on your disk.
131
+ 3. **Auto-Maintenance**:
132
+ - Soft-deleted tables automatically purge after 7 days (configurable TTL) or when the recycle bin exceeds 20 tables, preventing database clutter.
127
133
 
128
- SQLite needs no server:
134
+ ---
135
+
136
+ ## 🩺 Schema Health Doctor
137
+
138
+ Run automated architectural diagnostics on your database schema with one click:
139
+
140
+ - **Missing Primary Keys**: Flags heap tables lacking a primary key (which breaks ORMs and replication).
141
+ - **Unindexed Foreign Keys**: Catches referenced columns without indexes—the #1 cause of full-table locks during parent `UPDATE` or `DELETE` cascades.
142
+ - **Duplicate & Redundant Indexes**: Identifies identical multi-column indexes wasting disk space and slowing down write operations.
143
+ - **Unconstrained Categoricals**: Recommends `CHECK` constraints or `ENUM`s for status/role columns stored as free-form text.
144
+ - **Health Score**: Computes an overall 0–100 health score with letter grades (`A`, `B`, `C`, `D`) and ready-to-run remediation SQL.
145
+
146
+ ---
147
+
148
+ ## 🛡️ Deterministic PII Data Masking
149
+
150
+ Need to export production data to your local machine or share a bug report with teammates without leaking user credentials or personal data?
151
+
152
+ - **Deterministic Pseudonymization**: Hashing ensures that the same email (e.g. `alice@company.com`) always translates to the exact same pseudonym (`user_a7f9b2@example.test`) across every table and export file. **Foreign key relationships and join consistency are 100% preserved.**
153
+ - **Sensitive Detection**: Automatically detects and handles:
154
+ - **Emails**: Replaced with clean valid pseudonyms (`user_xxxx@example.test`).
155
+ - **Passwords / Secrets / API Keys**: Replaced with `[PROTECTED]`.
156
+ - **Phone Numbers**: Masked with standardized format (`+1-555-xxxx`).
157
+ - **IP Addresses**: Converted into deterministic private subnet IPs (`10.0.x.x`).
158
+ - **Names**: Replaced with realistic pseudonymized handles.
159
+ - **Available Everywhere**: One-click in Table Export, SQL Console Query Export, and Bulk Grid Selection.
160
+
161
+ ---
162
+
163
+ ## 🖥️ 1-Click Desktop App (Zero-Command Launcher)
164
+
165
+ Hate opening the terminal and remembering commands every time you want to inspect your database? Drixio can generate a 1-click desktop app shortcut on your computer:
129
166
 
130
167
  ```bash
131
- npx drixio init sqlite
132
- npx drixio init sqlite my-app
168
+ npx drixio install-app
133
169
  ```
134
170
 
135
- For PostgreSQL and MySQL, `init` asks for local server credentials, creates the
136
- database, and writes the resulting connection URL to `.env`:
171
+ - **Zero Black Windows**: Executes silently via background launcher with no flashing terminal popups.
172
+ - **Standalone Frameless App Window**: Uses Edge/Chrome `--app` standalone window mode. No address bar, no tabs, native window controls.
173
+ - **PWA Ready**: Complete with Web App Manifest (`manifest.json`) and high-res vector app icon.
174
+ - **In-Studio 1-Click**: You can also install the desktop launcher directly inside Drixio Studio from the Command Palette (`Ctrl+K`) or the sidebar footer button.
175
+
176
+ ---
177
+
178
+ ## 💻 CLI Commands
179
+
180
+ Drixio provides a rich set of scriptable CLI commands:
181
+
182
+ | Command | Description |
183
+ | --- | --- |
184
+ | `npx drixio tables` | List all database tables with row counts (`ls` alias). |
185
+ | `npx drixio describe [table]` | Inspect table columns, types, PKs, FKs, and indexes (`desc` alias). |
186
+ | `npx drixio query "<sql>"` | Run raw SQL query and output results in a formatted terminal table. |
187
+ | `npx drixio exec <file.sql>` | Execute a SQL script file. |
188
+ | `npx drixio export [table]` | Export one or all tables as CSV or JSON. |
189
+ | `npx drixio import [file]` | Import a `.csv` or `.json` file into a table with schema validation. |
190
+ | `npx drixio seed [table] [count]` | Generate realistic mock rows for testing (`mock` alias). |
191
+ | `npx drixio truncate [table]` | Delete all rows and reset auto-increment sequences. |
192
+ | `npx drixio backup` | Create a timestamped backup directory with schema and data JSON files. |
193
+ | `npx drixio restore [dir\|file]` | Restore database from a backup directory, JSON dump, or SQL script. |
194
+ | `npx drixio diff [target]` | Compare schemas against a snapshot or database & generate Up/Down migration DDL. |
195
+ | `npx drixio snippets` | List saved SQL snippets and templates (`snip` alias). |
196
+ | `npx drixio run [snippet]` | Execute a saved snippet or parameterized query interactively. |
197
+ | `npx drixio diagram` | Generate `drixio_schema.md` with Mermaid diagram markup. |
198
+ | `npx drixio generate-types` | Generate TypeScript definitions (`drixio-types.d.ts`) from schema. |
199
+ | `npx drixio generate-orm [prisma\|drizzle]` | Generate Prisma (`schema.prisma`) or Drizzle (`schema.ts`) definitions. |
200
+ | `npx drixio init [sqlite\|postgres\|mysql]` | Initialize local database and configure `DATABASE_URL` in `.env`. |
201
+ | `npx drixio drop-db [sqlite\|postgres\|mysql]` | Safely remove a local database after explicit confirmation. |
202
+ | `npx drixio install-app` | Create a 1-click desktop app launcher shortcut (`shortcut` alias). |
203
+
204
+ ### Common CLI Options
137
205
 
138
206
  ```bash
139
- npx drixio init postgres mydb
140
- npx drixio init mysql mydb
207
+ # Output tables as JSON
208
+ npx drixio tables --json
209
+
210
+ # Export with PII masking
211
+ npx drixio export users --format csv
212
+
213
+ # Generate schema snapshot for Git
214
+ npx drixio diff --snapshot
215
+
216
+ # Apply schema diff migrations automatically
217
+ npx drixio diff "postgresql://..." --apply
218
+
219
+ # Generate Drizzle ORM schema to file
220
+ npx drixio generate-orm drizzle --out src/db/schema.ts
141
221
  ```
142
222
 
143
- `drop-db` permanently removes a SQLite file or drops a PostgreSQL/MySQL
144
- database. `truncate` permanently removes all rows from one table. Both commands
145
- ask for confirmation; use them carefully.
223
+ ---
146
224
 
147
- ## Development
225
+ ## 🛠️ Local Development
148
226
 
149
- Install dependencies and run the project locally:
227
+ Clone the repository and install dependencies:
150
228
 
151
229
  ```bash
230
+ git clone https://github.com/TerKSDev/drixio.git
231
+ cd drixio
152
232
  pnpm install
233
+ ```
234
+
235
+ Start development servers:
236
+
237
+ ```bash
238
+ # Terminal TUI & core development
153
239
  pnpm dev
240
+
241
+ # Studio development server
154
242
  pnpm dev:studio
155
243
  ```
156
244
 
157
- Build both the CLI and Studio bundles:
245
+ Run test suite:
246
+
247
+ ```bash
248
+ pnpm test
249
+ pnpm typecheck
250
+ ```
251
+
252
+ Build distribution bundle:
158
253
 
159
254
  ```bash
160
255
  pnpm build
161
256
  ```
162
257
 
163
- The package is published as `drixio`, and `prepublishOnly` builds both bundles
164
- before publishing.
258
+ ---
165
259
 
166
- ## License
260
+ ## 📄 License
167
261
 
168
- MIT
262
+ MIT © [TerKSDev](https://github.com/TerKSDev)