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