spindb 0.19.2 → 0.19.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +540 -902
- package/engines/clickhouse/binary-urls.ts +12 -2
- package/engines/sqlite/binary-manager.ts +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,1200 +3,821 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/spindb)
|
|
4
4
|
[](https://www.npmjs.com/package/spindb)
|
|
5
5
|
[](LICENSE)
|
|
6
|
-
[](#platform-
|
|
6
|
+
[](#platform-coverage)
|
|
7
7
|
|
|
8
|
-
**
|
|
8
|
+
**One CLI for all your local databases.**
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
## Quick Start
|
|
10
|
+
SpinDB is a universal database management tool that combines a package manager, a unified API, and native client tooling for 9 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.
|
|
15
11
|
|
|
16
12
|
```bash
|
|
17
|
-
# Install globally (or use pnpm/yarn)
|
|
18
13
|
npm install -g spindb
|
|
19
14
|
|
|
20
|
-
#
|
|
21
|
-
spindb create
|
|
15
|
+
# PostgreSQL for your API
|
|
16
|
+
spindb create api-db
|
|
22
17
|
|
|
23
|
-
#
|
|
24
|
-
spindb
|
|
25
|
-
|
|
26
|
-
# You're in! Run some SQL:
|
|
27
|
-
# postgres=# CREATE TABLE users (id SERIAL PRIMARY KEY, name TEXT);
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
That's it. Your database is running on `localhost:5432`, and your data persists in `~/.spindb/containers/postgresql/myapp/`.
|
|
31
|
-
|
|
32
|
-
---
|
|
33
|
-
|
|
34
|
-
## Why SpinDB?
|
|
35
|
-
|
|
36
|
-
Docker is great for production parity and complex multi-service setups. But for local development databases, it's often overkill:
|
|
37
|
-
|
|
38
|
-
- **Resource overhead** - Docker Desktop runs a Linux VM on macOS/Windows
|
|
39
|
-
- **Complexity** - Volumes, networks, compose files for a single database
|
|
40
|
-
- **Startup time** - Container initialization vs native process launch
|
|
41
|
-
- **Licensing** - Docker Desktop requires a paid subscription for larger organizations
|
|
42
|
-
|
|
43
|
-
Sometimes you just want PostgreSQL on `localhost:5432` without the ceremony.
|
|
44
|
-
|
|
45
|
-
SpinDB runs databases as native processes with isolated data directories. No VM, no daemon, no container networking. Just databases.
|
|
46
|
-
|
|
47
|
-
### SpinDB vs Alternatives
|
|
48
|
-
|
|
49
|
-
| Feature | SpinDB | Docker | DBngin | Postgres.app | XAMPP |
|
|
50
|
-
|---------|--------|--------|--------|--------------|-------|
|
|
51
|
-
| No Docker required | ✅ | ❌ | ✅ | ✅ | ✅ |
|
|
52
|
-
| Multiple DB engines | ✅ | ✅ | ✅ | ❌ | ⚠️ MySQL only |
|
|
53
|
-
| CLI-first | ✅ | ✅ | ❌ | ❌ | ❌ |
|
|
54
|
-
| Multiple versions | ✅ | ✅ | ✅ | ✅ | ❌ |
|
|
55
|
-
| Clone databases | ✅ | Manual | ✅ | ❌ | ❌ |
|
|
56
|
-
| Low resource usage | ✅ | ❌ | ✅ | ✅ | ✅ |
|
|
57
|
-
| Linux support | ✅ | ✅ | ❌ | ❌ | ✅ |
|
|
58
|
-
| Free | ✅ | ⚠️ | ✅ | ✅ | ✅ |
|
|
18
|
+
# MongoDB for analytics
|
|
19
|
+
spindb create analytics --engine mongodb
|
|
59
20
|
|
|
60
|
-
|
|
21
|
+
# Redis for caching
|
|
22
|
+
spindb create cache --engine redis
|
|
61
23
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
| macOS (ARM64) | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
65
|
-
| macOS (Intel) | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
66
|
-
| Linux (x64) | ✅ | ✅ | ❌ | ❌ | ✅ |
|
|
67
|
-
| Linux (ARM64) | ✅ | ✅ | ❌ | ❌ | ❌ |
|
|
68
|
-
| Windows (x64) | ✅ | ✅ | ❌ | ❌ | ✅ |
|
|
24
|
+
# All running side-by-side, all managed the same way
|
|
25
|
+
```
|
|
69
26
|
|
|
70
27
|
---
|
|
71
28
|
|
|
72
|
-
##
|
|
29
|
+
## What is SpinDB?
|
|
73
30
|
|
|
74
|
-
SpinDB is
|
|
31
|
+
SpinDB is **three tools in one**:
|
|
75
32
|
|
|
76
|
-
|
|
33
|
+
### 1. **Database Package Manager**
|
|
34
|
+
Download and manage multiple database engines and versions—just like `apt`, `brew`, or `npm`, but for databases.
|
|
77
35
|
|
|
78
36
|
```bash
|
|
79
|
-
#
|
|
80
|
-
|
|
37
|
+
# Run PostgreSQL 14 for legacy projects, 18 for new ones
|
|
38
|
+
spindb create old-project --engine postgresql --db-version 14
|
|
39
|
+
spindb create new-project --engine postgresql --db-version 18
|
|
81
40
|
|
|
82
|
-
#
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
# Or run directly without installing
|
|
86
|
-
pnpx spindb
|
|
87
|
-
npx spindb
|
|
41
|
+
# Or MySQL 8.0 alongside MySQL 9
|
|
42
|
+
spindb create legacy-mysql --engine mysql --db-version 8.0
|
|
43
|
+
spindb create modern-mysql --engine mysql --db-version 9
|
|
88
44
|
```
|
|
89
45
|
|
|
90
|
-
###
|
|
91
|
-
|
|
92
|
-
SpinDB checks for updates automatically and notifies you when a new version is available.
|
|
46
|
+
### 2. **Unified Database API**
|
|
47
|
+
One consistent interface across SQL databases, document stores, key-value stores, and analytics engines.
|
|
93
48
|
|
|
94
49
|
```bash
|
|
95
|
-
#
|
|
96
|
-
spindb
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
spindb
|
|
100
|
-
|
|
101
|
-
# Disable automatic update checks
|
|
102
|
-
spindb config update-check off
|
|
50
|
+
# Same commands work for ANY database
|
|
51
|
+
spindb create mydb --engine [postgresql|mysql|mariadb|mongodb|redis|valkey|clickhouse|sqlite|duckdb]
|
|
52
|
+
spindb start mydb
|
|
53
|
+
spindb connect mydb
|
|
54
|
+
spindb backup mydb
|
|
55
|
+
spindb restore mydb backup.dump
|
|
103
56
|
```
|
|
104
57
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
## The Interactive Menu
|
|
108
|
-
|
|
109
|
-
Most of the time, you don't need to remember commands. Just run:
|
|
58
|
+
### 3. **Native Database Client**
|
|
59
|
+
Access built-in shells, run queries, and execute scripts—all without installing separate clients.
|
|
110
60
|
|
|
111
61
|
```bash
|
|
112
|
-
|
|
62
|
+
# Execute SQL/NoSQL/commands across any engine
|
|
63
|
+
spindb run mydb script.sql # PostgreSQL/MySQL/SQLite
|
|
64
|
+
spindb run mydb -c "db.users.find().pretty()" # MongoDB
|
|
65
|
+
spindb run mydb -c "SET mykey myvalue" # Redis/Valkey
|
|
66
|
+
spindb run mydb -c "SELECT * FROM system.tables" # ClickHouse
|
|
113
67
|
```
|
|
114
68
|
|
|
115
|
-
You'll get an interactive menu with arrow-key navigation:
|
|
116
|
-
|
|
117
|
-
```
|
|
118
|
-
? What would you like to do?
|
|
119
|
-
❯ Create a new container
|
|
120
|
-
Manage containers
|
|
121
|
-
View installed engines
|
|
122
|
-
Check dependencies
|
|
123
|
-
Settings
|
|
124
|
-
Exit
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
**Everything in the menu is also available as a CLI command.** The menu is just a friendlier interface for the same operations. If you prefer typing commands or scripting, SpinDB has full CLI support.
|
|
128
|
-
|
|
129
69
|
---
|
|
130
70
|
|
|
131
|
-
##
|
|
132
|
-
|
|
133
|
-
### Supported Engines
|
|
134
|
-
|
|
135
|
-
#### PostgreSQL
|
|
71
|
+
## Platform Coverage
|
|
136
72
|
|
|
137
|
-
|
|
138
|
-
|---|---|
|
|
139
|
-
| Versions | 15, 16, 17, 18 |
|
|
140
|
-
| Default port | 5432 |
|
|
141
|
-
| Default user | `postgres` |
|
|
142
|
-
| Binary source | [hostdb](https://github.com/robertjbass/hostdb) (macOS/Linux), [EDB](https://www.enterprisedb.com/) (Windows) |
|
|
73
|
+
SpinDB works across **9 database engines** and **5 platform architectures** with a **single, consistent API**.
|
|
143
74
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
**
|
|
75
|
+
| Database | macOS ARM64 | macOS Intel | Linux x64 | Linux ARM64 | Windows x64 |
|
|
76
|
+
|----------|:-----------:|:-----------:|:---------:|:-----------:|:-----------:|
|
|
77
|
+
| 🐘 **PostgreSQL** | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
78
|
+
| 🐬 **MySQL** | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
79
|
+
| 🦭 **MariaDB** | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
80
|
+
| 🪶 **SQLite** | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
81
|
+
| 🦆 **DuckDB** | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
82
|
+
| 🍃 **MongoDB** | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
83
|
+
| 🔴 **Redis** | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
84
|
+
| 🔷 **Valkey** | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
85
|
+
| 🏠 **ClickHouse** | ✅ | ✅ | ✅ | ✅ | ❌ |
|
|
86
|
+
|
|
87
|
+
**44 combinations. One CLI. Zero configuration.**
|
|
151
88
|
|
|
152
|
-
|
|
89
|
+
---
|
|
153
90
|
|
|
154
|
-
|
|
155
|
-
|---|---|
|
|
156
|
-
| Versions | 10.11, 11.4, 11.8 |
|
|
157
|
-
| Default port | 3307 |
|
|
158
|
-
| Default user | `root` |
|
|
159
|
-
| Binary source | [hostdb](https://github.com/robertjbass/hostdb) |
|
|
91
|
+
## Quick Start
|
|
160
92
|
|
|
161
|
-
SpinDB
|
|
93
|
+
Install SpinDB globally using your preferred package manager:
|
|
162
94
|
|
|
163
95
|
```bash
|
|
164
|
-
#
|
|
165
|
-
|
|
96
|
+
# Using npm
|
|
97
|
+
npm install -g spindb
|
|
166
98
|
|
|
167
|
-
#
|
|
168
|
-
|
|
99
|
+
# Using pnpm (recommended - faster, more efficient)
|
|
100
|
+
pnpm add -g spindb
|
|
169
101
|
|
|
170
|
-
#
|
|
171
|
-
spindb
|
|
102
|
+
# Or run without installing
|
|
103
|
+
npx spindb
|
|
172
104
|
```
|
|
173
105
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
#### MySQL
|
|
177
|
-
|
|
178
|
-
| | |
|
|
179
|
-
|---|---|
|
|
180
|
-
| Versions | 8.0, 8.4, 9 |
|
|
181
|
-
| Default port | 3306 |
|
|
182
|
-
| Default user | `root` |
|
|
183
|
-
| Binary source | [hostdb](https://github.com/robertjbass/hostdb) |
|
|
184
|
-
|
|
185
|
-
SpinDB downloads MySQL server binaries automatically from [hostdb](https://github.com/robertjbass/hostdb) on GitHub Releases—just like PostgreSQL and MariaDB. This provides multi-version support and works across all platforms.
|
|
106
|
+
Create and start a database in seconds:
|
|
186
107
|
|
|
187
108
|
```bash
|
|
188
|
-
#
|
|
189
|
-
spindb create
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
spindb create mydb --engine mysql --version 8.0
|
|
109
|
+
# PostgreSQL (default engine)
|
|
110
|
+
spindb create myapp
|
|
111
|
+
spindb start myapp
|
|
112
|
+
spindb connect myapp
|
|
193
113
|
|
|
194
|
-
#
|
|
195
|
-
spindb
|
|
114
|
+
# Or all in one command
|
|
115
|
+
spindb create myapp --start --connect
|
|
196
116
|
```
|
|
197
117
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
#### SQLite
|
|
201
|
-
|
|
202
|
-
| | |
|
|
203
|
-
|---|---|
|
|
204
|
-
| Version | 3 |
|
|
205
|
-
| Default port | N/A (file-based) |
|
|
206
|
-
| Data location | Project directory (CWD) |
|
|
207
|
-
| Binary source | [hostdb](https://github.com/robertjbass/hostdb) |
|
|
118
|
+
That's it! Your PostgreSQL database is now running on `localhost:5432`, and data persists in `~/.spindb/containers/postgresql/myapp/`.
|
|
208
119
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
**Tools included:** SQLite binaries include `sqlite3`, `sqldiff`, `sqlite3_analyzer`, and `sqlite3_rsync`. No system installation required.
|
|
120
|
+
### Try Other Engines
|
|
212
121
|
|
|
213
122
|
```bash
|
|
214
|
-
#
|
|
215
|
-
spindb create
|
|
123
|
+
# MySQL for relational data
|
|
124
|
+
spindb create shop --engine mysql --start --connect
|
|
216
125
|
|
|
217
|
-
#
|
|
218
|
-
spindb create
|
|
126
|
+
# MongoDB for document storage
|
|
127
|
+
spindb create logs --engine mongodb --start
|
|
219
128
|
|
|
220
|
-
#
|
|
221
|
-
spindb
|
|
129
|
+
# Redis for caching and real-time features
|
|
130
|
+
spindb create sessions --engine redis --start
|
|
222
131
|
|
|
223
|
-
#
|
|
224
|
-
spindb
|
|
132
|
+
# DuckDB for analytics
|
|
133
|
+
spindb create analytics --engine duckdb --start
|
|
225
134
|
```
|
|
226
135
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
#### DuckDB
|
|
230
|
-
|
|
231
|
-
| | |
|
|
232
|
-
|---|---|
|
|
233
|
-
| Version | 1 |
|
|
234
|
-
| Default port | N/A (file-based) |
|
|
235
|
-
| Data location | Project directory (CWD) |
|
|
236
|
-
| Binary source | [hostdb](https://github.com/robertjbass/hostdb) |
|
|
237
|
-
|
|
238
|
-
DuckDB is an embedded analytical database—file-based like SQLite, but optimized for OLAP workloads and analytics. No server process, no ports. Databases are stored in your project directory by default, not `~/.spindb/`. SpinDB tracks registered DuckDB databases in a registry file.
|
|
239
|
-
|
|
240
|
-
**Tools included:** DuckDB binary `duckdb` for all operations. No system installation required.
|
|
241
|
-
|
|
242
|
-
```bash
|
|
243
|
-
# Create in current directory
|
|
244
|
-
spindb create mydb --engine duckdb
|
|
245
|
-
|
|
246
|
-
# Create with custom path
|
|
247
|
-
spindb create mydb --engine duckdb --path ./data/analytics.duckdb
|
|
248
|
-
|
|
249
|
-
# Connect to it
|
|
250
|
-
spindb connect mydb
|
|
251
|
-
```
|
|
136
|
+
Every engine works the same way. Learn one, use them all.
|
|
252
137
|
|
|
253
|
-
|
|
138
|
+
---
|
|
254
139
|
|
|
255
|
-
|
|
140
|
+
## Why SpinDB?
|
|
256
141
|
|
|
257
|
-
|
|
258
|
-
|---|---|
|
|
259
|
-
| Versions | 7.0, 8.0, 8.2 |
|
|
260
|
-
| Default port | 27017 |
|
|
261
|
-
| Default user | None (no auth by default) |
|
|
262
|
-
| Binary source | [hostdb](https://github.com/robertjbass/hostdb) |
|
|
142
|
+
### The Problem with Current Tools
|
|
263
143
|
|
|
264
|
-
|
|
144
|
+
**Docker** is powerful but heavy—requires a daemon, runs containers in a VM (on macOS/Windows), and adds complexity for simple local databases.
|
|
265
145
|
|
|
266
|
-
|
|
267
|
-
# Create a MongoDB container (downloads binaries automatically)
|
|
268
|
-
spindb create mydb --engine mongodb
|
|
146
|
+
**GUI tools** like DBngin and Postgres.app are great but platform-specific, don't support scripting, and lack a unified interface across engines.
|
|
269
147
|
|
|
270
|
-
|
|
271
|
-
spindb create mydb --engine mongodb --version 8.0
|
|
148
|
+
**System package managers** (brew, apt, etc.) work but create version conflicts, require manual configuration, and don't provide consistent management across databases.
|
|
272
149
|
|
|
273
|
-
|
|
274
|
-
spindb deps check --engine mongodb
|
|
275
|
-
```
|
|
150
|
+
### SpinDB's Approach
|
|
276
151
|
|
|
277
|
-
|
|
152
|
+
SpinDB runs databases as **native processes** with **isolated data directories**:
|
|
278
153
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
154
|
+
- **No Docker daemon or VM overhead** - Direct process execution
|
|
155
|
+
- **No system installation conflicts** - Each database version lives in `~/.spindb/bin/`
|
|
156
|
+
- **No manual configuration** - Databases start with sensible defaults
|
|
157
|
+
- **Cross-platform consistency** - Same commands work on macOS, Linux, and Windows
|
|
158
|
+
- **Multi-version support** - Run PostgreSQL 14 and 18 side-by-side
|
|
159
|
+
- **Unified interface** - Manage PostgreSQL, MongoDB, and Redis the same way
|
|
282
160
|
|
|
283
|
-
|
|
284
|
-
spindb run mydb -c "db.users.find().pretty()"
|
|
161
|
+
### Comparison Matrix
|
|
285
162
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
163
|
+
| Feature | SpinDB | Docker | DBngin | Postgres.app | XAMPP |
|
|
164
|
+
|---------|--------|--------|--------|--------------|-------|
|
|
165
|
+
| No Docker required | ✅ | ❌ | ✅ | ✅ | ✅ |
|
|
166
|
+
| Multiple DB engines | ✅ 9 engines | ✅ Unlimited | ✅ 3 engines | ❌ PostgreSQL only | ⚠️ MySQL only |
|
|
167
|
+
| CLI-first | ✅ | ✅ | ❌ GUI-first | ❌ GUI-first | ❌ GUI-first |
|
|
168
|
+
| Multiple versions | ✅ | ✅ | ✅ | ✅ | ❌ |
|
|
169
|
+
| Clone databases | ✅ | Manual | ✅ | ❌ | ❌ |
|
|
170
|
+
| Backup/restore built-in | ✅ | Manual | ✅ | ❌ | ❌ |
|
|
171
|
+
| Low resource usage | ✅ Native | ❌ VM on macOS/Win | ✅ Native | ✅ Native | ✅ Native |
|
|
172
|
+
| Linux support | ✅ | ✅ | ❌ | ❌ | ✅ |
|
|
173
|
+
| ARM64 support | ✅ | ✅ | ✅ | ✅ | ❌ |
|
|
174
|
+
| Free for commercial use | ❌ | ⚠️ Paid for orgs | ✅ | ✅ | ✅ |
|
|
289
175
|
|
|
290
|
-
|
|
176
|
+
---
|
|
291
177
|
|
|
292
|
-
|
|
293
|
-
|---|---|
|
|
294
|
-
| Versions | 7, 8 |
|
|
295
|
-
| Default port | 6379 |
|
|
296
|
-
| Default user | None (no auth by default) |
|
|
297
|
-
| Binary source | [hostdb](https://github.com/robertjbass/hostdb) |
|
|
178
|
+
## Supported Databases
|
|
298
179
|
|
|
299
|
-
SpinDB
|
|
180
|
+
SpinDB supports **9 database engines** with **multiple versions** for each:
|
|
300
181
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
182
|
+
| Engine | Type | Versions | Default Port | Query Language |
|
|
183
|
+
|--------|------|----------|--------------|----------------|
|
|
184
|
+
| 🐘 **PostgreSQL** | Relational (SQL) | 15, 16, 17, 18 | 5432 | SQL |
|
|
185
|
+
| 🐬 **MySQL** | Relational (SQL) | 8.0, 8.4, 9 | 3306 | SQL |
|
|
186
|
+
| 🦭 **MariaDB** | Relational (SQL) | 10.11, 11.4, 11.8 | 3307 | SQL |
|
|
187
|
+
| 🪶 **SQLite** | Embedded (SQL) | 3 | N/A (file-based) | SQL |
|
|
188
|
+
| 🦆 **DuckDB** | Embedded OLAP | 1.4.3 | N/A (file-based) | SQL |
|
|
189
|
+
| 🍃 **MongoDB** | Document Store | 7.0, 8.0, 8.2 | 27017 | JavaScript (mongosh) |
|
|
190
|
+
| 🔴 **Redis** | Key-Value Store | 7, 8 | 6379 | Redis commands |
|
|
191
|
+
| 🔷 **Valkey** | Key-Value Store | 8, 9 | 6379 | Redis commands |
|
|
192
|
+
| 🏠 **ClickHouse** | Columnar OLAP | 25.12 | 9000 (TCP), 8123 (HTTP) | SQL (ClickHouse dialect) |
|
|
304
193
|
|
|
305
|
-
|
|
306
|
-
spindb create mydb --engine redis --version 8
|
|
194
|
+
### Engine Categories
|
|
307
195
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
196
|
+
**Server-Based Databases** (PostgreSQL, MySQL, MariaDB, MongoDB, Redis, Valkey, ClickHouse):
|
|
197
|
+
- Start/stop server processes
|
|
198
|
+
- Bind to localhost ports
|
|
199
|
+
- Data stored in `~/.spindb/containers/{engine}/{name}/`
|
|
311
200
|
|
|
312
|
-
|
|
201
|
+
**File-Based Databases** (SQLite, DuckDB):
|
|
202
|
+
- No server process required
|
|
203
|
+
- Data stored in your project directories
|
|
204
|
+
- Always "running" (embedded, no daemon)
|
|
313
205
|
|
|
314
|
-
|
|
315
|
-
# Set a key
|
|
316
|
-
spindb run myredis -c "SET mykey myvalue"
|
|
317
|
-
|
|
318
|
-
# Get a key
|
|
319
|
-
spindb run myredis -c "GET mykey"
|
|
206
|
+
### Binary Sources
|
|
320
207
|
|
|
321
|
-
|
|
322
|
-
spindb run myredis --file ./scripts/seed.redis
|
|
208
|
+
All engines download pre-compiled binaries from [**hostdb**](https://github.com/robertjbass/hostdb), a repository of portable database binaries for all major platforms:
|
|
323
209
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
```
|
|
210
|
+
- **PostgreSQL**: hostdb (macOS/Linux), [EnterpriseDB](https://www.enterprisedb.com/) (Windows)
|
|
211
|
+
- **All other engines**: hostdb (all supported platforms)
|
|
327
212
|
|
|
328
|
-
|
|
213
|
+
This enables **multi-version support** without system package conflicts. Run PostgreSQL 14 for legacy projects and 18 for new ones—simultaneously.
|
|
329
214
|
|
|
330
|
-
|
|
215
|
+
---
|
|
331
216
|
|
|
332
|
-
|
|
333
|
-
|---|---|
|
|
334
|
-
| Versions | 8, 9 |
|
|
335
|
-
| Default port | 6379 |
|
|
336
|
-
| Default user | None (no auth by default) |
|
|
337
|
-
| Binary source | [hostdb](https://github.com/robertjbass/hostdb) |
|
|
217
|
+
## Core Commands
|
|
338
218
|
|
|
339
|
-
|
|
219
|
+
SpinDB provides a comprehensive CLI with commands for every database lifecycle operation.
|
|
340
220
|
|
|
341
|
-
|
|
221
|
+
### Container Lifecycle
|
|
342
222
|
|
|
343
223
|
```bash
|
|
344
|
-
# Create a
|
|
345
|
-
spindb create mydb
|
|
224
|
+
# Create a new database
|
|
225
|
+
spindb create mydb # PostgreSQL (default)
|
|
226
|
+
spindb create mydb --engine mongodb # MongoDB
|
|
227
|
+
spindb create mydb --engine mysql --db-version 8.0 # MySQL 8.0
|
|
228
|
+
spindb create mydb --port 5433 # Custom port
|
|
229
|
+
spindb create mydb --start --connect # Create, start, and connect
|
|
346
230
|
|
|
347
|
-
#
|
|
348
|
-
spindb
|
|
231
|
+
# Start/stop databases
|
|
232
|
+
spindb start mydb
|
|
233
|
+
spindb stop mydb
|
|
349
234
|
|
|
350
|
-
#
|
|
351
|
-
spindb
|
|
235
|
+
# Delete database (with confirmation)
|
|
236
|
+
spindb delete mydb
|
|
237
|
+
spindb delete mydb --yes --force # Skip prompts, force stop
|
|
352
238
|
```
|
|
353
239
|
|
|
354
|
-
|
|
240
|
+
### Data Operations
|
|
355
241
|
|
|
356
242
|
```bash
|
|
357
|
-
#
|
|
358
|
-
spindb
|
|
243
|
+
# Connect to database shell
|
|
244
|
+
spindb connect mydb # Standard client (psql, mysql, etc.)
|
|
245
|
+
spindb connect mydb --pgcli # Enhanced PostgreSQL shell
|
|
246
|
+
spindb connect mydb --mycli # Enhanced MySQL shell
|
|
247
|
+
spindb connect mydb --tui # Universal SQL client (usql)
|
|
359
248
|
|
|
360
|
-
#
|
|
361
|
-
spindb run
|
|
249
|
+
# Execute queries and scripts
|
|
250
|
+
spindb run mydb script.sql # Run SQL file
|
|
251
|
+
spindb run mydb -c "SELECT * FROM users" # Inline SQL
|
|
252
|
+
spindb run mydb seed.js # JavaScript (MongoDB)
|
|
253
|
+
spindb run mydb -c "SET foo bar" # Redis command
|
|
362
254
|
|
|
363
|
-
#
|
|
364
|
-
spindb
|
|
255
|
+
# Get connection string
|
|
256
|
+
spindb url mydb # postgresql://postgres@localhost:5432/mydb
|
|
257
|
+
spindb url mydb --copy # Copy to clipboard
|
|
258
|
+
spindb url mydb --json # JSON output with details
|
|
365
259
|
|
|
366
|
-
# Use
|
|
367
|
-
spindb
|
|
260
|
+
# Use in scripts
|
|
261
|
+
export DATABASE_URL=$(spindb url mydb)
|
|
262
|
+
psql $(spindb url mydb)
|
|
368
263
|
```
|
|
369
264
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
#### ClickHouse
|
|
373
|
-
|
|
374
|
-
| | |
|
|
375
|
-
|---|---|
|
|
376
|
-
| Versions | 25.12 |
|
|
377
|
-
| Default port | 9000 (native TCP), 8123 (HTTP) |
|
|
378
|
-
| Default user | `default` |
|
|
379
|
-
| Binary source | [hostdb](https://github.com/robertjbass/hostdb) |
|
|
380
|
-
|
|
381
|
-
ClickHouse is a column-oriented OLAP database designed for fast analytics on large datasets. SpinDB downloads ClickHouse server binaries automatically from [hostdb](https://github.com/robertjbass/hostdb) on GitHub Releases.
|
|
382
|
-
|
|
383
|
-
**Note:** ClickHouse is only available on macOS and Linux. Windows is not supported.
|
|
265
|
+
### Backup & Restore
|
|
384
266
|
|
|
385
267
|
```bash
|
|
386
|
-
# Create
|
|
387
|
-
spindb
|
|
268
|
+
# Create backups
|
|
269
|
+
spindb backup mydb # Auto-generated filename
|
|
270
|
+
spindb backup mydb --name production-backup # Custom name
|
|
271
|
+
spindb backup mydb --output ./backups/ # Custom directory
|
|
272
|
+
spindb backup mydb --format sql # SQL text format
|
|
273
|
+
spindb backup mydb --format dump # Binary format
|
|
274
|
+
|
|
275
|
+
# Restore from backups
|
|
276
|
+
spindb restore mydb backup.dump
|
|
277
|
+
spindb restore mydb backup.sql --database prod_copy
|
|
388
278
|
|
|
389
|
-
#
|
|
390
|
-
spindb
|
|
279
|
+
# Pull from remote database
|
|
280
|
+
spindb restore mydb --from-url "postgresql://user:pass@prod-host/db"
|
|
391
281
|
|
|
392
|
-
#
|
|
393
|
-
spindb
|
|
282
|
+
# Clone existing database
|
|
283
|
+
spindb create prod-copy --from ./prod-backup.dump
|
|
284
|
+
spindb create staging --from "postgresql://user:pass@prod:5432/production"
|
|
394
285
|
```
|
|
395
286
|
|
|
396
|
-
|
|
287
|
+
### Container Management
|
|
397
288
|
|
|
398
289
|
```bash
|
|
399
|
-
#
|
|
400
|
-
spindb
|
|
290
|
+
# List all databases
|
|
291
|
+
spindb list
|
|
292
|
+
spindb list --json
|
|
401
293
|
|
|
402
|
-
#
|
|
403
|
-
spindb
|
|
294
|
+
# Show container details
|
|
295
|
+
spindb info mydb
|
|
296
|
+
spindb info mydb --json
|
|
297
|
+
|
|
298
|
+
# Clone a database
|
|
299
|
+
spindb clone source-db new-db
|
|
404
300
|
|
|
405
|
-
#
|
|
406
|
-
spindb
|
|
301
|
+
# Edit configuration
|
|
302
|
+
spindb edit mydb --name newname # Rename
|
|
303
|
+
spindb edit mydb --port 5433 # Change port
|
|
304
|
+
spindb edit mydb --relocate ~/new/path # Move SQLite/DuckDB file
|
|
407
305
|
|
|
408
|
-
#
|
|
409
|
-
spindb
|
|
306
|
+
# View logs
|
|
307
|
+
spindb logs mydb
|
|
308
|
+
spindb logs mydb --follow # Follow mode (tail -f)
|
|
309
|
+
spindb logs mydb -n 100 # Last 100 lines
|
|
410
310
|
```
|
|
411
311
|
|
|
412
|
-
###
|
|
312
|
+
### Engine & System Management
|
|
413
313
|
|
|
414
|
-
|
|
314
|
+
```bash
|
|
315
|
+
# Manage installed engines
|
|
316
|
+
spindb engines # List installed engines
|
|
317
|
+
spindb engines supported # Show all supported engines
|
|
318
|
+
spindb engines delete postgresql 16 # Remove specific version
|
|
415
319
|
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
| 🟪 | Planned for hostdb (pending/in-progress) |
|
|
320
|
+
# Manage client tools
|
|
321
|
+
spindb deps check # Check all dependencies
|
|
322
|
+
spindb deps check --engine postgresql # Check specific engine
|
|
323
|
+
spindb deps install # Install missing tools
|
|
421
324
|
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
| MySQL | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
427
|
-
| MariaDB | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
428
|
-
| SQLite | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
429
|
-
| DuckDB | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
430
|
-
| MongoDB* | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
431
|
-
| Redis* | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
432
|
-
| Valkey | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
433
|
-
| ClickHouse* | ✅ | ✅ | ✅ | ✅ | ❌ |
|
|
434
|
-
| **Planned for hostdb** |||||
|
|
435
|
-
| CockroachDB | 🟪 | 🟪 | 🟪 | 🟪 | 🟪 |
|
|
436
|
-
| TimescaleDB | 🟪 | 🟪 | 🟪 | 🟪 | 🟪 |
|
|
437
|
-
| Meilisearch | 🟪 | 🟪 | 🟪 | 🟪 | 🟪 |
|
|
438
|
-
| OpenSearch | 🟪 | 🟪 | 🟪 | 🟪 | 🟪 |
|
|
439
|
-
| QuestDB | 🟪 | 🟪 | 🟪 | 🟪 | 🟪 |
|
|
440
|
-
| FerretDB | 🟪 | 🟪 | 🟪 | 🟪 | 🟪 |
|
|
441
|
-
| TiDB | 🟪 | 🟪 | 🟪 | 🟪 | 🟪 |
|
|
442
|
-
| ArangoDB | 🟪 | 🟪 | 🟪 | 🟪 | 🟪 |
|
|
443
|
-
| Qdrant | 🟪 | 🟪 | 🟪 | 🟪 | 🟪 |
|
|
444
|
-
| Apache Cassandra | 🟪 | 🟪 | 🟪 | 🟪 | 🟪 |
|
|
445
|
-
| InfluxDB | 🟪 | 🟪 | 🟪 | 🟪 | 🟪 |
|
|
446
|
-
| CouchDB | 🟪 | 🟪 | 🟪 | 🟪 | 🟪 |
|
|
447
|
-
| KeyDB | 🟪 | 🟪 | 🟪 | 🟪 | 🟪 |
|
|
448
|
-
| libSQL | 🟪 | 🟪 | 🟪 | 🟪 | 🟪 |
|
|
449
|
-
| FoundationDB | 🟪 | 🟪 | 🟪 | 🟪 | 🟪 |
|
|
450
|
-
| RocksDB | 🟪 | 🟪 | 🟪 | 🟪 | 🟪 |
|
|
451
|
-
|
|
452
|
-
**Notes:**
|
|
453
|
-
- **\*** Licensing considerations for commercial use — consider Valkey (Redis) or FerretDB (MongoDB) as alternatives
|
|
454
|
-
- **PostgreSQL** uses [EDB](https://www.enterprisedb.com/) binaries on Windows instead of hostdb
|
|
455
|
-
- **ClickHouse** Windows binaries are not available on hostdb (macOS and Linux only)
|
|
456
|
-
- **Valkey** is a Redis-compatible drop-in replacement with permissive licensing
|
|
457
|
-
- **CockroachDB** is planned for both hostdb and SpinDB (see [roadmap](TODO.md))
|
|
458
|
-
- All databases under "Planned for hostdb" have permissive open-source licenses (Apache 2.0, MIT, or BSD)
|
|
459
|
-
|
|
460
|
-
For the latest platform support, see the [hostdb databases.json](https://github.com/robertjbass/hostdb/blob/main/databases.json).
|
|
325
|
+
# Configuration
|
|
326
|
+
spindb config show # Show current config
|
|
327
|
+
spindb config detect # Re-detect tool paths
|
|
328
|
+
spindb config update-check on # Enable update notifications
|
|
461
329
|
|
|
462
|
-
|
|
330
|
+
# System health
|
|
331
|
+
spindb doctor # Interactive health check
|
|
332
|
+
spindb doctor --json # JSON output
|
|
463
333
|
|
|
464
|
-
|
|
334
|
+
# Version management
|
|
335
|
+
spindb version # Show current version
|
|
336
|
+
spindb version --check # Check for updates
|
|
337
|
+
spindb self-update # Update to latest version
|
|
338
|
+
```
|
|
465
339
|
|
|
466
|
-
###
|
|
340
|
+
### Interactive Menu
|
|
467
341
|
|
|
468
|
-
|
|
342
|
+
Don't want to remember commands? Just run:
|
|
469
343
|
|
|
470
344
|
```bash
|
|
471
|
-
spindb
|
|
472
|
-
spindb create mydb --engine mariadb # MariaDB
|
|
473
|
-
spindb create mydb --engine mysql # MySQL
|
|
474
|
-
spindb create mydb --engine sqlite # SQLite (file-based)
|
|
475
|
-
spindb create mydb --db-version 16 # Specific PostgreSQL version
|
|
476
|
-
spindb create mydb --port 5433 # Custom port
|
|
477
|
-
spindb create mydb --database my_app # Custom database name
|
|
478
|
-
spindb create mydb --no-start # Create without starting
|
|
479
|
-
|
|
480
|
-
# Create, start, and connect in one command
|
|
481
|
-
spindb create mydb --start --connect
|
|
482
|
-
|
|
483
|
-
# SQLite with custom path
|
|
484
|
-
spindb create mydb --engine sqlite --path ./data/app.sqlite
|
|
345
|
+
spindb
|
|
485
346
|
```
|
|
486
347
|
|
|
487
|
-
|
|
348
|
+
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.**
|
|
488
349
|
|
|
489
|
-
|
|
490
|
-
spindb create mydb --from ./backup.dump
|
|
491
|
-
spindb create mydb --from "postgresql://user:pass@host:5432/production"
|
|
492
|
-
```
|
|
350
|
+
---
|
|
493
351
|
|
|
494
|
-
|
|
495
|
-
<summary>All options</summary>
|
|
352
|
+
## How It Works
|
|
496
353
|
|
|
497
|
-
|
|
498
|
-
|--------|-------------|
|
|
499
|
-
| `--engine`, `-e` | Database engine (`postgresql`, `mariadb`, `mysql`, `sqlite`, `duckdb`, `mongodb`, `redis`, `valkey`, `clickhouse`) |
|
|
500
|
-
| `--db-version` | Engine version (e.g., 17 for PostgreSQL, 11.8 for MariaDB, 8 for Redis, 9 for Valkey) |
|
|
501
|
-
| `--port`, `-p` | Port number (not applicable for SQLite) |
|
|
502
|
-
| `--database`, `-d` | Primary database name (Redis uses 0-15) |
|
|
503
|
-
| `--path` | File path for SQLite databases |
|
|
504
|
-
| `--max-connections` | Maximum database connections (default: 200) |
|
|
505
|
-
| `--from` | Restore from backup file or connection string |
|
|
506
|
-
| `--start` | Start container after creation (skip prompt) |
|
|
507
|
-
| `--no-start` | Create without starting |
|
|
508
|
-
| `--connect` | Open a shell connection after creation |
|
|
354
|
+
### Architecture
|
|
509
355
|
|
|
510
|
-
|
|
356
|
+
SpinDB uses "container" terminology loosely—there's no Docker involved. When you create a container, SpinDB:
|
|
511
357
|
|
|
512
|
-
|
|
358
|
+
1. **Downloads database binaries** from [hostdb](https://github.com/robertjbass/hostdb) or uses system installations
|
|
359
|
+
2. **Creates isolated data directories** at `~/.spindb/containers/{engine}/{name}/`
|
|
360
|
+
3. **Runs databases as native processes** on your machine
|
|
513
361
|
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
362
|
+
Each container contains:
|
|
363
|
+
- `container.json` - Configuration (port, version, status)
|
|
364
|
+
- `data/` - Database files
|
|
365
|
+
- `{engine}.log` - Server logs
|
|
517
366
|
|
|
518
|
-
|
|
367
|
+
### Storage Layout
|
|
519
368
|
|
|
520
369
|
```bash
|
|
521
|
-
spindb
|
|
370
|
+
~/.spindb/
|
|
371
|
+
├── bin/ # Downloaded binaries
|
|
372
|
+
│ ├── postgresql-18.1.0-darwin-arm64/ # ~45 MB
|
|
373
|
+
│ ├── mysql-9.0.1-darwin-arm64/ # ~200 MB
|
|
374
|
+
│ └── mongodb-8.0-darwin-arm64/ # ~200 MB
|
|
375
|
+
├── containers/ # Server-based databases
|
|
376
|
+
│ ├── postgresql/
|
|
377
|
+
│ │ └── myapp/
|
|
378
|
+
│ │ ├── container.json
|
|
379
|
+
│ │ ├── data/
|
|
380
|
+
│ │ └── postgres.log
|
|
381
|
+
│ ├── mysql/
|
|
382
|
+
│ └── mongodb/
|
|
383
|
+
├── logs/ # SpinDB error logs
|
|
384
|
+
└── config.json # Tool paths and settings
|
|
385
|
+
|
|
386
|
+
# File-based databases (SQLite, DuckDB) store in project directories
|
|
387
|
+
./myproject/
|
|
388
|
+
└── app.sqlite # Created with: spindb create app -e sqlite
|
|
522
389
|
```
|
|
523
390
|
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
```bash
|
|
527
|
-
spindb delete mydb
|
|
528
|
-
spindb delete mydb --yes # Skip confirmation prompt
|
|
529
|
-
spindb delete mydb --force # Force stop if running
|
|
530
|
-
spindb delete mydb -fy # Both: force stop + skip confirmation
|
|
531
|
-
```
|
|
391
|
+
### Data Persistence
|
|
532
392
|
|
|
533
|
-
|
|
534
|
-
<summary>All options</summary>
|
|
393
|
+
Databases run as **native processes**, and **data persists across restarts**. When you stop a container:
|
|
535
394
|
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
| `--yes`, `-y` | Skip confirmation prompt (for scripts/automation) |
|
|
540
|
-
| `--json`, `-j` | Output result as JSON |
|
|
395
|
+
1. SpinDB sends a graceful shutdown signal
|
|
396
|
+
2. The database flushes pending writes to disk
|
|
397
|
+
3. Data remains in the `data/` directory
|
|
541
398
|
|
|
542
|
-
|
|
399
|
+
**Your data is never deleted unless you explicitly run `spindb delete`.**
|
|
543
400
|
|
|
544
|
-
|
|
401
|
+
#### Durability by Engine
|
|
545
402
|
|
|
546
|
-
|
|
403
|
+
| Engine | Persistence Mechanism | Durability |
|
|
404
|
+
|--------|----------------------|------------|
|
|
405
|
+
| PostgreSQL | Write-Ahead Logging (WAL) | Committed transactions survive crashes |
|
|
406
|
+
| MySQL | InnoDB transaction logs | Committed transactions survive crashes |
|
|
407
|
+
| MariaDB | InnoDB transaction logs | Committed transactions survive crashes |
|
|
408
|
+
| SQLite | File-based transactions | Commits written immediately to disk |
|
|
409
|
+
| DuckDB | File-based transactions | Commits written immediately to disk |
|
|
410
|
+
| MongoDB | WiredTiger journaling | Writes journaled before acknowledged |
|
|
411
|
+
| Redis | RDB snapshots (periodic) | May lose ~60 seconds on unexpected crash |
|
|
412
|
+
| Valkey | RDB snapshots (periodic) | May lose ~60 seconds on unexpected crash |
|
|
413
|
+
| ClickHouse | MergeTree storage | Committed transactions survive crashes |
|
|
547
414
|
|
|
548
|
-
|
|
549
|
-
spindb connect mydb # Standard shell (psql/mysql)
|
|
550
|
-
spindb connect mydb --pgcli # Enhanced PostgreSQL shell
|
|
551
|
-
spindb connect mydb --mycli # Enhanced MySQL shell
|
|
552
|
-
spindb connect mydb --tui # Universal SQL client (usql)
|
|
553
|
-
```
|
|
415
|
+
---
|
|
554
416
|
|
|
555
|
-
|
|
417
|
+
## Engine-Specific Details
|
|
556
418
|
|
|
557
|
-
|
|
558
|
-
spindb connect mydb --install-pgcli
|
|
559
|
-
spindb connect mydb --install-mycli
|
|
560
|
-
spindb connect mydb --install-tui
|
|
561
|
-
```
|
|
419
|
+
Each database engine has unique features and behaviors. See full documentation in [ENGINES.md](ENGINES.md).
|
|
562
420
|
|
|
563
|
-
|
|
421
|
+
### PostgreSQL 🐘
|
|
564
422
|
|
|
565
423
|
```bash
|
|
566
|
-
|
|
567
|
-
spindb
|
|
568
|
-
spindb run mydb seed.sql --database my_app # Target specific database
|
|
424
|
+
# Create PostgreSQL database
|
|
425
|
+
spindb create myapp --engine postgresql --db-version 18
|
|
569
426
|
|
|
570
|
-
#
|
|
571
|
-
spindb
|
|
572
|
-
spindb
|
|
427
|
+
# Multiple versions side-by-side
|
|
428
|
+
spindb create legacy --engine postgresql --db-version 14
|
|
429
|
+
spindb create modern --engine postgresql --db-version 18
|
|
573
430
|
|
|
574
|
-
#
|
|
575
|
-
spindb
|
|
576
|
-
spindb
|
|
431
|
+
# Backup formats
|
|
432
|
+
spindb backup myapp --format sql # Plain SQL (.sql)
|
|
433
|
+
spindb backup myapp --format dump # Binary custom format (.dump)
|
|
577
434
|
```
|
|
578
435
|
|
|
579
|
-
|
|
436
|
+
**Versions:** 15, 16, 17, 18
|
|
437
|
+
**Tools:** `psql`, `pg_dump`, `pg_restore` (included)
|
|
438
|
+
**Enhanced client:** `pgcli` (auto-completion, syntax highlighting)
|
|
439
|
+
|
|
440
|
+
### MySQL 🐬 & MariaDB 🦭
|
|
580
441
|
|
|
581
442
|
```bash
|
|
582
|
-
|
|
583
|
-
spindb
|
|
584
|
-
spindb
|
|
443
|
+
# MySQL
|
|
444
|
+
spindb create shop --engine mysql --db-version 9
|
|
445
|
+
spindb connect shop --mycli
|
|
585
446
|
|
|
586
|
-
#
|
|
587
|
-
|
|
588
|
-
psql $(spindb url mydb)
|
|
447
|
+
# MariaDB (MySQL-compatible)
|
|
448
|
+
spindb create store --engine mariadb --db-version 11.8
|
|
589
449
|
```
|
|
590
450
|
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
spindb backup mydb # Auto-generated filename
|
|
595
|
-
spindb backup mydb --name my-backup # Custom name
|
|
596
|
-
spindb backup mydb --output ./backups/ # Custom directory
|
|
597
|
-
spindb backup mydb --database my_app # Backup specific database
|
|
598
|
-
```
|
|
451
|
+
**MySQL versions:** 8.0, 8.4, 9
|
|
452
|
+
**MariaDB versions:** 10.11, 11.4, 11.8
|
|
453
|
+
**Tools:** `mysql`, `mysqldump`, `mysqladmin` (included)
|
|
599
454
|
|
|
600
|
-
|
|
455
|
+
### MongoDB 🍃
|
|
601
456
|
|
|
602
457
|
```bash
|
|
603
|
-
|
|
604
|
-
spindb
|
|
605
|
-
|
|
606
|
-
# Shorthand
|
|
607
|
-
spindb backup mydb --sql
|
|
608
|
-
spindb backup mydb --dump
|
|
609
|
-
```
|
|
458
|
+
# Create MongoDB database
|
|
459
|
+
spindb create logs --engine mongodb --db-version 8.0
|
|
610
460
|
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
- SQLite: `.sql` (plain SQL) / `.sqlite` (binary copy)
|
|
616
|
-
- DuckDB: `.sql` (plain SQL) / `.duckdb` (binary copy)
|
|
617
|
-
- MongoDB: `.bson` (BSON dump) / `.archive` (compressed archive)
|
|
618
|
-
- Redis: `.redis` (text commands) / `.rdb` (RDB snapshot)
|
|
619
|
-
- Valkey: `.valkey` (text commands) / `.rdb` (RDB snapshot)
|
|
620
|
-
|
|
621
|
-
<details>
|
|
622
|
-
<summary>All options</summary>
|
|
623
|
-
|
|
624
|
-
| Option | Description |
|
|
625
|
-
|--------|-------------|
|
|
626
|
-
| `--database`, `-d` | Database to backup (defaults to primary) |
|
|
627
|
-
| `--name`, `-n` | Custom backup filename (without extension) |
|
|
628
|
-
| `--output`, `-o` | Output directory (defaults to current directory) |
|
|
629
|
-
| `--format` | Output format: `sql` or `dump` |
|
|
630
|
-
| `--sql` | Shorthand for `--format sql` |
|
|
631
|
-
| `--dump` | Shorthand for `--format dump` |
|
|
632
|
-
| `--json`, `-j` | Output result as JSON |
|
|
633
|
-
|
|
634
|
-
</details>
|
|
635
|
-
|
|
636
|
-
#### `backups` - List backup files
|
|
461
|
+
# JavaScript queries (not SQL)
|
|
462
|
+
spindb run logs -c "db.users.insertOne({name: 'Alice'})"
|
|
463
|
+
spindb run logs -c "db.users.find().pretty()"
|
|
464
|
+
spindb run logs seed.js
|
|
637
465
|
|
|
638
|
-
|
|
639
|
-
spindb
|
|
640
|
-
spindb backups ./data # List backups in specific directory
|
|
641
|
-
spindb backups --all # Include ~/.spindb/backups
|
|
642
|
-
spindb backups --limit 50 # Show more results
|
|
643
|
-
spindb backups --json # JSON output
|
|
466
|
+
# Connect with mongosh
|
|
467
|
+
spindb connect logs
|
|
644
468
|
```
|
|
645
469
|
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
| Option | Description |
|
|
650
|
-
|--------|-------------|
|
|
651
|
-
| `--all`, `-a` | Include backups from `~/.spindb/backups` |
|
|
652
|
-
| `--limit`, `-n` | Limit number of results (default: 20) |
|
|
653
|
-
| `--json`, `-j` | Output as JSON |
|
|
470
|
+
**Versions:** 7.0, 8.0, 8.2
|
|
471
|
+
**Query language:** JavaScript (via `mongosh`)
|
|
472
|
+
**Tools:** `mongod`, `mongosh`, `mongodump`, `mongorestore` (included)
|
|
654
473
|
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
#### `restore` - Restore from backup
|
|
474
|
+
### Redis 🔴 & Valkey 🔷
|
|
658
475
|
|
|
659
476
|
```bash
|
|
660
|
-
|
|
661
|
-
spindb
|
|
662
|
-
spindb restore mydb --from-url "postgresql://user:pass@host/db"
|
|
663
|
-
```
|
|
477
|
+
# Redis
|
|
478
|
+
spindb create cache --engine redis --db-version 8
|
|
664
479
|
|
|
665
|
-
|
|
480
|
+
# Valkey (Redis fork with BSD-3 license)
|
|
481
|
+
spindb create sessions --engine valkey --db-version 9
|
|
666
482
|
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
spindb
|
|
670
|
-
|
|
671
|
-
# Pull from production into a new local database
|
|
672
|
-
spindb restore mydb --from-url "postgresql://user:pass@prod-host/proddb" --database prod_local
|
|
483
|
+
# Redis commands
|
|
484
|
+
spindb run cache -c "SET mykey myvalue"
|
|
485
|
+
spindb run cache -c "GET mykey"
|
|
673
486
|
|
|
674
|
-
#
|
|
675
|
-
spindb
|
|
487
|
+
# Enhanced shell
|
|
488
|
+
spindb connect cache --iredis
|
|
676
489
|
```
|
|
677
490
|
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
| `--database`, `-d` | Target database name (creates new if doesn't exist) |
|
|
684
|
-
| `--from-url` | Pull data from a remote database connection string |
|
|
685
|
-
| `--force`, `-f` | Overwrite existing database without confirmation |
|
|
686
|
-
| `--json`, `-j` | Output result as JSON |
|
|
687
|
-
|
|
688
|
-
</details>
|
|
689
|
-
|
|
690
|
-
#### Backup & Restore Format Reference
|
|
691
|
-
|
|
692
|
-
Each engine has specific backup formats and restore behaviors:
|
|
693
|
-
|
|
694
|
-
<details>
|
|
695
|
-
<summary>PostgreSQL</summary>
|
|
696
|
-
|
|
697
|
-
| Format | Extension | Tool | Notes |
|
|
698
|
-
|--------|-----------|------|-------|
|
|
699
|
-
| SQL | `.sql` | pg_dump | Plain text SQL, human-readable |
|
|
700
|
-
| Custom | `.dump` | pg_dump -Fc | Compressed, supports parallel restore |
|
|
701
|
-
|
|
702
|
-
**Restore behavior:** Creates new database or replaces existing. Uses `pg_restore` for `.dump`, `psql` for `.sql`.
|
|
703
|
-
|
|
704
|
-
</details>
|
|
705
|
-
|
|
706
|
-
<details>
|
|
707
|
-
<summary>MariaDB</summary>
|
|
708
|
-
|
|
709
|
-
| Format | Extension | Tool | Notes |
|
|
710
|
-
|--------|-----------|------|-------|
|
|
711
|
-
| SQL | `.sql` | mariadb-dump | Plain text SQL |
|
|
712
|
-
| Compressed | `.sql.gz` | mariadb-dump + gzip | Gzip compressed SQL |
|
|
713
|
-
|
|
714
|
-
**Restore behavior:** Creates new database or replaces existing. Pipes to `mariadb` client.
|
|
715
|
-
|
|
716
|
-
</details>
|
|
717
|
-
|
|
718
|
-
<details>
|
|
719
|
-
<summary>MySQL</summary>
|
|
720
|
-
|
|
721
|
-
| Format | Extension | Tool | Notes |
|
|
722
|
-
|--------|-----------|------|-------|
|
|
723
|
-
| SQL | `.sql` | mysqldump | Plain text SQL |
|
|
724
|
-
| Compressed | `.sql.gz` | mysqldump + gzip | Gzip compressed SQL |
|
|
725
|
-
|
|
726
|
-
**Restore behavior:** Creates new database or replaces existing. Pipes to `mysql` client.
|
|
491
|
+
**Redis versions:** 7, 8
|
|
492
|
+
**Valkey versions:** 8, 9
|
|
493
|
+
**Query language:** Redis commands
|
|
494
|
+
**Databases:** Numbered 0-15 (not named)
|
|
495
|
+
**Tools:** `redis-cli`, `redis-server` / `valkey-cli`, `valkey-server` (included)
|
|
727
496
|
|
|
728
|
-
|
|
497
|
+
### SQLite 🪶 & DuckDB 🦆
|
|
729
498
|
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|--------|-----------|------|-------|
|
|
735
|
-
| SQL | `.sql` | .dump | Plain text SQL |
|
|
736
|
-
| Binary | `.sqlite` | File copy | Exact copy of database file |
|
|
737
|
-
|
|
738
|
-
**Restore behavior:** Creates new file or replaces existing.
|
|
739
|
-
|
|
740
|
-
</details>
|
|
741
|
-
|
|
742
|
-
<details>
|
|
743
|
-
<summary>DuckDB</summary>
|
|
744
|
-
|
|
745
|
-
| Format | Extension | Tool | Notes |
|
|
746
|
-
|--------|-----------|------|-------|
|
|
747
|
-
| SQL | `.sql` | duckdb -c | Plain text SQL |
|
|
748
|
-
| Binary | `.duckdb` | File copy | Exact copy of database file |
|
|
749
|
-
|
|
750
|
-
**Restore behavior:** Creates new file or replaces existing.
|
|
751
|
-
|
|
752
|
-
</details>
|
|
753
|
-
|
|
754
|
-
<details>
|
|
755
|
-
<summary>MongoDB</summary>
|
|
756
|
-
|
|
757
|
-
| Format | Extension | Tool | Notes |
|
|
758
|
-
|--------|-----------|------|-------|
|
|
759
|
-
| BSON | `.bson` | mongodump | Binary JSON per collection |
|
|
760
|
-
| Archive | `.archive` | mongodump --archive | Single compressed file |
|
|
761
|
-
|
|
762
|
-
**Restore behavior:** Creates new database or replaces existing. Uses `mongorestore`.
|
|
763
|
-
|
|
764
|
-
</details>
|
|
765
|
-
|
|
766
|
-
<details>
|
|
767
|
-
<summary>Redis</summary>
|
|
768
|
-
|
|
769
|
-
| Format | Extension | Tool | Notes |
|
|
770
|
-
|--------|-----------|------|-------|
|
|
771
|
-
| RDB | `.rdb` | BGSAVE | Binary snapshot, requires restart |
|
|
772
|
-
| Text | `.redis` | Custom | Human-readable Redis commands |
|
|
773
|
-
|
|
774
|
-
**Text format detection:** Files are detected as Redis text commands if they contain valid Redis commands (SET, HSET, DEL, etc.), regardless of file extension. This allows restoring files like `users.txt` or `data` without renaming.
|
|
499
|
+
```bash
|
|
500
|
+
# SQLite - embedded relational database
|
|
501
|
+
spindb create app --engine sqlite --path ./data/app.sqlite
|
|
502
|
+
spindb connect app
|
|
775
503
|
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
- **Merge:** Adds/updates keys, keeps existing keys not in backup
|
|
504
|
+
# DuckDB - embedded analytics database (OLAP)
|
|
505
|
+
spindb create analytics --engine duckdb --path ./data/warehouse.duckdb
|
|
506
|
+
spindb connect analytics
|
|
507
|
+
```
|
|
781
508
|
|
|
782
|
-
**
|
|
509
|
+
**No server process** - File-based databases stored in your project directories.
|
|
510
|
+
**No start/stop needed** - Always "running" (embedded).
|
|
511
|
+
**SQLite tools:** `sqlite3`, `sqldiff`, `sqlite3_analyzer` (included)
|
|
512
|
+
**DuckDB tools:** `duckdb` (included)
|
|
783
513
|
|
|
784
|
-
|
|
514
|
+
### ClickHouse 🏠
|
|
785
515
|
|
|
786
|
-
|
|
787
|
-
|
|
516
|
+
```bash
|
|
517
|
+
# Create ClickHouse database (columnar OLAP)
|
|
518
|
+
spindb create warehouse --engine clickhouse
|
|
788
519
|
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
520
|
+
# SQL with ClickHouse extensions
|
|
521
|
+
spindb run warehouse -c "CREATE TABLE events (timestamp DateTime, user_id UInt64) ENGINE = MergeTree() ORDER BY timestamp"
|
|
522
|
+
spindb run warehouse -c "SELECT * FROM system.tables"
|
|
523
|
+
```
|
|
793
524
|
|
|
794
|
-
**
|
|
525
|
+
**Version:** 25.12 (YY.MM versioning)
|
|
526
|
+
**Platforms:** macOS, Linux (no Windows support)
|
|
527
|
+
**Ports:** 9000 (native TCP), 8123 (HTTP)
|
|
528
|
+
**Tools:** `clickhouse-client`, `clickhouse-server` (included)
|
|
795
529
|
|
|
796
|
-
|
|
797
|
-
- **RDB (`.rdb`):** Requires stopping Valkey, copies file to data directory, restart loads data
|
|
798
|
-
- **Text (`.valkey`):** Pipes commands to running Valkey instance. Prompts for:
|
|
799
|
-
- **Replace all:** Runs `FLUSHDB` first (clean slate)
|
|
800
|
-
- **Merge:** Adds/updates keys, keeps existing keys not in backup
|
|
530
|
+
---
|
|
801
531
|
|
|
802
|
-
|
|
532
|
+
## Enhanced CLI Tools
|
|
803
533
|
|
|
804
|
-
|
|
534
|
+
SpinDB supports enhanced database shells with auto-completion, syntax highlighting, and better formatting:
|
|
805
535
|
|
|
806
|
-
|
|
536
|
+
| Engine | Standard Client | Enhanced Client | Universal Client |
|
|
537
|
+
|--------|----------------|-----------------|------------------|
|
|
538
|
+
| PostgreSQL | `psql` | `pgcli` | `usql` |
|
|
539
|
+
| MySQL | `mysql` | `mycli` | `usql` |
|
|
540
|
+
| MariaDB | `mariadb` | `mycli` | `usql` |
|
|
541
|
+
| SQLite | `sqlite3` | `litecli` | `usql` |
|
|
542
|
+
| DuckDB | `duckdb` | - | `usql` |
|
|
543
|
+
| MongoDB | `mongosh` | - | - |
|
|
544
|
+
| Redis | `redis-cli` | `iredis` | - |
|
|
545
|
+
| Valkey | `valkey-cli` | `iredis` (compatible) | - |
|
|
546
|
+
| ClickHouse | `clickhouse-client` | - | `usql` |
|
|
807
547
|
|
|
808
|
-
|
|
548
|
+
Install and use in one command:
|
|
809
549
|
|
|
810
550
|
```bash
|
|
811
|
-
spindb
|
|
812
|
-
spindb
|
|
551
|
+
spindb connect mydb --install-pgcli
|
|
552
|
+
spindb connect mydb --install-mycli
|
|
553
|
+
spindb connect mydb --install-tui # usql (universal)
|
|
813
554
|
```
|
|
814
555
|
|
|
815
|
-
|
|
556
|
+
---
|
|
816
557
|
|
|
817
|
-
|
|
818
|
-
spindb info # All containers
|
|
819
|
-
spindb info mydb # Specific container
|
|
820
|
-
spindb info mydb --json
|
|
821
|
-
```
|
|
558
|
+
## Backup & Restore
|
|
822
559
|
|
|
823
|
-
|
|
560
|
+
Every engine supports backup and restore with engine-specific formats:
|
|
824
561
|
|
|
825
|
-
|
|
826
|
-
spindb stop source-db # Source must be stopped
|
|
827
|
-
spindb clone source-db new-db
|
|
828
|
-
spindb start new-db
|
|
829
|
-
```
|
|
562
|
+
### PostgreSQL
|
|
830
563
|
|
|
831
|
-
|
|
564
|
+
| Format | Extension | Tool | Use Case |
|
|
565
|
+
|--------|-----------|------|----------|
|
|
566
|
+
| SQL | `.sql` | pg_dump | Human-readable, portable |
|
|
567
|
+
| Custom | `.dump` | pg_dump -Fc | Compressed, faster restore |
|
|
832
568
|
|
|
833
569
|
```bash
|
|
834
|
-
spindb
|
|
835
|
-
spindb
|
|
836
|
-
spindb
|
|
837
|
-
spindb edit mydb --set-config max_connections=300 # PostgreSQL config
|
|
838
|
-
spindb edit mydb # Interactive mode
|
|
570
|
+
spindb backup mydb --sql # Plain SQL
|
|
571
|
+
spindb backup mydb --dump # Binary custom format
|
|
572
|
+
spindb restore mydb backup.dump
|
|
839
573
|
```
|
|
840
574
|
|
|
841
|
-
|
|
575
|
+
### MySQL & MariaDB
|
|
576
|
+
|
|
577
|
+
| Format | Extension | Tool | Use Case |
|
|
578
|
+
|--------|-----------|------|----------|
|
|
579
|
+
| SQL | `.sql` | mysqldump / mariadb-dump | Human-readable |
|
|
580
|
+
| Compressed | `.sql.gz` | mysqldump + gzip | Smaller file size |
|
|
842
581
|
|
|
843
582
|
```bash
|
|
844
|
-
spindb
|
|
845
|
-
spindb
|
|
846
|
-
spindb logs mydb -n 50 # Last 50 lines
|
|
847
|
-
spindb logs mydb --editor # Open in $EDITOR
|
|
583
|
+
spindb backup mydb --sql # Plain SQL
|
|
584
|
+
spindb backup mydb --dump # Compressed SQL
|
|
848
585
|
```
|
|
849
586
|
|
|
850
|
-
###
|
|
587
|
+
### MongoDB
|
|
851
588
|
|
|
852
|
-
|
|
589
|
+
| Format | Extension | Tool | Use Case |
|
|
590
|
+
|--------|-----------|------|----------|
|
|
591
|
+
| BSON | `.bson` | mongodump | Binary, preserves all types |
|
|
592
|
+
| Archive | `.archive` | mongodump --archive | Single compressed file |
|
|
853
593
|
|
|
854
594
|
```bash
|
|
855
|
-
spindb
|
|
856
|
-
spindb
|
|
857
|
-
spindb engines supported # List all supported engines
|
|
858
|
-
spindb engines supported --json # Full engine config as JSON
|
|
859
|
-
spindb engines supported --all # Include pending/planned engines
|
|
860
|
-
spindb engines delete postgresql 16 # Delete a version (frees ~45MB)
|
|
595
|
+
spindb backup mydb # BSON directory
|
|
596
|
+
spindb backup mydb --format archive # Single .archive file
|
|
861
597
|
```
|
|
862
598
|
|
|
863
|
-
|
|
599
|
+
### Redis & Valkey
|
|
864
600
|
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
🐘 postgresql 17.7 darwin-arm64 45.2 MB
|
|
870
|
-
🐬 mysql 9.0.1 darwin-arm64 150.0 MB
|
|
871
|
-
🪶 sqlite 3.51.2 darwin-arm64 5.0 MB
|
|
872
|
-
────────────────────────────────────────────────────────
|
|
873
|
-
|
|
874
|
-
PostgreSQL: 2 version(s), 90.0 MB
|
|
875
|
-
MySQL: 1 version(s), 150.0 MB
|
|
876
|
-
SQLite: 1 version(s), 5.0 MB
|
|
877
|
-
```
|
|
601
|
+
| Format | Extension | Tool | Use Case |
|
|
602
|
+
|--------|-----------|------|----------|
|
|
603
|
+
| RDB | `.rdb` | BGSAVE | Binary snapshot, requires restart |
|
|
604
|
+
| Text | `.redis` / `.valkey` | Custom | Human-readable commands |
|
|
878
605
|
|
|
879
|
-
|
|
606
|
+
```bash
|
|
607
|
+
spindb backup mydb --dump # RDB snapshot
|
|
608
|
+
spindb backup mydb --sql # Text commands
|
|
880
609
|
|
|
610
|
+
# Restore with merge or replace strategy
|
|
611
|
+
spindb restore mydb backup.redis # Prompts: Replace all / Merge
|
|
881
612
|
```
|
|
882
|
-
🐘 postgresql
|
|
883
|
-
🐬 mysql
|
|
884
|
-
🦭 mariadb
|
|
885
|
-
🪶 sqlite
|
|
886
|
-
🦆 duckdb
|
|
887
|
-
🍃 mongodb
|
|
888
|
-
🔴 redis
|
|
889
|
-
🔷 valkey
|
|
890
|
-
🏠 clickhouse
|
|
891
|
-
```
|
|
892
|
-
|
|
893
|
-
#### `deps` - Manage client tools
|
|
894
613
|
|
|
895
|
-
|
|
896
|
-
spindb deps check # Check all dependencies
|
|
897
|
-
spindb deps check --engine postgresql # Check specific engine
|
|
898
|
-
spindb deps install # Install missing tools
|
|
899
|
-
spindb deps install --engine mysql # Install for specific engine
|
|
900
|
-
```
|
|
614
|
+
### SQLite & DuckDB
|
|
901
615
|
|
|
902
|
-
|
|
616
|
+
| Format | Extension | Tool | Use Case |
|
|
617
|
+
|--------|-----------|------|----------|
|
|
618
|
+
| SQL | `.sql` | .dump / duckdb | Human-readable |
|
|
619
|
+
| Binary | `.sqlite` / `.duckdb` | File copy | Exact database copy |
|
|
903
620
|
|
|
904
621
|
```bash
|
|
905
|
-
spindb
|
|
906
|
-
spindb
|
|
907
|
-
spindb config update-check on # Enable update notifications
|
|
908
|
-
spindb config update-check off # Disable update notifications
|
|
622
|
+
spindb backup mydb --sql # SQL dump
|
|
623
|
+
spindb backup mydb --dump # Binary copy
|
|
909
624
|
```
|
|
910
625
|
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
```bash
|
|
914
|
-
spindb version
|
|
915
|
-
spindb version --check # Check for updates
|
|
916
|
-
```
|
|
626
|
+
### ClickHouse
|
|
917
627
|
|
|
918
|
-
|
|
628
|
+
| Format | Extension | Tool | Use Case |
|
|
629
|
+
|--------|-----------|------|----------|
|
|
630
|
+
| SQL | `.sql` | clickhouse-client | Plain SQL dump |
|
|
631
|
+
| Native | `.clickhouse` | clickhouse-backup | Native format (future) |
|
|
919
632
|
|
|
920
633
|
```bash
|
|
921
|
-
spindb
|
|
634
|
+
spindb backup mydb --sql # SQL dump
|
|
922
635
|
```
|
|
923
636
|
|
|
924
|
-
|
|
637
|
+
---
|
|
925
638
|
|
|
926
|
-
|
|
927
|
-
spindb doctor # Interactive health check
|
|
928
|
-
spindb doctor --json # JSON output for scripting
|
|
929
|
-
```
|
|
639
|
+
## Advanced Features
|
|
930
640
|
|
|
931
|
-
|
|
932
|
-
- Configuration file validity and binary cache freshness
|
|
933
|
-
- Container status across all engines
|
|
934
|
-
- SQLite registry for orphaned entries (files deleted outside SpinDB)
|
|
935
|
-
- Database tool availability
|
|
641
|
+
### Clone Databases
|
|
936
642
|
|
|
937
|
-
|
|
643
|
+
Create exact copies of existing databases:
|
|
938
644
|
|
|
645
|
+
```bash
|
|
646
|
+
# Clone local database (must be stopped)
|
|
647
|
+
spindb stop production
|
|
648
|
+
spindb clone production staging
|
|
649
|
+
spindb start production
|
|
650
|
+
spindb start staging
|
|
939
651
|
```
|
|
940
|
-
SpinDB Health Check
|
|
941
|
-
═══════════════════
|
|
942
652
|
|
|
943
|
-
|
|
944
|
-
└─ Configuration valid, 12 tools cached
|
|
653
|
+
### Restore from Remote
|
|
945
654
|
|
|
946
|
-
|
|
947
|
-
└─ 4 container(s)
|
|
948
|
-
postgresql: 2 running, 0 stopped
|
|
949
|
-
mysql: 0 running, 1 stopped
|
|
950
|
-
sqlite: 1 exist, 0 missing
|
|
655
|
+
Pull production data into local databases:
|
|
951
656
|
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
657
|
+
```bash
|
|
658
|
+
# Create new database from remote
|
|
659
|
+
spindb create prod-copy --from "postgresql://user:pass@prod-host:5432/production"
|
|
955
660
|
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
Skip (do nothing)
|
|
661
|
+
# Or restore into existing database
|
|
662
|
+
spindb restore mydb --from-url "postgresql://user:pass@prod-host:5432/production"
|
|
959
663
|
```
|
|
960
664
|
|
|
961
|
-
|
|
665
|
+
### Multi-Version Support
|
|
962
666
|
|
|
963
|
-
|
|
667
|
+
Run different versions of the same database simultaneously:
|
|
964
668
|
|
|
965
|
-
|
|
669
|
+
```bash
|
|
670
|
+
# PostgreSQL 14 for legacy app
|
|
671
|
+
spindb create legacy-api --engine postgresql --db-version 14 --port 5432
|
|
966
672
|
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
| PostgreSQL | `psql` | `pgcli` | `usql` |
|
|
970
|
-
| MariaDB | `mariadb` | `mycli` | `usql` |
|
|
971
|
-
| MySQL | `mysql` | `mycli` | `usql` |
|
|
972
|
-
| SQLite | `sqlite3` | `litecli` | `usql` |
|
|
973
|
-
| DuckDB | `duckdb` | - | `usql` |
|
|
974
|
-
| MongoDB | `mongosh` | - | `usql` |
|
|
975
|
-
| Redis | `redis-cli` | `iredis` | - |
|
|
976
|
-
| Valkey | `valkey-cli` | `iredis` | - |
|
|
673
|
+
# PostgreSQL 18 for new app
|
|
674
|
+
spindb create modern-api --engine postgresql --db-version 18 --port 5433
|
|
977
675
|
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
-
|
|
676
|
+
# Both running at the same time
|
|
677
|
+
spindb list
|
|
678
|
+
# NAME ENGINE VERSION PORT STATUS
|
|
679
|
+
# legacy-api postgresql 14 5432 running
|
|
680
|
+
# modern-api postgresql 18 5433 running
|
|
681
|
+
```
|
|
983
682
|
|
|
984
|
-
|
|
683
|
+
### Custom Ports
|
|
985
684
|
|
|
986
|
-
|
|
685
|
+
SpinDB auto-assigns ports, but you can override:
|
|
987
686
|
|
|
988
687
|
```bash
|
|
989
|
-
spindb
|
|
990
|
-
spindb
|
|
991
|
-
spindb connect mydb --install-tui # usql
|
|
688
|
+
spindb create mydb --port 5433
|
|
689
|
+
spindb edit mydb --port 5434 # Change later
|
|
992
690
|
```
|
|
993
691
|
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
## Architecture
|
|
692
|
+
### SQLite & DuckDB Registry
|
|
997
693
|
|
|
998
|
-
|
|
694
|
+
File-based databases can be registered for easy access:
|
|
999
695
|
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
2. Creates an isolated data directory at `~/.spindb/containers/{engine}/{name}/`
|
|
1004
|
-
3. Runs the database as a native process on your machine
|
|
1005
|
-
|
|
1006
|
-
Each "container" is just:
|
|
1007
|
-
- A configuration file (`container.json`)
|
|
1008
|
-
- A data directory (`data/`)
|
|
1009
|
-
- A log file (`postgres.log`, `mysql.log`, or `mongodb.log`)
|
|
696
|
+
```bash
|
|
697
|
+
# Create and register
|
|
698
|
+
spindb create mydb --engine sqlite --path ./data/app.sqlite
|
|
1010
699
|
|
|
1011
|
-
|
|
700
|
+
# Attach existing database
|
|
701
|
+
spindb attach ./existing/data.sqlite --name legacy-db
|
|
1012
702
|
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
```
|
|
1016
|
-
~/.spindb/
|
|
1017
|
-
├── bin/ # Downloaded server binaries
|
|
1018
|
-
│ └── postgresql-18.1.0-darwin-arm64/ # ~45 MB per version
|
|
1019
|
-
├── containers/
|
|
1020
|
-
│ ├── postgresql/
|
|
1021
|
-
│ │ └── mydb/
|
|
1022
|
-
│ │ ├── container.json # Configuration
|
|
1023
|
-
│ │ ├── data/ # Database files
|
|
1024
|
-
│ │ └── postgres.log # Server logs
|
|
1025
|
-
│ └── mysql/
|
|
1026
|
-
│ └── mydb/
|
|
1027
|
-
│ ├── container.json
|
|
1028
|
-
│ ├── data/
|
|
1029
|
-
│ └── mysql.log
|
|
1030
|
-
├── logs/ # Error logs
|
|
1031
|
-
└── config.json # Tool paths cache
|
|
1032
|
-
|
|
1033
|
-
# SQLite databases are stored in project directories, not ~/.spindb/
|
|
1034
|
-
./myproject/
|
|
1035
|
-
└── mydb.sqlite # Created with: spindb create mydb -e sqlite
|
|
703
|
+
# Detach (removes from registry, keeps file)
|
|
704
|
+
spindb detach legacy-db
|
|
1036
705
|
```
|
|
1037
706
|
|
|
1038
|
-
### Data Persistence
|
|
1039
|
-
|
|
1040
|
-
SpinDB runs databases as **native processes** on your machine. When you start a container:
|
|
1041
|
-
|
|
1042
|
-
1. SpinDB launches the database server binary (`pg_ctl start` or `mysqld`)
|
|
1043
|
-
2. The server binds to `127.0.0.1` on your configured port
|
|
1044
|
-
3. A PID file tracks the running process
|
|
1045
|
-
4. Logs are written to the container's log file
|
|
1046
|
-
|
|
1047
|
-
When you stop a container:
|
|
1048
|
-
|
|
1049
|
-
1. SpinDB sends a graceful shutdown signal
|
|
1050
|
-
2. The database flushes pending writes to disk
|
|
1051
|
-
3. The PID file is removed
|
|
1052
|
-
4. Your data remains in the `data/` directory
|
|
1053
|
-
|
|
1054
|
-
**Your data is never deleted unless you explicitly delete the container.**
|
|
1055
|
-
|
|
1056
|
-
#### Persistence by Engine
|
|
1057
|
-
|
|
1058
|
-
Each database engine has its own persistence mechanism:
|
|
1059
|
-
|
|
1060
|
-
| Engine | Mechanism | Durability |
|
|
1061
|
-
|--------|-----------|------------|
|
|
1062
|
-
| PostgreSQL | Write-Ahead Logging (WAL) | Every commit is immediately durable |
|
|
1063
|
-
| MariaDB | InnoDB transaction logs | Every commit is immediately durable |
|
|
1064
|
-
| MySQL | InnoDB transaction logs | Every commit is immediately durable |
|
|
1065
|
-
| SQLite | File-based transactions | Every commit is immediately durable |
|
|
1066
|
-
| MongoDB | WiredTiger with journaling | Writes journaled before acknowledged |
|
|
1067
|
-
| Redis | RDB snapshots | Periodic snapshots (see below) |
|
|
1068
|
-
|
|
1069
|
-
**PostgreSQL, MariaDB, MySQL, MongoDB:** These engines use transaction logs or journaling. Every committed write is guaranteed to survive a crash or unexpected shutdown.
|
|
1070
|
-
|
|
1071
|
-
**SQLite:** As a file-based database, SQLite writes directly to disk on each commit. No server process means no risk of losing in-flight data.
|
|
1072
|
-
|
|
1073
|
-
**Redis:** SpinDB configures Redis with RDB (Redis Database) snapshots:
|
|
1074
|
-
- Save after 900 seconds if at least 1 key changed
|
|
1075
|
-
- Save after 300 seconds if at least 10 keys changed
|
|
1076
|
-
- Save after 60 seconds if at least 10,000 keys changed
|
|
1077
|
-
|
|
1078
|
-
This means Redis may lose up to ~60 seconds of writes on an unexpected crash. For local development, this trade-off (speed over strict durability) is typically acceptable. If you need stronger guarantees, use `spindb backup` before stopping work.
|
|
1079
|
-
|
|
1080
|
-
### Binary Sources
|
|
1081
|
-
|
|
1082
|
-
**PostgreSQL:** Server binaries are downloaded automatically:
|
|
1083
|
-
- **macOS/Linux:** From [hostdb](https://github.com/robertjbass/hostdb) on GitHub Releases
|
|
1084
|
-
- **Windows:** From [EnterpriseDB (EDB)](https://www.enterprisedb.com/download-postgresql-binaries)
|
|
1085
|
-
|
|
1086
|
-
**MariaDB, MySQL, MongoDB, Redis, Valkey:** Server binaries are downloaded automatically from [hostdb](https://github.com/robertjbass/hostdb) on GitHub Releases for all platforms.
|
|
1087
|
-
|
|
1088
|
-
### Why Precompiled Binaries?
|
|
1089
|
-
|
|
1090
|
-
The [hostdb](https://github.com/robertjbass/hostdb) project provides pre-compiled, portable database binaries:
|
|
1091
|
-
|
|
1092
|
-
- Cross-platform (macOS Intel/ARM, Linux x64/ARM, Windows x64)
|
|
1093
|
-
- Hosted on GitHub Releases (highly reliable CDN)
|
|
1094
|
-
- ~45-200 MB per version depending on engine
|
|
1095
|
-
- Actively maintained with new database releases
|
|
1096
|
-
|
|
1097
|
-
This makes multi-version support trivial: need PostgreSQL 14 for a legacy project and 18 for a new one? Need MongoDB 7.0 and 8.0? Redis 7 and 8? SpinDB downloads them all, and they run side-by-side without conflicts.
|
|
1098
|
-
|
|
1099
|
-
---
|
|
1100
|
-
|
|
1101
|
-
## Limitations
|
|
1102
|
-
|
|
1103
|
-
- **Local only** - Databases bind to `127.0.0.1`; remote connections planned for v1.1
|
|
1104
|
-
- **Redis remote dump not supported** - Redis doesn't support creating containers from remote connection strings. Use backup/restore for data migration.
|
|
1105
|
-
|
|
1106
707
|
---
|
|
1107
708
|
|
|
1108
709
|
## Roadmap
|
|
1109
710
|
|
|
1110
|
-
See [TODO.md](TODO.md) for the
|
|
711
|
+
See [TODO.md](TODO.md) for the complete roadmap.
|
|
1111
712
|
|
|
1112
713
|
### v1.1 - Remote Connections & Secrets
|
|
1113
|
-
-
|
|
714
|
+
- Direct remote database connections (`spindb connect --remote`)
|
|
1114
715
|
- Environment variable support in connection strings
|
|
1115
|
-
- Secrets management
|
|
716
|
+
- Secrets management with macOS Keychain integration
|
|
1116
717
|
|
|
1117
718
|
### v1.2 - Additional Engines
|
|
1118
|
-
- CockroachDB
|
|
719
|
+
- **CockroachDB** - Distributed PostgreSQL-compatible database
|
|
720
|
+
- **FerretDB** - MongoDB-compatible database built on PostgreSQL
|
|
1119
721
|
|
|
1120
722
|
### v1.3 - Advanced Features
|
|
1121
|
-
- Container templates
|
|
1122
|
-
- Scheduled backups
|
|
1123
|
-
- Import from Docker
|
|
723
|
+
- Container templates for common configurations
|
|
724
|
+
- Scheduled automated backups
|
|
725
|
+
- Import databases from Docker containers
|
|
1124
726
|
|
|
1125
|
-
### Future
|
|
1126
|
-
- **hostdb npm package**: Available database versions will be published as an npm package from [hostdb](https://github.com/robertjbass/hostdb) and imported into SpinDB, eliminating the need to manually sync version-maps.ts with releases.json
|
|
1127
|
-
- **pnpm 10 upgrade**: Currently pinned to pnpm 9.x (`packageManager` in package.json and Docker). Consider upgrading to pnpm 10.x when stable—requires updating package.json, Dockerfile, regenerating pnpm-lock.yaml, and testing for lockfile format changes
|
|
727
|
+
### Future Engines Under Consideration
|
|
1128
728
|
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
These engines are under consideration but not yet on the roadmap. Community interest and feasibility will determine priority:
|
|
729
|
+
The following engines may be added based on community interest:
|
|
1132
730
|
|
|
1133
731
|
| Engine | Type | Notes |
|
|
1134
732
|
|--------|------|-------|
|
|
1135
|
-
| **libSQL** | Embedded relational | SQLite fork
|
|
1136
|
-
| **Meilisearch** | Search engine | Developer-friendly search
|
|
1137
|
-
| **
|
|
1138
|
-
| **
|
|
1139
|
-
| **
|
|
733
|
+
| **libSQL** | Embedded relational | SQLite fork with replication |
|
|
734
|
+
| **Meilisearch** | Search engine | Developer-friendly full-text search |
|
|
735
|
+
| **OpenSearch** | Search engine | Elasticsearch alternative |
|
|
736
|
+
| **InfluxDB** | Time-series | Metrics and IoT data |
|
|
737
|
+
| **Neo4j** | Graph database | Relationships and network data |
|
|
738
|
+
|
|
739
|
+
---
|
|
740
|
+
|
|
741
|
+
## Limitations
|
|
742
|
+
|
|
743
|
+
- **Local only** - Databases bind to `127.0.0.1`. Remote connection support planned for v1.1.
|
|
744
|
+
- **ClickHouse Windows** - Not supported (hostdb doesn't build for Windows).
|
|
745
|
+
- **Redis/Valkey remote dump** - Cannot create containers directly from remote connection strings. Use backup/restore workflow instead.
|
|
1140
746
|
|
|
1141
747
|
---
|
|
1142
748
|
|
|
1143
749
|
## Troubleshooting
|
|
1144
750
|
|
|
1145
|
-
### Port
|
|
751
|
+
### Port Already in Use
|
|
1146
752
|
|
|
1147
|
-
SpinDB automatically finds
|
|
753
|
+
SpinDB automatically finds available ports, but you can specify:
|
|
1148
754
|
|
|
1149
755
|
```bash
|
|
1150
756
|
spindb create mydb --port 5433
|
|
1151
757
|
```
|
|
1152
758
|
|
|
1153
|
-
###
|
|
759
|
+
### Container Won't Start
|
|
1154
760
|
|
|
1155
|
-
|
|
761
|
+
Check the logs:
|
|
1156
762
|
|
|
1157
763
|
```bash
|
|
1158
|
-
spindb
|
|
764
|
+
spindb logs mydb
|
|
1159
765
|
# or
|
|
1160
|
-
spindb
|
|
766
|
+
cat ~/.spindb/containers/postgresql/mydb/postgres.log
|
|
1161
767
|
```
|
|
1162
768
|
|
|
1163
|
-
###
|
|
769
|
+
### Client Tool Not Found
|
|
1164
770
|
|
|
1165
|
-
|
|
771
|
+
Install dependencies:
|
|
1166
772
|
|
|
1167
773
|
```bash
|
|
1168
|
-
spindb
|
|
1169
|
-
|
|
1170
|
-
cat ~/.spindb/containers/postgresql/mydb/postgres.log
|
|
774
|
+
spindb deps install
|
|
775
|
+
spindb deps check
|
|
1171
776
|
```
|
|
1172
777
|
|
|
1173
|
-
###
|
|
778
|
+
### Binary Download Fails
|
|
779
|
+
|
|
780
|
+
SpinDB downloads from [hostdb GitHub Releases](https://github.com/robertjbass/hostdb/releases). If downloads fail:
|
|
781
|
+
|
|
782
|
+
1. Check your internet connection
|
|
783
|
+
2. Verify GitHub isn't blocked by your firewall
|
|
784
|
+
3. Try again (SpinDB has automatic retry logic)
|
|
785
|
+
|
|
786
|
+
### Reset Everything
|
|
1174
787
|
|
|
1175
788
|
```bash
|
|
1176
789
|
rm -rf ~/.spindb
|
|
1177
790
|
```
|
|
1178
791
|
|
|
792
|
+
This deletes all containers, binaries, and configuration. Use with caution.
|
|
793
|
+
|
|
1179
794
|
---
|
|
1180
795
|
|
|
1181
796
|
## Contributing
|
|
1182
797
|
|
|
1183
|
-
|
|
798
|
+
We welcome contributions! SpinDB is built with:
|
|
799
|
+
|
|
800
|
+
- **Runtime:** Node.js 18+ with TypeScript
|
|
801
|
+
- **Execution:** `tsx` for direct TypeScript execution
|
|
802
|
+
- **Package Manager:** pnpm (strictly enforced)
|
|
803
|
+
- **CLI Framework:** Commander.js
|
|
804
|
+
- **Interactive UI:** Inquirer.js, Chalk, Ora
|
|
1184
805
|
|
|
1185
|
-
See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup
|
|
806
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and testing guidelines.
|
|
1186
807
|
|
|
1187
|
-
See [ARCHITECTURE.md](ARCHITECTURE.md) for project architecture
|
|
808
|
+
See [ARCHITECTURE.md](ARCHITECTURE.md) for project architecture details.
|
|
1188
809
|
|
|
1189
810
|
See [CLAUDE.md](CLAUDE.md) for AI-assisted development context.
|
|
1190
811
|
|
|
1191
|
-
See [
|
|
812
|
+
See [FEATURE.md](FEATURE.md) for adding new database engines.
|
|
1192
813
|
|
|
1193
814
|
---
|
|
1194
815
|
|
|
1195
816
|
## Acknowledgments
|
|
1196
817
|
|
|
1197
|
-
SpinDB
|
|
818
|
+
SpinDB is powered by:
|
|
1198
819
|
|
|
1199
|
-
- **[hostdb](https://github.com/robertjbass/hostdb)** - Pre-compiled database binaries
|
|
820
|
+
- **[hostdb](https://github.com/robertjbass/hostdb)** - Pre-compiled database binaries for 9 engines across all major platforms. Makes Docker-free multi-version database support possible.
|
|
1200
821
|
|
|
1201
822
|
---
|
|
1202
823
|
|
|
@@ -1204,9 +825,26 @@ SpinDB wouldn't be possible without:
|
|
|
1204
825
|
|
|
1205
826
|
[PolyForm Noncommercial 1.0.0](LICENSE)
|
|
1206
827
|
|
|
1207
|
-
SpinDB is free for:
|
|
828
|
+
SpinDB is **free** for:
|
|
1208
829
|
- Personal use and hobby projects
|
|
1209
|
-
- Educational and
|
|
1210
|
-
-
|
|
830
|
+
- Educational institutions and students
|
|
831
|
+
- Academic and scientific research
|
|
832
|
+
- Nonprofit organizations
|
|
833
|
+
- Government agencies
|
|
834
|
+
|
|
835
|
+
**Commercial use requires a separate license.** For commercial licensing inquiries, please open an issue or contact the maintainer.
|
|
836
|
+
|
|
837
|
+
---
|
|
838
|
+
|
|
839
|
+
## Links
|
|
840
|
+
|
|
841
|
+
- **GitHub:** [github.com/robertjbass/spindb](https://github.com/robertjbass/spindb)
|
|
842
|
+
- **npm:** [npmjs.com/package/spindb](https://www.npmjs.com/package/spindb)
|
|
843
|
+
- **hostdb:** [github.com/robertjbass/hostdb](https://github.com/robertjbass/hostdb)
|
|
844
|
+
- **Issues:** [github.com/robertjbass/spindb/issues](https://github.com/robertjbass/spindb/issues)
|
|
845
|
+
|
|
846
|
+
---
|
|
847
|
+
|
|
848
|
+
**Questions? Found a bug? Have a feature request?**
|
|
1211
849
|
|
|
1212
|
-
|
|
850
|
+
Open an issue: [github.com/robertjbass/spindb/issues](https://github.com/robertjbass/spindb/issues)
|