spindb 0.32.2 → 0.34.0
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 +8 -0
- package/README.md +112 -855
- package/cli/commands/connect.ts +99 -0
- package/cli/commands/create.ts +5 -1
- package/cli/commands/engines.ts +78 -1
- package/cli/commands/menu/backup-handlers.ts +9 -0
- package/cli/commands/menu/container-handlers.ts +41 -12
- package/cli/commands/menu/engine-handlers.ts +4 -0
- package/cli/commands/menu/index.ts +72 -1
- package/cli/commands/menu/settings-handlers.ts +3 -0
- package/cli/commands/menu/shell-handlers.ts +592 -12
- package/cli/commands/ports.ts +211 -0
- package/cli/constants.ts +7 -3
- package/cli/helpers.ts +73 -0
- package/cli/index.ts +2 -0
- package/cli/ui/prompts.ts +4 -2
- package/config/backup-formats.ts +14 -0
- package/config/engine-defaults.ts +13 -0
- package/config/engines.json +17 -0
- package/core/config-manager.ts +18 -0
- package/core/dblab-utils.ts +113 -0
- package/core/dependency-manager.ts +6 -0
- package/core/docker-exporter.ts +13 -0
- package/core/pgweb-utils.ts +62 -0
- package/engines/base-engine.ts +9 -0
- package/engines/cockroachdb/index.ts +3 -0
- package/engines/ferretdb/index.ts +46 -27
- package/engines/index.ts +4 -0
- package/engines/influxdb/README.md +180 -0
- package/engines/influxdb/api-client.ts +64 -0
- package/engines/influxdb/backup.ts +160 -0
- package/engines/influxdb/binary-manager.ts +110 -0
- package/engines/influxdb/binary-urls.ts +69 -0
- package/engines/influxdb/hostdb-releases.ts +23 -0
- package/engines/influxdb/index.ts +1227 -0
- package/engines/influxdb/restore.ts +417 -0
- package/engines/influxdb/version-maps.ts +75 -0
- package/engines/influxdb/version-validator.ts +128 -0
- package/engines/postgresql/index.ts +3 -0
- package/package.json +2 -1
- package/types/index.ts +17 -0
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
**One CLI for all your local databases.**
|
|
9
9
|
|
|
10
|
-
SpinDB is a universal database management tool that combines a package manager, a unified API, and native client tooling for
|
|
10
|
+
SpinDB is a universal database management tool that combines a package manager, a unified API, and native client tooling for 18 different database engines—all from a single command-line interface. No Docker, no VMs, no platform-specific installers. Just databases, running natively on your machine.
|
|
11
11
|
|
|
12
12
|
```bash
|
|
13
13
|
npm install -g spindb
|
|
@@ -28,7 +28,7 @@ spindb create cache --engine redis
|
|
|
28
28
|
|
|
29
29
|
## Supported Engines & Platforms
|
|
30
30
|
|
|
31
|
-
SpinDB supports **
|
|
31
|
+
SpinDB supports **18 database engines** across **5 platform architectures**—all with a consistent API.
|
|
32
32
|
|
|
33
33
|
| Engine | Type | macOS ARM | macOS Intel | Linux x64 | Linux ARM | Windows |
|
|
34
34
|
|--------|------|:---------:|:-----------:|:---------:|:---------:|:-------:|
|
|
@@ -49,102 +49,87 @@ SpinDB supports **17 database engines** across **5 platform architectures**—al
|
|
|
49
49
|
| 🌀 **SurrealDB** | Multi-Model | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
50
50
|
| ⏱️ **QuestDB** | Time-Series | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
51
51
|
| 🤖 **TypeDB** | Knowledge Graph | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
52
|
+
| 📈 **InfluxDB** | Time-Series | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
52
53
|
|
|
53
|
-
**
|
|
54
|
+
**88 combinations. One CLI. Zero configuration.**
|
|
54
55
|
|
|
55
56
|
> ClickHouse and FerretDB are available on Windows via WSL.
|
|
56
57
|
|
|
57
58
|
---
|
|
58
59
|
|
|
59
|
-
##
|
|
60
|
-
|
|
61
|
-
SpinDB is **three tools in one**:
|
|
62
|
-
|
|
63
|
-
### 1. **Database Package Manager**
|
|
64
|
-
Download and manage multiple database engines and versions—just like `apt`, `brew`, or `npm`, but for databases.
|
|
60
|
+
## Quick Start
|
|
65
61
|
|
|
66
62
|
```bash
|
|
67
|
-
#
|
|
68
|
-
|
|
69
|
-
spindb create new-project --engine postgresql --db-version 18
|
|
70
|
-
|
|
71
|
-
# Or MySQL 8.0 alongside MySQL 9
|
|
72
|
-
spindb create legacy-mysql --engine mysql --db-version 8.0
|
|
73
|
-
spindb create modern-mysql --engine mysql --db-version 9
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
### 2. **Unified Database API**
|
|
77
|
-
One consistent interface across SQL databases, document stores, key-value stores, and analytics engines.
|
|
63
|
+
# Install
|
|
64
|
+
npm install -g spindb # or: pnpm add -g spindb
|
|
78
65
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
spindb create mydb --engine [postgresql|mysql|mariadb|mongodb|ferretdb|redis|valkey|clickhouse|sqlite|duckdb|qdrant|meilisearch|couchdb|cockroachdb|surrealdb|questdb|typedb]
|
|
82
|
-
spindb start mydb
|
|
83
|
-
spindb connect mydb
|
|
84
|
-
spindb backup mydb
|
|
85
|
-
spindb restore mydb backup.dump
|
|
66
|
+
# Create and start a PostgreSQL database
|
|
67
|
+
spindb create myapp --start --connect
|
|
86
68
|
```
|
|
87
69
|
|
|
88
|
-
|
|
89
|
-
Access built-in shells, run queries, and execute scripts—all without installing separate clients.
|
|
90
|
-
|
|
91
|
-
```bash
|
|
92
|
-
# Execute SQL/NoSQL/commands across any engine
|
|
93
|
-
spindb run mydb script.sql # PostgreSQL/MySQL/SQLite
|
|
94
|
-
spindb run mydb -c "db.users.find().pretty()" # MongoDB
|
|
95
|
-
spindb run mydb -c "SET mykey myvalue" # Redis/Valkey
|
|
96
|
-
spindb run mydb -c "SELECT * FROM system.tables" # ClickHouse
|
|
97
|
-
```
|
|
70
|
+
That's it! Your PostgreSQL database is running on `localhost:5432`, and data persists in `~/.spindb/containers/postgresql/myapp/`.
|
|
98
71
|
|
|
99
72
|
---
|
|
100
73
|
|
|
101
|
-
##
|
|
74
|
+
## Basic Usage
|
|
102
75
|
|
|
103
|
-
|
|
76
|
+
### PostgreSQL
|
|
104
77
|
|
|
105
78
|
```bash
|
|
106
|
-
#
|
|
107
|
-
|
|
79
|
+
spindb create myapp # Create (default engine)
|
|
80
|
+
spindb start myapp # Start
|
|
81
|
+
spindb connect myapp # Open psql shell
|
|
82
|
+
spindb run myapp -c "SELECT version()" # Run inline SQL
|
|
83
|
+
spindb run myapp ./schema.sql # Run SQL file
|
|
84
|
+
spindb backup myapp --format sql # Backup
|
|
85
|
+
spindb url myapp --copy # Copy connection string
|
|
86
|
+
```
|
|
108
87
|
|
|
109
|
-
|
|
110
|
-
pnpm add -g spindb
|
|
88
|
+
### MongoDB
|
|
111
89
|
|
|
112
|
-
|
|
113
|
-
|
|
90
|
+
```bash
|
|
91
|
+
spindb create logs --engine mongodb --start
|
|
92
|
+
spindb run logs -c "db.users.insertOne({name: 'Alice'})"
|
|
93
|
+
spindb run logs -c "db.users.find().pretty()"
|
|
94
|
+
spindb connect logs # Open mongosh
|
|
95
|
+
spindb backup logs --format archive
|
|
114
96
|
```
|
|
115
97
|
|
|
116
|
-
|
|
98
|
+
### Redis
|
|
117
99
|
|
|
118
100
|
```bash
|
|
119
|
-
|
|
120
|
-
spindb
|
|
121
|
-
spindb
|
|
122
|
-
spindb connect
|
|
123
|
-
|
|
124
|
-
# Or all in one command
|
|
125
|
-
spindb create myapp --start --connect
|
|
101
|
+
spindb create cache --engine redis --start
|
|
102
|
+
spindb run cache -c "SET mykey myvalue"
|
|
103
|
+
spindb run cache -c "GET mykey"
|
|
104
|
+
spindb connect cache # Open redis-cli
|
|
105
|
+
spindb connect cache --iredis # Enhanced shell
|
|
126
106
|
```
|
|
127
107
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
### Try Other Engines
|
|
108
|
+
### Enhanced Shells & Visual Tools
|
|
131
109
|
|
|
132
110
|
```bash
|
|
133
|
-
#
|
|
134
|
-
spindb
|
|
135
|
-
|
|
136
|
-
#
|
|
137
|
-
|
|
111
|
+
spindb connect myapp --pgcli # Enhanced PostgreSQL shell
|
|
112
|
+
spindb connect myapp --dblab # Visual TUI (table browser)
|
|
113
|
+
spindb connect mydb --mycli # Enhanced MySQL/MariaDB shell
|
|
114
|
+
spindb connect mydb --ui # Built-in Web UI (DuckDB)
|
|
115
|
+
```
|
|
138
116
|
|
|
139
|
-
|
|
140
|
-
spindb create sessions --engine redis --start
|
|
117
|
+
### Any Engine
|
|
141
118
|
|
|
142
|
-
|
|
143
|
-
spindb create
|
|
119
|
+
```bash
|
|
120
|
+
spindb create mydb --engine [postgresql|mysql|mariadb|mongodb|ferretdb|redis|valkey|clickhouse|sqlite|duckdb|qdrant|meilisearch|couchdb|cockroachdb|surrealdb|questdb|typedb|influxdb]
|
|
121
|
+
spindb start mydb
|
|
122
|
+
spindb connect mydb
|
|
123
|
+
spindb backup mydb
|
|
124
|
+
spindb restore mydb backup.dump
|
|
125
|
+
spindb clone mydb mydb-copy
|
|
126
|
+
spindb delete mydb -f
|
|
144
127
|
```
|
|
145
128
|
|
|
146
129
|
Every engine works the same way. Learn one, use them all.
|
|
147
130
|
|
|
131
|
+
> See [CHEATSHEET.md](CHEATSHEET.md) for the complete command reference, connection strings, backup formats, scripting patterns, and more.
|
|
132
|
+
|
|
148
133
|
---
|
|
149
134
|
|
|
150
135
|
## Why SpinDB?
|
|
@@ -174,7 +159,7 @@ SpinDB runs databases as **native processes** with **isolated data directories**
|
|
|
174
159
|
|
|
175
160
|
| Feature | SpinDB | DBngin | Postgres.app | Laragon |
|
|
176
161
|
|---------|--------|--------|--------------|---------|
|
|
177
|
-
| **Engines supported** |
|
|
162
|
+
| **Engines supported** | 18 | 3 (PG/MySQL/Redis) | 1 (PostgreSQL) | 4 (PG/MySQL/MariaDB/MongoDB) |
|
|
178
163
|
| CLI-first | ✅ | ❌ GUI-only | ❌ GUI-only | ⚠️ Limited CLI |
|
|
179
164
|
| Multi-version support | ✅ | ✅ | ✅ | ✅ |
|
|
180
165
|
| Built-in backup/restore | ✅ | ✅ | ❌ | ⚠️ Manual |
|
|
@@ -190,7 +175,7 @@ SpinDB runs databases as **native processes** with **isolated data directories**
|
|
|
190
175
|
|
|
191
176
|
| Feature | SpinDB | Docker Desktop | Podman | OrbStack |
|
|
192
177
|
|---------|--------|----------------|--------|----------|
|
|
193
|
-
| **Engines supported** |
|
|
178
|
+
| **Engines supported** | 18 unified | Any (manual setup) | Any (manual setup) | Any (manual setup) |
|
|
194
179
|
| Daemon required | ❌ | ✅ | ❌ (rootless) | ✅ |
|
|
195
180
|
| Resource overhead | Native | VM + containers | VM + containers | VM + containers |
|
|
196
181
|
| Built-in backup/restore | ✅ | ❌ Manual | ❌ Manual | ❌ Manual |
|
|
@@ -206,7 +191,7 @@ SpinDB runs databases as **native processes** with **isolated data directories**
|
|
|
206
191
|
|
|
207
192
|
| Feature | SpinDB | Homebrew | apt/winget | asdf-vm |
|
|
208
193
|
|---------|--------|----------|------------|---------|
|
|
209
|
-
| **Engines supported** |
|
|
194
|
+
| **Engines supported** | 18 unified | Many (separate formulas) | Many (separate packages) | Many (plugins) |
|
|
210
195
|
| Multi-version side-by-side | ✅ | ⚠️ Complex | ❌ | ✅ |
|
|
211
196
|
| Isolated data directories | ✅ | ❌ System-wide | ❌ System-wide | ❌ |
|
|
212
197
|
| Built-in backup/restore | ✅ | ❌ | ❌ | ❌ |
|
|
@@ -221,316 +206,14 @@ SpinDB runs databases as **native processes** with **isolated data directories**
|
|
|
221
206
|
|
|
222
207
|
---
|
|
223
208
|
|
|
224
|
-
## Supported Databases
|
|
225
|
-
|
|
226
|
-
SpinDB supports **17 database engines** with **multiple versions** for each:
|
|
227
|
-
|
|
228
|
-
| Engine | Type | Versions | Default Port | Query Language |
|
|
229
|
-
|--------|------|----------|--------------|----------------|
|
|
230
|
-
| 🐘 **PostgreSQL** | Relational (SQL) | 15, 16, 17, 18 | 5432 | SQL |
|
|
231
|
-
| 🐬 **MySQL** | Relational (SQL) | 8.0, 8.4, 9 | 3306 | SQL |
|
|
232
|
-
| 🦭 **MariaDB** | Relational (SQL) | 10.11, 11.4, 11.8 | 3307 | SQL |
|
|
233
|
-
| 🪶 **SQLite** | Embedded (SQL) | 3 | N/A (file-based) | SQL |
|
|
234
|
-
| 🦆 **DuckDB** | Embedded OLAP | 1.4.3 | N/A (file-based) | SQL |
|
|
235
|
-
| 🍃 **MongoDB** | Document Store | 7.0, 8.0, 8.2 | 27017 | JavaScript (mongosh) |
|
|
236
|
-
| 🦔 **FerretDB** | Document Store | 2 | 27017 | JavaScript (mongosh) |
|
|
237
|
-
| 🔴 **Redis** | Key-Value Store | 7, 8 | 6379 | Redis commands |
|
|
238
|
-
| 🔷 **Valkey** | Key-Value Store | 8, 9 | 6379 | Redis commands |
|
|
239
|
-
| 🏠 **ClickHouse** | Columnar OLAP | 25.12 | 9000 (TCP), 8123 (HTTP) | SQL (ClickHouse dialect) |
|
|
240
|
-
| 🧭 **Qdrant** | Vector Search | 1 | 6333 (HTTP), 6334 (gRPC) | REST API |
|
|
241
|
-
| 🔍 **Meilisearch** | Full-Text Search | 1 | 7700 | REST API |
|
|
242
|
-
| 🛋️ **CouchDB** | Document Store | 3 | 5984 | REST API |
|
|
243
|
-
| 🪳 **CockroachDB** | Distributed SQL | 25 | 26257 | SQL (PostgreSQL-compatible) |
|
|
244
|
-
| 🌀 **SurrealDB** | Multi-Model | 2 | 8000 | SurrealQL |
|
|
245
|
-
| ⏱️ **QuestDB** | Time-Series SQL | 9 | 8812 (PG), 9000 (HTTP) | SQL |
|
|
246
|
-
| 🤖 **TypeDB** | Knowledge Graph | 3 | 1729, 8000 (HTTP) | TypeQL |
|
|
247
|
-
|
|
248
|
-
### Engine Categories
|
|
249
|
-
|
|
250
|
-
**Server-Based Databases** (PostgreSQL, MySQL, MariaDB, MongoDB, FerretDB, Redis, Valkey, ClickHouse, Qdrant, Meilisearch, CouchDB, CockroachDB, SurrealDB, QuestDB, TypeDB):
|
|
251
|
-
- Start/stop server processes
|
|
252
|
-
- Bind to localhost ports
|
|
253
|
-
- Data stored in `~/.spindb/containers/{engine}/{name}/`
|
|
254
|
-
|
|
255
|
-
**File-Based Databases** (SQLite, DuckDB):
|
|
256
|
-
- No server process required
|
|
257
|
-
- Data stored in your project directories
|
|
258
|
-
- Always "running" (embedded, no daemon)
|
|
259
|
-
|
|
260
|
-
### Binary Sources
|
|
261
|
-
|
|
262
|
-
All engines download pre-compiled binaries from [**hostdb**](https://github.com/robertjbass/hostdb), a repository of portable database binaries for all major platforms:
|
|
263
|
-
|
|
264
|
-
- **PostgreSQL**: hostdb (macOS/Linux), [EnterpriseDB](https://www.enterprisedb.com/) (Windows)
|
|
265
|
-
- **All other engines**: hostdb (all supported platforms)
|
|
266
|
-
|
|
267
|
-
This enables **multi-version support** without system package conflicts. Run PostgreSQL 14 for legacy projects and 18 for new ones—simultaneously.
|
|
268
|
-
|
|
269
|
-
---
|
|
270
|
-
|
|
271
|
-
## Core Commands
|
|
272
|
-
|
|
273
|
-
SpinDB provides a comprehensive CLI with commands for every database lifecycle operation.
|
|
274
|
-
|
|
275
|
-
### Container Lifecycle
|
|
276
|
-
|
|
277
|
-
```bash
|
|
278
|
-
# Create a new database
|
|
279
|
-
spindb create mydb # PostgreSQL (default)
|
|
280
|
-
spindb create mydb --engine mongodb # MongoDB
|
|
281
|
-
spindb create mydb --engine mysql --db-version 8.0 # MySQL 8.0
|
|
282
|
-
spindb create mydb --port 5433 # Custom port
|
|
283
|
-
spindb create mydb --start --connect # Create, start, and connect
|
|
284
|
-
spindb create mydb --force # Overwrite existing container
|
|
285
|
-
|
|
286
|
-
# Start/stop databases
|
|
287
|
-
spindb start mydb
|
|
288
|
-
spindb stop mydb
|
|
289
|
-
|
|
290
|
-
# Delete database (with confirmation)
|
|
291
|
-
spindb delete mydb
|
|
292
|
-
spindb delete mydb --yes --force # Skip prompts, force stop
|
|
293
|
-
```
|
|
294
|
-
|
|
295
|
-
### Data Operations
|
|
296
|
-
|
|
297
|
-
```bash
|
|
298
|
-
# Connect to database shell
|
|
299
|
-
spindb connect mydb # Standard client (psql, mysql, etc.)
|
|
300
|
-
spindb connect mydb --pgcli # Enhanced PostgreSQL shell
|
|
301
|
-
spindb connect mydb --mycli # Enhanced MySQL shell
|
|
302
|
-
spindb connect mydb --tui # Universal SQL client (usql)
|
|
303
|
-
|
|
304
|
-
# Execute queries and scripts
|
|
305
|
-
spindb run mydb script.sql # Run SQL file
|
|
306
|
-
spindb run mydb -c "SELECT * FROM users" # Inline SQL
|
|
307
|
-
spindb run mydb seed.js # JavaScript (MongoDB)
|
|
308
|
-
spindb run mydb -c "SET foo bar" # Redis command
|
|
309
|
-
|
|
310
|
-
# Query with structured output
|
|
311
|
-
spindb query mydb "SELECT * FROM users LIMIT 5" # Tabular output
|
|
312
|
-
spindb query mydb "SELECT * FROM users" --json # JSON for scripting
|
|
313
|
-
spindb query mydb "users.find()" -d mydb # MongoDB/FerretDB
|
|
314
|
-
spindb query myredis "KEYS user:*" # Redis/Valkey
|
|
315
|
-
spindb query myqdrant "GET /collections" # REST API engines
|
|
316
|
-
|
|
317
|
-
# Get connection string
|
|
318
|
-
spindb url mydb # postgresql://postgres@localhost:5432/mydb
|
|
319
|
-
spindb url mydb --copy # Copy to clipboard
|
|
320
|
-
spindb url mydb --json # JSON output with details
|
|
321
|
-
|
|
322
|
-
# Use in scripts
|
|
323
|
-
export DATABASE_URL=$(spindb url mydb)
|
|
324
|
-
psql $(spindb url mydb)
|
|
325
|
-
```
|
|
326
|
-
|
|
327
|
-
### User Management
|
|
328
|
-
|
|
329
|
-
```bash
|
|
330
|
-
# Create database users and API keys
|
|
331
|
-
spindb users create mydb # Auto-generate password
|
|
332
|
-
spindb users create mydb --password p # Use specific password
|
|
333
|
-
spindb users create mydb --copy # Copy connection string to clipboard
|
|
334
|
-
spindb users create mydb --json # JSON output for scripting
|
|
335
|
-
spindb users create mydb --no-save # Don't save credential file
|
|
336
|
-
|
|
337
|
-
# List saved credentials
|
|
338
|
-
spindb users list mydb # List usernames
|
|
339
|
-
spindb users list mydb --json # JSON output
|
|
340
|
-
```
|
|
341
|
-
|
|
342
|
-
Supports PostgreSQL, MySQL, MariaDB, CockroachDB, ClickHouse, MongoDB, FerretDB, Redis, Valkey, SurrealDB, CouchDB, Meilisearch, and Qdrant. Not supported: SQLite, DuckDB, QuestDB, TypeDB. Credentials are saved as `.env.<username>` files in `~/.spindb/containers/{engine}/{name}/credentials/`.
|
|
343
|
-
|
|
344
|
-
### Backup & Restore
|
|
345
|
-
|
|
346
|
-
```bash
|
|
347
|
-
# Create backups
|
|
348
|
-
spindb backup mydb # Auto-generated filename
|
|
349
|
-
spindb backup mydb --name production-backup # Custom name
|
|
350
|
-
spindb backup mydb --output ./backups/ # Custom directory
|
|
351
|
-
spindb backup mydb --format sql # SQL text format (PostgreSQL)
|
|
352
|
-
spindb backup mydb --format custom # Custom binary format (PostgreSQL)
|
|
353
|
-
|
|
354
|
-
# Restore from backups
|
|
355
|
-
spindb restore mydb backup.dump
|
|
356
|
-
spindb restore mydb backup.sql --database prod_copy
|
|
357
|
-
|
|
358
|
-
# Clone existing database
|
|
359
|
-
spindb create prod-copy --from ./prod-backup.dump
|
|
360
|
-
spindb create staging --from "postgresql://user:pass@prod:5432/production"
|
|
361
|
-
```
|
|
362
|
-
|
|
363
|
-
### Pull from Remote Database
|
|
364
|
-
|
|
365
|
-
Sync production data to your local database while automatically backing up your original data:
|
|
366
|
-
|
|
367
|
-
```bash
|
|
368
|
-
# Pull production data (backs up original, replaces with remote)
|
|
369
|
-
spindb pull mydb --from "postgresql://user:pass@prod-host/db"
|
|
370
|
-
|
|
371
|
-
# Read URL from environment variable (keeps credentials out of shell history)
|
|
372
|
-
spindb pull mydb --from-env CLONE_FROM_DATABASE_URL
|
|
373
|
-
|
|
374
|
-
# Clone mode: pull to new database (original untouched)
|
|
375
|
-
spindb pull mydb --from-env PROD_URL --as mydb_prod
|
|
376
|
-
|
|
377
|
-
# Preview what will happen
|
|
378
|
-
spindb pull mydb --from-env PROD_URL --dry-run
|
|
379
|
-
|
|
380
|
-
# Run post-pull script (e.g., sync local credentials)
|
|
381
|
-
spindb pull mydb --from-env PROD_URL --post-script ./sync-credentials.ts
|
|
382
|
-
```
|
|
383
|
-
|
|
384
|
-
### Export to Docker
|
|
385
|
-
|
|
386
|
-
Generate a Docker-ready package from any SpinDB container:
|
|
387
|
-
|
|
388
|
-
```bash
|
|
389
|
-
# Export to Docker (generates Dockerfile, docker-compose.yml, etc.)
|
|
390
|
-
spindb export docker mydb
|
|
391
|
-
|
|
392
|
-
# Custom output directory
|
|
393
|
-
spindb export docker mydb -o ./deploy
|
|
394
|
-
|
|
395
|
-
# Override port (default: engine's standard port, e.g., 5432 for PostgreSQL)
|
|
396
|
-
spindb export docker mydb -p 5433
|
|
397
|
-
|
|
398
|
-
# Skip database backup or TLS certificates
|
|
399
|
-
spindb export docker mydb --no-data
|
|
400
|
-
spindb export docker mydb --no-tls
|
|
401
|
-
|
|
402
|
-
# JSON output for scripting
|
|
403
|
-
spindb export docker mydb --json --force
|
|
404
|
-
```
|
|
405
|
-
|
|
406
|
-
Generated files:
|
|
407
|
-
- `Dockerfile` - Ubuntu 22.04 + Node.js 22 + SpinDB
|
|
408
|
-
- `docker-compose.yml` - Container orchestration
|
|
409
|
-
- `.env` - Auto-generated credentials
|
|
410
|
-
- `certs/` - TLS certificates (self-signed)
|
|
411
|
-
- `data/` - Database backup
|
|
412
|
-
- `entrypoint.sh` - Startup script
|
|
413
|
-
- `README.md` - Instructions
|
|
414
|
-
|
|
415
|
-
### Deploying Your Container
|
|
416
|
-
|
|
417
|
-
**SpinDB doesn't require Docker for local development**, but it can repackage your database as a Docker image for deployment to cloud servers, EC2 instances, Kubernetes clusters, or any Docker-compatible environment.
|
|
418
|
-
|
|
419
|
-
```bash
|
|
420
|
-
# Export your local database to Docker
|
|
421
|
-
spindb export docker mydb -o ./mydb-deploy
|
|
422
|
-
|
|
423
|
-
# Build and run
|
|
424
|
-
cd ./mydb-deploy
|
|
425
|
-
docker compose build --no-cache
|
|
426
|
-
docker compose up -d
|
|
427
|
-
|
|
428
|
-
# Connect from host (credentials in .env)
|
|
429
|
-
source .env
|
|
430
|
-
psql "postgresql://$SPINDB_USER:$SPINDB_PASSWORD@localhost:$PORT/$DATABASE"
|
|
431
|
-
```
|
|
432
|
-
|
|
433
|
-
**Schema-only vs Full Data:**
|
|
434
|
-
```bash
|
|
435
|
-
spindb export docker mydb # Include all data (default)
|
|
436
|
-
spindb export docker mydb --no-data # Schema only (empty tables)
|
|
437
|
-
```
|
|
438
|
-
|
|
439
|
-
> **Development Tool Notice:** SpinDB is currently a development tool. While Docker exports include TLS encryption and authentication, they are intended for staging and testing—not production workloads. For production databases, consider managed services.
|
|
440
|
-
|
|
441
|
-
**Future Export Options:** Additional export targets are planned for future releases, including direct deployment to managed database services like Neon, Supabase, and PlanetScale.
|
|
442
|
-
|
|
443
|
-
See [DEPLOY.md](DEPLOY.md) for comprehensive deployment documentation.
|
|
444
|
-
|
|
445
|
-
### Container Management
|
|
446
|
-
|
|
447
|
-
```bash
|
|
448
|
-
# List all databases
|
|
449
|
-
spindb list
|
|
450
|
-
spindb list --json
|
|
451
|
-
|
|
452
|
-
# Show container details
|
|
453
|
-
spindb info mydb
|
|
454
|
-
spindb info mydb --json
|
|
455
|
-
|
|
456
|
-
# Clone a database
|
|
457
|
-
spindb clone source-db new-db
|
|
458
|
-
|
|
459
|
-
# Edit configuration
|
|
460
|
-
spindb edit mydb --name newname # Rename
|
|
461
|
-
spindb edit mydb --port 5433 # Change port
|
|
462
|
-
spindb edit mydb --relocate ~/new/path # Move SQLite/DuckDB file
|
|
463
|
-
|
|
464
|
-
# View logs
|
|
465
|
-
spindb logs mydb
|
|
466
|
-
spindb logs mydb --follow # Follow mode (tail -f)
|
|
467
|
-
spindb logs mydb -n 100 # Last 100 lines
|
|
468
|
-
|
|
469
|
-
# Manage database tracking (for external scripts)
|
|
470
|
-
spindb databases list mydb # List tracked databases
|
|
471
|
-
spindb databases add mydb analytics # Add to tracking
|
|
472
|
-
spindb databases remove mydb old_backup # Remove from tracking
|
|
473
|
-
spindb databases sync mydb oldname newname # Sync after rename
|
|
474
|
-
```
|
|
475
|
-
|
|
476
|
-
### Engine & System Management
|
|
477
|
-
|
|
478
|
-
```bash
|
|
479
|
-
# Manage installed engines
|
|
480
|
-
spindb engines # List installed engines
|
|
481
|
-
spindb engines supported # Show all supported engines
|
|
482
|
-
spindb engines delete postgresql 16 # Remove specific version
|
|
483
|
-
|
|
484
|
-
# Manage client tools
|
|
485
|
-
spindb deps check # Check all dependencies
|
|
486
|
-
spindb deps check --engine postgresql # Check specific engine
|
|
487
|
-
spindb deps install # Install missing tools
|
|
488
|
-
|
|
489
|
-
# Configuration
|
|
490
|
-
spindb config show # Show current config
|
|
491
|
-
spindb config detect # Re-detect tool paths
|
|
492
|
-
spindb config update-check on # Enable update checks
|
|
493
|
-
spindb config update-check off # Disable update checks
|
|
494
|
-
|
|
495
|
-
# Doctor
|
|
496
|
-
spindb doctor # Interactive health check
|
|
497
|
-
spindb doctor --fix # Auto-fix all issues
|
|
498
|
-
spindb doctor --dry-run # Preview fixes without applying
|
|
499
|
-
spindb doctor --json # JSON output
|
|
500
|
-
|
|
501
|
-
# Version management
|
|
502
|
-
spindb version # Show current version
|
|
503
|
-
spindb version --check # Check for updates
|
|
504
|
-
spindb self-update # Update to latest version
|
|
505
|
-
```
|
|
506
|
-
|
|
507
|
-
### Interactive Menu
|
|
508
|
-
|
|
509
|
-
Don't want to remember commands? Just run:
|
|
510
|
-
|
|
511
|
-
```bash
|
|
512
|
-
spindb
|
|
513
|
-
```
|
|
514
|
-
|
|
515
|
-
You'll get an interactive menu with arrow-key navigation for all operations. **The menu is just a friendlier interface—everything is also available as a direct CLI command.**
|
|
516
|
-
|
|
517
|
-
---
|
|
518
|
-
|
|
519
209
|
## How It Works
|
|
520
210
|
|
|
521
|
-
### Architecture
|
|
522
|
-
|
|
523
211
|
SpinDB uses "container" terminology loosely—there's no Docker involved. When you create a container, SpinDB:
|
|
524
212
|
|
|
525
213
|
1. **Downloads database binaries** from [hostdb](https://github.com/robertjbass/hostdb) or uses system installations
|
|
526
214
|
2. **Creates isolated data directories** at `~/.spindb/containers/{engine}/{name}/`
|
|
527
215
|
3. **Runs databases as native processes** on your machine
|
|
528
216
|
|
|
529
|
-
Each container contains:
|
|
530
|
-
- `container.json` - Configuration (port, version, status)
|
|
531
|
-
- `data/` - Database files
|
|
532
|
-
- `{engine}.log` - Server logs
|
|
533
|
-
|
|
534
217
|
### Storage Layout
|
|
535
218
|
|
|
536
219
|
```bash
|
|
@@ -558,544 +241,120 @@ Each container contains:
|
|
|
558
241
|
|
|
559
242
|
### Data Persistence
|
|
560
243
|
|
|
561
|
-
Databases run as **native processes**, and **data persists across restarts**.
|
|
562
|
-
|
|
563
|
-
1. SpinDB sends a graceful shutdown signal
|
|
564
|
-
2. The database flushes pending writes to disk
|
|
565
|
-
3. Data remains in the `data/` directory
|
|
566
|
-
|
|
567
|
-
**Your data is never deleted unless you explicitly run `spindb delete`.**
|
|
568
|
-
|
|
569
|
-
#### Durability by Engine
|
|
570
|
-
|
|
571
|
-
| Engine | Persistence Mechanism | Durability |
|
|
572
|
-
|--------|----------------------|------------|
|
|
573
|
-
| PostgreSQL | Write-Ahead Logging (WAL) | Committed transactions survive crashes |
|
|
574
|
-
| MySQL | InnoDB transaction logs | Committed transactions survive crashes |
|
|
575
|
-
| MariaDB | InnoDB transaction logs | Committed transactions survive crashes |
|
|
576
|
-
| SQLite | File-based transactions | Commits written immediately to disk |
|
|
577
|
-
| DuckDB | File-based transactions | Commits written immediately to disk |
|
|
578
|
-
| MongoDB | WiredTiger journaling | Writes journaled before acknowledged |
|
|
579
|
-
| Redis | RDB snapshots (periodic) | May lose ~60 seconds on unexpected crash |
|
|
580
|
-
| Valkey | RDB snapshots (periodic) | May lose ~60 seconds on unexpected crash |
|
|
581
|
-
| ClickHouse | MergeTree storage | Committed transactions survive crashes |
|
|
582
|
-
| CockroachDB | Raft consensus | Strongly consistent, distributed replication |
|
|
583
|
-
| QuestDB | Write-ahead logging | Committed transactions survive crashes |
|
|
584
|
-
| TypeDB | Write-ahead logging | Committed transactions survive crashes |
|
|
585
|
-
|
|
586
|
-
---
|
|
587
|
-
|
|
588
|
-
## Engine-Specific Details
|
|
589
|
-
|
|
590
|
-
### PostgreSQL 🐘
|
|
591
|
-
|
|
592
|
-
```bash
|
|
593
|
-
# Create PostgreSQL database
|
|
594
|
-
spindb create myapp --engine postgresql --db-version 18
|
|
595
|
-
|
|
596
|
-
# Multiple versions side-by-side
|
|
597
|
-
spindb create legacy --engine postgresql --db-version 14
|
|
598
|
-
spindb create modern --engine postgresql --db-version 18
|
|
599
|
-
|
|
600
|
-
# Backup formats
|
|
601
|
-
spindb backup myapp --format sql # Plain SQL (.sql)
|
|
602
|
-
spindb backup myapp --format custom # Binary custom format (.dump)
|
|
603
|
-
```
|
|
604
|
-
|
|
605
|
-
**Versions:** 15, 16, 17, 18
|
|
606
|
-
**Tools:** `psql`, `pg_dump`, `pg_restore` (included)
|
|
607
|
-
**Enhanced client:** `pgcli` (auto-completion, syntax highlighting)
|
|
608
|
-
|
|
609
|
-
### MySQL 🐬 & MariaDB 🦭
|
|
610
|
-
|
|
611
|
-
```bash
|
|
612
|
-
# MySQL
|
|
613
|
-
spindb create shop --engine mysql --db-version 9
|
|
614
|
-
spindb connect shop --mycli
|
|
615
|
-
|
|
616
|
-
# MariaDB (MySQL-compatible)
|
|
617
|
-
spindb create store --engine mariadb --db-version 11.8
|
|
618
|
-
```
|
|
619
|
-
|
|
620
|
-
**MySQL versions:** 8.0, 8.4, 9
|
|
621
|
-
**MariaDB versions:** 10.11, 11.4, 11.8
|
|
622
|
-
**Tools:** `mysql`, `mysqldump`, `mysqladmin` (included)
|
|
623
|
-
|
|
624
|
-
### MongoDB 🍃
|
|
625
|
-
|
|
626
|
-
```bash
|
|
627
|
-
# Create MongoDB database
|
|
628
|
-
spindb create logs --engine mongodb --db-version 8.0
|
|
629
|
-
|
|
630
|
-
# JavaScript queries (not SQL)
|
|
631
|
-
spindb run logs -c "db.users.insertOne({name: 'Alice'})"
|
|
632
|
-
spindb run logs -c "db.users.find().pretty()"
|
|
633
|
-
spindb run logs seed.js
|
|
634
|
-
|
|
635
|
-
# Connect with mongosh
|
|
636
|
-
spindb connect logs
|
|
637
|
-
```
|
|
638
|
-
|
|
639
|
-
**Versions:** 7.0, 8.0, 8.2
|
|
640
|
-
**Query language:** JavaScript (via `mongosh`)
|
|
641
|
-
**Tools:** `mongod`, `mongosh`, `mongodump`, `mongorestore` (included)
|
|
642
|
-
|
|
643
|
-
### FerretDB 🦔
|
|
644
|
-
|
|
645
|
-
```bash
|
|
646
|
-
# Create FerretDB database (MongoDB-compatible, PostgreSQL backend)
|
|
647
|
-
spindb create docs --engine ferretdb
|
|
648
|
-
|
|
649
|
-
# Same MongoDB queries work
|
|
650
|
-
spindb run docs -c "db.users.insertOne({name: 'Alice'})"
|
|
651
|
-
spindb run docs -c "db.users.find().pretty()"
|
|
244
|
+
Databases run as **native processes**, and **data persists across restarts**. Your data is never deleted unless you explicitly run `spindb delete`.
|
|
652
245
|
|
|
653
|
-
|
|
654
|
-
spindb connect docs
|
|
655
|
-
```
|
|
656
|
-
|
|
657
|
-
**Version:** 2 (2.7.0)
|
|
658
|
-
**Platforms:** macOS, Linux (no Windows support)
|
|
659
|
-
**Architecture:** FerretDB proxy + PostgreSQL with DocumentDB extension
|
|
660
|
-
**Query language:** JavaScript (via `mongosh`)
|
|
661
|
-
**Backups:** Uses `pg_dump` on embedded PostgreSQL backend
|
|
662
|
-
**Tools:** `ferretdb`, `mongosh` (for client connections), `pg_dump`/`pg_restore` (bundled with embedded PostgreSQL)
|
|
663
|
-
|
|
664
|
-
FerretDB is a MongoDB-compatible database that stores data in PostgreSQL. It's useful when you want MongoDB's API but PostgreSQL's reliability and SQL access to your data.
|
|
665
|
-
|
|
666
|
-
### Redis 🔴 & Valkey 🔷
|
|
667
|
-
|
|
668
|
-
```bash
|
|
669
|
-
# Redis
|
|
670
|
-
spindb create cache --engine redis --db-version 8
|
|
671
|
-
|
|
672
|
-
# Valkey (Redis fork with BSD-3 license)
|
|
673
|
-
spindb create sessions --engine valkey --db-version 9
|
|
674
|
-
|
|
675
|
-
# Redis commands
|
|
676
|
-
spindb run cache -c "SET mykey myvalue"
|
|
677
|
-
spindb run cache -c "GET mykey"
|
|
678
|
-
|
|
679
|
-
# Enhanced shell
|
|
680
|
-
spindb connect cache --iredis
|
|
681
|
-
```
|
|
682
|
-
|
|
683
|
-
**Redis versions:** 7, 8
|
|
684
|
-
**Valkey versions:** 8, 9
|
|
685
|
-
**Query language:** Redis commands
|
|
686
|
-
**Databases:** Numbered 0-15 (not named)
|
|
687
|
-
**Tools:** `redis-cli`, `redis-server` / `valkey-cli`, `valkey-server` (included)
|
|
688
|
-
|
|
689
|
-
### SQLite 🪶 & DuckDB 🦆
|
|
690
|
-
|
|
691
|
-
```bash
|
|
692
|
-
# SQLite - embedded relational database
|
|
693
|
-
spindb create app --engine sqlite --path ./data/app.sqlite
|
|
694
|
-
spindb connect app
|
|
695
|
-
|
|
696
|
-
# DuckDB - embedded analytics database (OLAP)
|
|
697
|
-
spindb create analytics --engine duckdb --path ./data/warehouse.duckdb
|
|
698
|
-
spindb connect analytics
|
|
699
|
-
```
|
|
700
|
-
|
|
701
|
-
**No server process** - File-based databases stored in your project directories.
|
|
702
|
-
**No start/stop needed** - Always "running" (embedded).
|
|
703
|
-
**SQLite tools:** `sqlite3`, `sqldiff`, `sqlite3_analyzer` (included)
|
|
704
|
-
**DuckDB tools:** `duckdb` (included)
|
|
705
|
-
|
|
706
|
-
### ClickHouse 🏠
|
|
707
|
-
|
|
708
|
-
```bash
|
|
709
|
-
# Create ClickHouse database (columnar OLAP)
|
|
710
|
-
spindb create warehouse --engine clickhouse
|
|
711
|
-
|
|
712
|
-
# SQL with ClickHouse extensions
|
|
713
|
-
spindb run warehouse -c "CREATE TABLE events (timestamp DateTime, user_id UInt64) ENGINE = MergeTree() ORDER BY timestamp"
|
|
714
|
-
spindb run warehouse -c "SELECT * FROM system.tables"
|
|
715
|
-
```
|
|
716
|
-
|
|
717
|
-
**Version:** 25.12 (YY.MM versioning)
|
|
718
|
-
**Platforms:** macOS, Linux (no Windows support)
|
|
719
|
-
**Ports:** 9000 (native TCP), 8123 (HTTP)
|
|
720
|
-
**Tools:** `clickhouse-client`, `clickhouse-server` (included)
|
|
721
|
-
|
|
722
|
-
### Qdrant 🧭
|
|
723
|
-
|
|
724
|
-
```bash
|
|
725
|
-
# Create Qdrant database (vector similarity search)
|
|
726
|
-
spindb create vectors --engine qdrant
|
|
727
|
-
spindb start vectors
|
|
728
|
-
|
|
729
|
-
# Access via REST API
|
|
730
|
-
curl http://127.0.0.1:6333/collections
|
|
731
|
-
```
|
|
732
|
-
|
|
733
|
-
**Version:** 1 (1.16.3)
|
|
734
|
-
**Platforms:** macOS, Linux, Windows (all platforms)
|
|
735
|
-
**Ports:** 6333 (REST/HTTP), 6334 (gRPC)
|
|
736
|
-
**Query interface:** REST API (no CLI shell - use curl or API clients)
|
|
737
|
-
**Tools:** `qdrant` (included)
|
|
246
|
+
### Export to Docker
|
|
738
247
|
|
|
739
|
-
|
|
248
|
+
SpinDB doesn't require Docker for local development, but it can repackage your database as a Docker image for deployment:
|
|
740
249
|
|
|
741
250
|
```bash
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
spindb start cluster
|
|
745
|
-
|
|
746
|
-
# PostgreSQL-compatible SQL
|
|
747
|
-
spindb run cluster -c "CREATE TABLE users (id INT PRIMARY KEY, name STRING)"
|
|
748
|
-
spindb run cluster -c "SELECT * FROM users"
|
|
749
|
-
|
|
750
|
-
# Connect with cockroach sql shell
|
|
751
|
-
spindb connect cluster
|
|
251
|
+
spindb export docker mydb -o ./deploy
|
|
252
|
+
cd ./deploy && docker compose build --no-cache && docker compose up -d
|
|
752
253
|
```
|
|
753
254
|
|
|
754
|
-
|
|
755
|
-
**Platforms:** macOS, Linux, Windows (all platforms)
|
|
756
|
-
**Ports:** 26257 (SQL), HTTP Admin UI on SQL port + 1 (default 26258)
|
|
757
|
-
**Query language:** SQL (PostgreSQL-compatible)
|
|
758
|
-
**Tools:** `cockroach` (included)
|
|
759
|
-
**Default user:** `root`
|
|
760
|
-
**Default database:** `defaultdb`
|
|
761
|
-
|
|
762
|
-
CockroachDB is a distributed SQL database with automatic replication and failover. Single-node mode is used for local development.
|
|
255
|
+
See [DEPLOY.md](DEPLOY.md) for comprehensive deployment documentation.
|
|
763
256
|
|
|
764
257
|
---
|
|
765
258
|
|
|
766
|
-
##
|
|
767
|
-
|
|
768
|
-
SpinDB supports enhanced database shells with auto-completion, syntax highlighting, and better formatting:
|
|
769
|
-
|
|
770
|
-
| Engine | Standard Client | Enhanced Client | Universal Client |
|
|
771
|
-
|--------|----------------|-----------------|------------------|
|
|
772
|
-
| PostgreSQL | `psql` | `pgcli` | `usql` |
|
|
773
|
-
| MySQL | `mysql` | `mycli` | `usql` |
|
|
774
|
-
| MariaDB | `mariadb` | `mycli` | `usql` |
|
|
775
|
-
| SQLite | `sqlite3` | `litecli` | `usql` |
|
|
776
|
-
| DuckDB | `duckdb` | - | `usql` |
|
|
777
|
-
| MongoDB | `mongosh` | - | - |
|
|
778
|
-
| FerretDB | `mongosh` | - | - |
|
|
779
|
-
| Redis | `redis-cli` | `iredis` | - |
|
|
780
|
-
| Valkey | `valkey-cli` | `iredis` (compatible) | - |
|
|
781
|
-
| ClickHouse | `clickhouse-client` | - | `usql` |
|
|
782
|
-
| Qdrant | REST API | - | - |
|
|
783
|
-
| Meilisearch | REST API | - | - |
|
|
784
|
-
| CouchDB | REST API | - | - |
|
|
785
|
-
| CockroachDB | `cockroach sql` | - | - |
|
|
786
|
-
| QuestDB | `psql` | `pgcli` | `usql` |
|
|
787
|
-
| TypeDB | `typedb console` | - | - |
|
|
788
|
-
|
|
789
|
-
Install and use in one command:
|
|
259
|
+
## Limitations
|
|
790
260
|
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
```
|
|
261
|
+
- **Local only** - Databases bind to `127.0.0.1`. Remote connection support planned for v1.1.
|
|
262
|
+
- **ClickHouse Windows** - Not supported (hostdb doesn't build for Windows).
|
|
263
|
+
- **FerretDB Windows** - Not supported (postgresql-documentdb has startup issues on Windows).
|
|
264
|
+
- **Qdrant, Meilisearch, CouchDB & InfluxDB** - Use REST API instead of CLI shell. Access via HTTP at the configured port.
|
|
796
265
|
|
|
797
266
|
---
|
|
798
267
|
|
|
799
|
-
##
|
|
800
|
-
|
|
801
|
-
Every engine supports backup and restore with engine-specific formats:
|
|
802
|
-
|
|
803
|
-
### PostgreSQL
|
|
804
|
-
|
|
805
|
-
| Format | Extension | Tool | Use Case |
|
|
806
|
-
|--------|-----------|------|----------|
|
|
807
|
-
| sql | `.sql` | pg_dump | Human-readable, portable |
|
|
808
|
-
| custom | `.dump` | pg_dump -Fc | Compressed, faster restore |
|
|
809
|
-
|
|
810
|
-
```bash
|
|
811
|
-
spindb backup mydb --format sql # Plain SQL
|
|
812
|
-
spindb backup mydb --format custom # Binary custom format
|
|
813
|
-
spindb restore mydb backup.dump
|
|
814
|
-
```
|
|
815
|
-
|
|
816
|
-
### MySQL & MariaDB
|
|
817
|
-
|
|
818
|
-
| Format | Extension | Tool | Use Case |
|
|
819
|
-
|--------|-----------|------|----------|
|
|
820
|
-
| sql | `.sql` | mysqldump / mariadb-dump | Human-readable |
|
|
821
|
-
| compressed | `.sql.gz` | mysqldump + gzip | Smaller file size |
|
|
822
|
-
|
|
823
|
-
```bash
|
|
824
|
-
spindb backup mydb --format sql # Plain SQL
|
|
825
|
-
spindb backup mydb --format compressed # Compressed SQL
|
|
826
|
-
```
|
|
827
|
-
|
|
828
|
-
### MongoDB
|
|
829
|
-
|
|
830
|
-
| Format | Extension | Tool | Use Case |
|
|
831
|
-
|--------|-----------|------|----------|
|
|
832
|
-
| bson | _(directory)_ | mongodump | Binary, preserves all types |
|
|
833
|
-
| archive | `.archive` | mongodump --archive | Single compressed file |
|
|
834
|
-
|
|
835
|
-
```bash
|
|
836
|
-
spindb backup mydb --format bson # BSON directory
|
|
837
|
-
spindb backup mydb --format archive # Single .archive file
|
|
838
|
-
```
|
|
839
|
-
|
|
840
|
-
### Redis & Valkey
|
|
841
|
-
|
|
842
|
-
| Format | Extension | Tool | Use Case |
|
|
843
|
-
|--------|-----------|------|----------|
|
|
844
|
-
| rdb | `.rdb` | BGSAVE | Binary snapshot, requires stop/start |
|
|
845
|
-
| text | `.redis` / `.valkey` | Custom | Human-readable commands |
|
|
846
|
-
|
|
847
|
-
```bash
|
|
848
|
-
spindb backup mydb --format rdb # RDB snapshot (default)
|
|
849
|
-
spindb backup mydb --format text # Text commands
|
|
850
|
-
|
|
851
|
-
# Restore with merge or replace strategy
|
|
852
|
-
spindb restore mydb backup.redis # Prompts: Replace all / Merge
|
|
853
|
-
```
|
|
854
|
-
|
|
855
|
-
### SQLite & DuckDB
|
|
856
|
-
|
|
857
|
-
| Format | Extension | Tool | Use Case |
|
|
858
|
-
|--------|-----------|------|----------|
|
|
859
|
-
| sql | `.sql` | .dump / duckdb | Human-readable |
|
|
860
|
-
| binary | `.sqlite` / `.duckdb` | File copy | Exact database copy |
|
|
861
|
-
|
|
862
|
-
```bash
|
|
863
|
-
spindb backup mydb --format sql # SQL dump
|
|
864
|
-
spindb backup mydb --format binary # Binary copy (default)
|
|
865
|
-
```
|
|
866
|
-
|
|
867
|
-
### ClickHouse
|
|
868
|
-
|
|
869
|
-
| Format | Extension | Tool | Use Case |
|
|
870
|
-
|--------|-----------|------|----------|
|
|
871
|
-
| sql | `.sql` | clickhouse-client | Plain SQL dump |
|
|
872
|
-
|
|
873
|
-
```bash
|
|
874
|
-
spindb backup mydb --format sql # SQL dump (only format)
|
|
875
|
-
```
|
|
876
|
-
|
|
877
|
-
### Qdrant
|
|
878
|
-
|
|
879
|
-
| Format | Extension | Tool | Use Case |
|
|
880
|
-
|--------|-----------|------|----------|
|
|
881
|
-
| snapshot | `.snapshot` | REST API | Full database snapshot |
|
|
882
|
-
|
|
883
|
-
```bash
|
|
884
|
-
spindb backup mydb --format snapshot # Snapshot (only format)
|
|
885
|
-
```
|
|
886
|
-
|
|
887
|
-
### Meilisearch
|
|
888
|
-
|
|
889
|
-
| Format | Extension | Tool | Use Case |
|
|
890
|
-
|--------|-----------|------|----------|
|
|
891
|
-
| snapshot | `.snapshot` | REST API | Full instance snapshot |
|
|
892
|
-
|
|
893
|
-
```bash
|
|
894
|
-
spindb backup mydb --format snapshot # Snapshot (only format)
|
|
895
|
-
```
|
|
896
|
-
|
|
897
|
-
### CockroachDB
|
|
898
|
-
|
|
899
|
-
| Format | Extension | Tool | Use Case |
|
|
900
|
-
|--------|-----------|------|----------|
|
|
901
|
-
| sql | `.sql` | cockroach dump | Plain SQL dump |
|
|
902
|
-
|
|
903
|
-
```bash
|
|
904
|
-
spindb backup mydb --format sql # SQL dump (only format)
|
|
905
|
-
```
|
|
906
|
-
|
|
907
|
-
### QuestDB
|
|
908
|
-
|
|
909
|
-
| Format | Extension | Tool | Use Case |
|
|
910
|
-
|--------|-----------|------|----------|
|
|
911
|
-
| sql | `.sql` | psql (PostgreSQL wire protocol) | Plain SQL dump |
|
|
912
|
-
|
|
913
|
-
```bash
|
|
914
|
-
spindb backup mydb --format sql # SQL dump (only format)
|
|
915
|
-
```
|
|
916
|
-
|
|
917
|
-
> **Note:** QuestDB backup/restore requires the PostgreSQL engine to be installed (for `psql`).
|
|
918
|
-
|
|
919
|
-
### TypeDB
|
|
268
|
+
## Troubleshooting
|
|
920
269
|
|
|
921
|
-
|
|
922
|
-
|--------|-----------|------|----------|
|
|
923
|
-
| typeql | `.typeql` | typedb console | TypeQL schema + data export |
|
|
270
|
+
### Port Already in Use
|
|
924
271
|
|
|
925
272
|
```bash
|
|
926
|
-
spindb
|
|
273
|
+
spindb create mydb --port 5433
|
|
927
274
|
```
|
|
928
275
|
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
## Advanced Features
|
|
932
|
-
|
|
933
|
-
### Clone Databases
|
|
934
|
-
|
|
935
|
-
Create exact copies of existing databases:
|
|
276
|
+
### Container Won't Start
|
|
936
277
|
|
|
937
278
|
```bash
|
|
938
|
-
|
|
939
|
-
spindb stop production
|
|
940
|
-
spindb clone production staging
|
|
941
|
-
spindb start production
|
|
942
|
-
spindb start staging
|
|
279
|
+
spindb logs mydb
|
|
943
280
|
```
|
|
944
281
|
|
|
945
|
-
###
|
|
946
|
-
|
|
947
|
-
Pull production data into local databases. **All engines support remote restore via connection strings:**
|
|
282
|
+
### Client Tool Not Found
|
|
948
283
|
|
|
949
284
|
```bash
|
|
950
|
-
|
|
951
|
-
spindb
|
|
952
|
-
|
|
953
|
-
# Or restore into existing database
|
|
954
|
-
spindb restore mydb --from-url "postgresql://user:pass@prod-host:5432/production"
|
|
285
|
+
spindb deps install
|
|
286
|
+
spindb deps check
|
|
955
287
|
```
|
|
956
288
|
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
| Engine | Format | Example |
|
|
960
|
-
|--------|--------|---------|
|
|
961
|
-
| PostgreSQL | `postgresql://` or `postgres://` | `postgresql://user:pass@host:5432/db` |
|
|
962
|
-
| MySQL | `mysql://` | `mysql://root:pass@host:3306/db` |
|
|
963
|
-
| MariaDB | `mysql://` or `mariadb://` | `mariadb://root:pass@host:3307/db` |
|
|
964
|
-
| MongoDB | `mongodb://` or `mongodb+srv://` | `mongodb://user:pass@host:27017/db` |
|
|
965
|
-
| Redis | `redis://` | `redis://:password@host:6379/0` |
|
|
966
|
-
| Valkey | `redis://` | `redis://:password@host:6379/0` |
|
|
967
|
-
| ClickHouse | `clickhouse://` or `http://` | `clickhouse://default:pass@host:8123/db` |
|
|
968
|
-
| Qdrant | `qdrant://` or `http://` | `http://host:6333?api_key=KEY` |
|
|
969
|
-
| Meilisearch | `meilisearch://` or `http://` | `http://host:7700?api_key=KEY` |
|
|
970
|
-
| CouchDB | `couchdb://` or `http://` | `http://user:pass@host:5984/db` |
|
|
971
|
-
| CockroachDB | `postgresql://` or `postgres://` | `postgresql://root@host:26257/db?sslmode=disable` |
|
|
972
|
-
| QuestDB | `postgresql://` or `postgres://` | `postgresql://admin:quest@host:8812/qdb` |
|
|
973
|
-
| TypeDB | `typedb://` | `typedb://host:1729` |
|
|
974
|
-
|
|
975
|
-
### Multi-Version Support
|
|
976
|
-
|
|
977
|
-
Run different versions of the same database simultaneously:
|
|
289
|
+
### Health Check
|
|
978
290
|
|
|
979
291
|
```bash
|
|
980
|
-
#
|
|
981
|
-
spindb
|
|
982
|
-
|
|
983
|
-
# PostgreSQL 18 for new app
|
|
984
|
-
spindb create modern-api --engine postgresql --db-version 18 --port 5433
|
|
985
|
-
|
|
986
|
-
# Both running at the same time
|
|
987
|
-
spindb list
|
|
988
|
-
# NAME ENGINE VERSION PORT STATUS
|
|
989
|
-
# legacy-api postgresql 14 5432 running
|
|
990
|
-
# modern-api postgresql 18 5433 running
|
|
292
|
+
spindb doctor # Interactive health check
|
|
293
|
+
spindb doctor --fix # Auto-fix all issues
|
|
991
294
|
```
|
|
992
295
|
|
|
993
|
-
###
|
|
994
|
-
|
|
995
|
-
SpinDB auto-assigns ports, but you can override:
|
|
296
|
+
### Reset Everything
|
|
996
297
|
|
|
997
298
|
```bash
|
|
998
|
-
|
|
999
|
-
spindb edit mydb --port 5434 # Change later
|
|
299
|
+
rm -rf ~/.spindb
|
|
1000
300
|
```
|
|
1001
301
|
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
File-based databases can be registered for easy access:
|
|
1005
|
-
|
|
1006
|
-
```bash
|
|
1007
|
-
# Create and register
|
|
1008
|
-
spindb create mydb --engine sqlite --path ./data/app.sqlite
|
|
1009
|
-
|
|
1010
|
-
# Attach existing database
|
|
1011
|
-
spindb attach ./existing/data.sqlite --name legacy-db
|
|
1012
|
-
|
|
1013
|
-
# Detach (removes from registry, keeps file)
|
|
1014
|
-
spindb detach legacy-db
|
|
1015
|
-
```
|
|
302
|
+
This deletes all containers, binaries, and configuration. Use with caution.
|
|
1016
303
|
|
|
1017
304
|
---
|
|
1018
305
|
|
|
1019
306
|
## Roadmap
|
|
1020
307
|
|
|
1021
|
-
See [TODO.md](TODO.md) for the complete roadmap.
|
|
1022
|
-
|
|
1023
|
-
### v1.1 - Remote Connections & Secrets
|
|
1024
|
-
- Direct remote database connections (`spindb connect --remote`)
|
|
1025
|
-
- Environment variable support in connection strings
|
|
1026
|
-
- Secrets management with macOS Keychain integration
|
|
1027
|
-
|
|
1028
|
-
### v1.2 - Advanced Features
|
|
1029
|
-
- Container templates for common configurations
|
|
1030
|
-
- Scheduled automated backups
|
|
1031
|
-
- Import databases from Docker containers
|
|
1032
|
-
|
|
1033
|
-
### Future Engines Under Consideration
|
|
1034
|
-
|
|
1035
|
-
The following engines may be added based on community interest:
|
|
1036
|
-
|
|
1037
|
-
| Engine | Type | Notes |
|
|
1038
|
-
|--------|------|-------|
|
|
1039
|
-
| **libSQL** | Embedded relational | SQLite fork with replication |
|
|
1040
|
-
| **OpenSearch** | Search engine | Elasticsearch alternative |
|
|
1041
|
-
| **InfluxDB** | Time-series | Metrics and IoT data |
|
|
1042
|
-
| **Neo4j** | Graph database | Relationships and network data |
|
|
1043
|
-
|
|
1044
|
-
---
|
|
1045
|
-
|
|
1046
|
-
## Limitations
|
|
1047
|
-
|
|
1048
|
-
- **Local only** - Databases bind to `127.0.0.1`. Remote connection support planned for v1.1.
|
|
1049
|
-
- **ClickHouse Windows** - Not supported (hostdb doesn't build for Windows).
|
|
1050
|
-
- **FerretDB Windows** - Not supported (postgresql-documentdb has startup issues on Windows).
|
|
1051
|
-
- **Qdrant, Meilisearch & CouchDB** - Use REST API instead of CLI shell. Access via HTTP at the configured port.
|
|
308
|
+
See [TODO.md](TODO.md) for the complete roadmap and future plans.
|
|
1052
309
|
|
|
1053
310
|
---
|
|
1054
311
|
|
|
1055
|
-
##
|
|
312
|
+
## Use Cases
|
|
1056
313
|
|
|
1057
|
-
###
|
|
314
|
+
### Migration & Portability
|
|
1058
315
|
|
|
1059
|
-
SpinDB
|
|
316
|
+
- **Cloud Migration Pipeline** - Create a SpinDB container, restore from an existing database, export to Docker, deploy to any cloud provider
|
|
317
|
+
- **Cross-Platform Migration** - Move databases between ARM Mac, x64 Linux, Windows, and Apple Silicon transparently via backup/restore
|
|
318
|
+
- **MongoDB to FerretDB** - Test MongoDB-to-FerretDB migration locally before infrastructure changes
|
|
1060
319
|
|
|
1061
|
-
|
|
1062
|
-
spindb create mydb --port 5433
|
|
1063
|
-
```
|
|
320
|
+
### Development Workflow
|
|
1064
321
|
|
|
1065
|
-
|
|
322
|
+
- **Multiple Database Versions** - Run PostgreSQL 14 and 18 side-by-side for compatibility testing
|
|
323
|
+
- **Git-Triggered Database Branching** - Use git hooks to clone database state per branch
|
|
324
|
+
- **Environment Synchronization** - Pull production data locally for realistic development
|
|
325
|
+
- **Rapid Prototyping** - Spin up PostgreSQL, MongoDB, and Redis in minutes, compare patterns, delete without cleanup
|
|
1066
326
|
|
|
1067
|
-
|
|
327
|
+
### Testing & CI/CD
|
|
1068
328
|
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
cat ~/.spindb/containers/postgresql/mydb/postgres.log
|
|
1073
|
-
```
|
|
329
|
+
- **Ephemeral Test Databases** - Fresh database instances for each test run with automatic teardown
|
|
330
|
+
- **Schema Migration Testing** - Clone production, run migrations, validate, iterate without risk
|
|
331
|
+
- **Data Validation** - Use DuckDB or PostgreSQL to validate data pipelines with aggregate queries
|
|
1074
332
|
|
|
1075
|
-
###
|
|
333
|
+
### Platform Gaps
|
|
1076
334
|
|
|
1077
|
-
|
|
335
|
+
- **Redis/Valkey on Windows** - No official Windows builds exist; SpinDB provides them
|
|
336
|
+
- **ClickHouse on macOS** - No Homebrew complexity
|
|
337
|
+
- **FerretDB anywhere** - MongoDB-compatible without Docker
|
|
1078
338
|
|
|
1079
|
-
|
|
1080
|
-
spindb deps install
|
|
1081
|
-
spindb deps check
|
|
1082
|
-
```
|
|
339
|
+
### Embedding & Integration
|
|
1083
340
|
|
|
1084
|
-
|
|
341
|
+
- **LLM Agent Integration** - Connect AI agents to databases via CLI with JSON output mode
|
|
342
|
+
- **AI Tool Embedding** - Qdrant for vector search, DuckDB for analytics, SQLite for conversation history
|
|
343
|
+
- **Desktop Applications** - Ship relocatable database binaries inside apps
|
|
1085
344
|
|
|
1086
|
-
|
|
345
|
+
### Deployment
|
|
1087
346
|
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
347
|
+
- **Local-to-Cloud** - Export to Docker image, push to registry, deploy to any container platform
|
|
348
|
+
- **Production Data Anonymization** - Clone production, anonymize, develop safely
|
|
349
|
+
- **Disaster Recovery Practice** - Practice restore workflows without production risk
|
|
1091
350
|
|
|
1092
|
-
###
|
|
351
|
+
### Infrastructure
|
|
1093
352
|
|
|
1094
|
-
|
|
1095
|
-
rm -rf ~/.spindb
|
|
1096
|
-
```
|
|
353
|
+
SpinDB can serve as the database layer for larger systems:
|
|
1097
354
|
|
|
1098
|
-
|
|
355
|
+
- **Backend-as-a-Service** - A database-agnostic Neon/Supabase-style platform using SpinDB primitives (`create`, `clone`, `backup`, `restore`)
|
|
356
|
+
- **Desktop GUI** - A cross-platform database management app (Tauri/Electron) wrapping SpinDB
|
|
357
|
+
- **Team Environments** - Export/import container configurations for consistent team setups
|
|
1099
358
|
|
|
1100
359
|
---
|
|
1101
360
|
|
|
@@ -1109,7 +368,7 @@ We welcome contributions! SpinDB is built with:
|
|
|
1109
368
|
- **CLI Framework:** Commander.js
|
|
1110
369
|
- **Interactive UI:** Inquirer.js, Chalk, Ora
|
|
1111
370
|
|
|
1112
|
-
See [
|
|
371
|
+
See [TODO.md](TODO.md#contributing) for development setup, PR requirements, and testing guidelines.
|
|
1113
372
|
|
|
1114
373
|
See [ARCHITECTURE.md](ARCHITECTURE.md) for project architecture details.
|
|
1115
374
|
|
|
@@ -1117,15 +376,13 @@ See [CLAUDE.md](CLAUDE.md) for AI-assisted development context.
|
|
|
1117
376
|
|
|
1118
377
|
See [ENGINE_CHECKLIST.md](ENGINE_CHECKLIST.md) for adding new database engines.
|
|
1119
378
|
|
|
1120
|
-
See [USE_CASES.md](USE_CASES.md) for detailed use cases and infrastructure opportunities.
|
|
1121
|
-
|
|
1122
379
|
---
|
|
1123
380
|
|
|
1124
381
|
## Acknowledgments
|
|
1125
382
|
|
|
1126
383
|
SpinDB is powered by:
|
|
1127
384
|
|
|
1128
|
-
- **[hostdb](https://github.com/robertjbass/hostdb)** - Pre-compiled database binaries for
|
|
385
|
+
- **[hostdb](https://github.com/robertjbass/hostdb)** - Pre-compiled database binaries for 18 engines across all major platforms. Makes Docker-free multi-version database support possible.
|
|
1129
386
|
|
|
1130
387
|
---
|
|
1131
388
|
|