drixio 1.1.7 β 1.1.9
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/README.md +127 -65
- package/dist/cli.js +7804 -2667
- package/dist/studio/assets/index-Ceja0TFO.js +2288 -0
- package/dist/studio/assets/index-DNe5A4CC.css +1 -0
- package/dist/studio/index.html +3 -3
- package/package.json +3 -2
- package/dist/studio/assets/index-CM4X0SRj.css +0 -1
- package/dist/studio/assets/index-dfKs6wCl.js +0 -497
package/README.md
CHANGED
|
@@ -1,105 +1,167 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Drixio
|
|
2
2
|
|
|
3
|
-
|
|
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.
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
## Requirements
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
- Node.js 22 or newer
|
|
10
|
+
- SQLite, PostgreSQL, or MySQL, depending on the database you want to use
|
|
8
11
|
|
|
9
|
-
|
|
10
|
-
- **β‘ Zero Dependencies**: Blazing fast, runs instantly via `npx`.
|
|
11
|
-
- **π οΈ Multi-Database Support**: Connects seamlessly to SQLite, PostgreSQL, and MySQL.
|
|
12
|
-
- **π¦ Smart Data Importer & Exporter**: Import CSV/JSON safely, or export your tables in seconds.
|
|
13
|
-
- **π± Intelligent Data Seeder**: Automatically generates realistic fake data (emails, phones, dates) to populate your tables for testing.
|
|
14
|
-
- **πΊοΈ ER Diagram Generator**: Scans your database and generates a Mermaid ER diagram that can be instantly imported into Draw.io or viewed on GitHub!
|
|
15
|
-
- **π§© TypeScript Types Generator**: Instantly generate TypeScript interfaces (`.d.ts`) directly from your database schema!
|
|
12
|
+
## Install and connect
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
You don't need to install anything. Just run:
|
|
14
|
+
Run Drixio from a project that contains a supported database:
|
|
20
15
|
|
|
21
16
|
```bash
|
|
22
17
|
npx drixio
|
|
23
18
|
```
|
|
24
|
-
Drixio will automatically scan your project for a `.env` file containing a `DATABASE_URL` (e.g., `DATABASE_URL=postgres://user:pass@localhost:5432/mydb`). If it doesn't find one, it will launch a setup wizard to help you connect!
|
|
25
19
|
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
npx drixio "mysql://user:pass@localhost:3306/mydb"
|
|
29
|
-
```
|
|
20
|
+
Drixio looks for a database in this order:
|
|
30
21
|
|
|
31
|
-
|
|
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`
|
|
32
26
|
|
|
33
|
-
|
|
27
|
+
The following environment variable names are recognized: `DATABASE_URL`,
|
|
28
|
+
`DB_URL`, `POSTGRES_URL`, `POSTGRES_PRISMA_URL`, and `MYSQL_URL`.
|
|
34
29
|
|
|
35
|
-
|
|
30
|
+
You can also pass a connection URL directly:
|
|
36
31
|
|
|
37
|
-
### π 1. Initialize a Local Database
|
|
38
|
-
Don't have a database yet? Drixio can create one for you!
|
|
39
32
|
```bash
|
|
40
|
-
npx drixio
|
|
41
|
-
npx drixio
|
|
42
|
-
npx drixio
|
|
33
|
+
npx drixio "postgresql://user:password@localhost:5432/mydb"
|
|
34
|
+
npx drixio "mysql://user:password@localhost:3306/mydb"
|
|
35
|
+
npx drixio "file:./database.sqlite"
|
|
43
36
|
```
|
|
44
|
-
*(For Postgres and MySQL, it connects to your local server and runs `CREATE DATABASE`, then automatically drops a configured `.env` file in your workspace!)*
|
|
45
37
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
38
|
+
## Interfaces
|
|
39
|
+
|
|
40
|
+
### Interactive TUI
|
|
41
|
+
|
|
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.
|
|
45
|
+
|
|
46
|
+
### Drixio Studio
|
|
47
|
+
|
|
48
|
+
Open the browser-based interface with:
|
|
51
49
|
|
|
52
|
-
### π₯ 3. Import Data
|
|
53
|
-
Import massive CSV or JSON files safely. Drixio uses smart chunking to prevent memory overload.
|
|
54
50
|
```bash
|
|
55
|
-
npx drixio
|
|
51
|
+
npx drixio studio
|
|
52
|
+
npx drixio studio "postgresql://user:password@localhost:5432/mydb"
|
|
56
53
|
```
|
|
57
54
|
|
|
58
|
-
|
|
59
|
-
|
|
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
|
+
|
|
66
|
+
## CLI commands
|
|
67
|
+
|
|
68
|
+
All commands use the database detected from the current project unless a
|
|
69
|
+
connection URL is supplied where noted.
|
|
70
|
+
|
|
71
|
+
| Command | Description |
|
|
72
|
+
| ---------------------------------------------- | ------------------------------------------------------------------------ |
|
|
73
|
+
| `npx drixio tables` | List all tables with row counts in terminal. `ls` is an alias. |
|
|
74
|
+
| `npx drixio describe [table]` | Inspect table columns, types, PKs, FKs, and indexes. `desc` is an alias. |
|
|
75
|
+
| `npx drixio query "<sql>"` | Run SQL and print the result as a table. |
|
|
76
|
+
| `npx drixio exec <file.sql>` | Execute a SQL script file. |
|
|
77
|
+
| `npx drixio export [table]` | Export one table or all tables as CSV or JSON. |
|
|
78
|
+
| `npx drixio import [file]` | Import a `.csv` or `.json` file into a table. |
|
|
79
|
+
| `npx drixio seed [table] [count]` | Generate realistic mock rows for a table. `mock` is an alias. |
|
|
80
|
+
| `npx drixio truncate [table]` | Delete all rows from a table and reset its sequence. |
|
|
81
|
+
| `npx drixio backup` | Create a timestamped backup directory with schema and data JSON files. |
|
|
82
|
+
| `npx drixio restore [dir\|file]` | Restore database from a backup directory, JSON dump, or SQL script. |
|
|
83
|
+
| `npx drixio diff [target]` | Compare schemas with snapshot or DB & generate Up/Down migration SQL. |
|
|
84
|
+
| `npx drixio snippets` | List saved SQL snippets and templates. `snip` is an alias. |
|
|
85
|
+
| `npx drixio run [snippet]` | Interactively execute a saved snippet or parametric query. |
|
|
86
|
+
| `npx drixio diagram` | Generate `drixio_schema.md` with Mermaid schema output. |
|
|
87
|
+
| `npx drixio generate-types` | Generate `drixio-types.d.ts` from the database schema. |
|
|
88
|
+
| `npx drixio generate-orm [prisma\|drizzle]` | Generate Prisma (`schema.prisma`) or Drizzle (`schema.ts`) ORM schema. |
|
|
89
|
+
| `npx drixio init [sqlite\|postgres\|mysql]` | Create or configure a local database and save `DATABASE_URL` to `.env`. |
|
|
90
|
+
| `npx drixio drop-db [sqlite\|postgres\|mysql]` | Permanently delete a local database after confirmation. |
|
|
91
|
+
|
|
92
|
+
### Common options
|
|
93
|
+
|
|
60
94
|
```bash
|
|
95
|
+
npx drixio tables
|
|
96
|
+
npx drixio tables --json
|
|
97
|
+
npx drixio describe users
|
|
61
98
|
npx drixio export users --format csv
|
|
62
|
-
npx drixio export
|
|
99
|
+
npx drixio export --format json --schema-only
|
|
100
|
+
npx drixio import data.json --table users
|
|
101
|
+
npx drixio diff --snapshot
|
|
102
|
+
npx drixio diff "postgres://..." --apply
|
|
103
|
+
npx drixio run snip_recent_records
|
|
104
|
+
npx drixio --version
|
|
105
|
+
npx drixio --help
|
|
63
106
|
```
|
|
64
107
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
108
|
+
- `-v, --version` prints the drixio version.
|
|
109
|
+
- `--help` displays command help and options.
|
|
110
|
+
- `--json` outputs result as structured JSON (supported by `tables`, `describe`).
|
|
111
|
+
- `--format csv|json` selects the export format.
|
|
112
|
+
- `--schema-only` exports table definitions without data.
|
|
113
|
+
- `--table <name>` selects the destination table for imports or ORM generation.
|
|
114
|
+
- `--out <file>` specifies output file path for ORM schemas, diff SQL, or snapshots.
|
|
115
|
+
- `--snapshot` exports a schema snapshot JSON for git tracking or offline comparison.
|
|
116
|
+
- `--apply` automatically executes and applies generated migration SQL to the current database.
|
|
117
|
+
- `--reverse` generates rollback (down) migration SQL.
|
|
118
|
+
- `--print` prints generated ORM or schema directly to terminal.
|
|
119
|
+
- `--force`, `-y` skips confirmation prompts during restore or database drops.
|
|
70
120
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
121
|
+
Exports are written to `drixio_exports/` in the current directory. Backups are
|
|
122
|
+
written to a timestamped `drixio_backup_<timestamp>/` directory. Snapshots and custom
|
|
123
|
+
snippets are stored in `.drixio/`.
|
|
124
|
+
|
|
125
|
+
## Local database setup
|
|
126
|
+
|
|
127
|
+
SQLite needs no server:
|
|
77
128
|
|
|
78
|
-
### π§© 7. Generate TypeScript Interfaces
|
|
79
|
-
Tired of manually writing types? Auto-generate them from your schema!
|
|
80
129
|
```bash
|
|
81
|
-
npx drixio
|
|
130
|
+
npx drixio init sqlite
|
|
131
|
+
npx drixio init sqlite my-app
|
|
82
132
|
```
|
|
83
|
-
*(Outputs `drixio-types.d.ts` with all your table interfaces)*
|
|
84
133
|
|
|
85
|
-
|
|
86
|
-
|
|
134
|
+
For PostgreSQL and MySQL, `init` asks for local server credentials, creates the
|
|
135
|
+
database, and writes the resulting connection URL to `.env`:
|
|
136
|
+
|
|
87
137
|
```bash
|
|
88
|
-
npx drixio
|
|
138
|
+
npx drixio init postgres mydb
|
|
139
|
+
npx drixio init mysql mydb
|
|
89
140
|
```
|
|
90
141
|
|
|
91
|
-
|
|
92
|
-
|
|
142
|
+
`drop-db` permanently removes a SQLite file or drops a PostgreSQL/MySQL
|
|
143
|
+
database. `truncate` permanently removes all rows from one table. Both commands
|
|
144
|
+
ask for confirmation; use them carefully.
|
|
145
|
+
|
|
146
|
+
## Development
|
|
147
|
+
|
|
148
|
+
Install dependencies and run the project locally:
|
|
149
|
+
|
|
93
150
|
```bash
|
|
94
|
-
|
|
151
|
+
pnpm install
|
|
152
|
+
pnpm dev
|
|
153
|
+
pnpm dev:studio
|
|
95
154
|
```
|
|
96
155
|
|
|
97
|
-
|
|
98
|
-
|
|
156
|
+
Build both the CLI and Studio bundles:
|
|
157
|
+
|
|
99
158
|
```bash
|
|
100
|
-
|
|
159
|
+
pnpm build
|
|
101
160
|
```
|
|
102
161
|
|
|
103
|
-
|
|
162
|
+
The package is published as `drixio`, and `prepublishOnly` builds both bundles
|
|
163
|
+
before publishing.
|
|
164
|
+
|
|
165
|
+
## License
|
|
104
166
|
|
|
105
|
-
|
|
167
|
+
MIT
|