vibesql-micro 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,334 @@
1
+ # vibesql-micro
2
+
3
+ PostgreSQL + JSONB + HTTP API in one command.
4
+
5
+ ---
6
+
7
+ ## What is this?
8
+
9
+ `vibesql-micro` is a lightweight database server for local development with **embedded PostgreSQL 16.1**.
10
+
11
+ - **PostgreSQL-based** — Full PostgreSQL 16.1 embedded in a single binary
12
+ - **Native JSONB** — Real PostgreSQL JSONB support, not an extension
13
+ - **HTTP API** — Query via curl, Postman, or any HTTP client
14
+ - **Single command** — `npx vibesql-micro` and you're running
15
+ - **Zero config** — No installation, no setup, no Docker
16
+
17
+ Perfect for prototyping, testing, and local development.
18
+
19
+ ---
20
+
21
+ ## Quick Start
22
+
23
+ ```bash
24
+ npx vibesql-micro
25
+ # → Running at http://localhost:5173
26
+ ```
27
+
28
+ Query your database:
29
+
30
+ ```bash
31
+ curl -X POST http://localhost:5173/v1/query \
32
+ -H "Content-Type: application/json" \
33
+ -d '{"sql": "SELECT * FROM users LIMIT 10"}'
34
+ ```
35
+
36
+ ---
37
+
38
+ ## Installation
39
+
40
+ ### Windows (Available Now)
41
+
42
+ Download the latest Windows binary from [Releases](https://github.com/PayEz-Net/vibesql-micro/releases):
43
+
44
+ ```bash
45
+ # Download vibesql-micro-windows-x64.exe
46
+ # Run it
47
+ .\vibesql-micro-windows-x64.exe
48
+ # → Running at http://localhost:5173
49
+ ```
50
+
51
+ The server will:
52
+ 1. Auto-create required directories (`<drive>:\share`, `<drive>:\lib`)
53
+ 2. Start PostgreSQL 16.1 on port 5432
54
+ 3. Start HTTP API on port 5173
55
+ 4. Clean up temporary directories on shutdown
56
+
57
+ ### npm (Coming Soon)
58
+
59
+ ```bash
60
+ npx vibesql-micro
61
+ ```
62
+
63
+ Windows, macOS, and Linux support will be available via npm in v1.0.0 final release.
64
+
65
+ ### Configuration
66
+
67
+ Set environment variables:
68
+
69
+ ```bash
70
+ VIBESQL_PORT=5173 # HTTP port (default: 5173)
71
+ VIBESQL_DATA=./vibe-data # Data directory (default: ./vibe-data)
72
+ ```
73
+
74
+ ---
75
+
76
+ ## API Reference
77
+
78
+ ### POST /v1/query
79
+
80
+ Execute SQL queries.
81
+
82
+ **Request:**
83
+
84
+ ```json
85
+ {
86
+ "sql": "SELECT * FROM users WHERE active = 1"
87
+ }
88
+ ```
89
+
90
+ **Response (success):**
91
+
92
+ ```json
93
+ {
94
+ "success": true,
95
+ "data": [
96
+ { "id": 1, "name": "Alice", "email": "alice@example.com" }
97
+ ],
98
+ "meta": {
99
+ "row_count": 1,
100
+ "execution_time_ms": 5
101
+ }
102
+ }
103
+ ```
104
+
105
+ **Response (error):**
106
+
107
+ ```json
108
+ {
109
+ "success": false,
110
+ "error": {
111
+ "code": "SYNTAX_ERROR",
112
+ "message": "near \"FROM\": syntax error"
113
+ }
114
+ }
115
+ ```
116
+
117
+ ---
118
+
119
+ ### GET /v1/health
120
+
121
+ Check server status.
122
+
123
+ **Response:**
124
+
125
+ ```json
126
+ {
127
+ "status": "healthy",
128
+ "version": "1.0.0",
129
+ "database": "postgresql-16.1",
130
+ "uptime_seconds": 3600
131
+ }
132
+ ```
133
+
134
+ ---
135
+
136
+ ## JSONB Queries
137
+
138
+ VibeSQL has **native PostgreSQL JSONB support** — not an extension, the real thing:
139
+
140
+ ```sql
141
+ -- Store JSONB
142
+ INSERT INTO users (data) VALUES ('{"name": "Alice", "tags": ["developer", "golang"]}'::jsonb);
143
+
144
+ -- Query JSONB fields
145
+ SELECT data->>'name' as name FROM users;
146
+
147
+ -- Filter by JSONB
148
+ SELECT * FROM users WHERE data->>'active' = 'true';
149
+
150
+ -- Array operations (native PostgreSQL)
151
+ SELECT * FROM users WHERE jsonb_array_length(data->'tags') > 1;
152
+
153
+ -- JSONB operators (PostgreSQL)
154
+ SELECT * FROM users WHERE data @> '{"active": true}'::jsonb;
155
+ SELECT * FROM users WHERE data ? 'email';
156
+ ```
157
+
158
+ ---
159
+
160
+ ## Use Cases
161
+
162
+ ### Prototyping
163
+
164
+ ```bash
165
+ # Start database
166
+ npx vibesql-micro
167
+
168
+ # Create table and insert data
169
+ curl -X POST http://localhost:5173/v1/query \
170
+ -d '{"sql": "CREATE TABLE todos (id SERIAL PRIMARY KEY, title TEXT, done BOOLEAN DEFAULT false)"}'
171
+
172
+ curl -X POST http://localhost:5173/v1/query \
173
+ -d '{"sql": "INSERT INTO todos (title, done) VALUES ('\''Buy milk'\'', 0)"}'
174
+ ```
175
+
176
+ ### Testing
177
+
178
+ ```javascript
179
+ // test-helper.js
180
+ import { spawn } from 'child_process';
181
+
182
+ export async function startTestDB() {
183
+ const proc = spawn('npx', ['vibesql-micro'], {
184
+ env: { ...process.env, VIBESQL_PORT: 5174 }
185
+ });
186
+
187
+ // Wait for startup
188
+ await new Promise(resolve => setTimeout(resolve, 1000));
189
+
190
+ return proc;
191
+ }
192
+
193
+ export async function stopTestDB(proc) {
194
+ proc.kill();
195
+ }
196
+ ```
197
+
198
+ ### Local Development
199
+
200
+ ```bash
201
+ # Terminal 1: Run database
202
+ npx vibesql-micro
203
+
204
+ # Terminal 2: Run your app
205
+ npm run dev
206
+
207
+ # Your app connects to http://localhost:5173
208
+ ```
209
+
210
+ ---
211
+
212
+ ## Admin UI
213
+
214
+ Want a visual interface? Use [vibesql-admin](https://github.com/PayEz-Net/vibesql-admin):
215
+
216
+ ```bash
217
+ # Terminal 1: Database
218
+ npx vibesql-micro
219
+
220
+ # Terminal 2: Admin UI
221
+ npx vibesql-admin
222
+ # → Opens browser at http://localhost:5174
223
+ ```
224
+
225
+ ---
226
+
227
+ ## Comparison
228
+
229
+ | Feature | VibeSQL Micro | Supabase | Railway/Neon | PlanetScale |
230
+ |---------|---------------|----------|--------------|-------------|
231
+ | Installation | `npx` command | Sign up + API keys | Sign up + deploy | Sign up + configure |
232
+ | Setup time | < 10 seconds | ~5 minutes | ~3 minutes | ~5 minutes |
233
+ | Local dev | ✅ Localhost only | ❌ Cloud sandbox only | ❌ Cloud only | ❌ Cloud only |
234
+ | Cost | ✅ Free (localhost) | Free tier + paid | Free tier + paid | Free tier + paid |
235
+ | PostgreSQL | ✅ Native PostgreSQL 16.1 | ✅ PostgreSQL | ✅ PostgreSQL | ❌ MySQL-compatible |
236
+ | JSONB | ✅ Full support | ✅ Full support | ✅ Full support | ❌ JSON only |
237
+ | Auth built-in | ❌ No* | ✅ Yes | ❌ No | ❌ No |
238
+ | Use case | Local dev, prototyping | Production apps | Production apps | Production apps |
239
+
240
+ **Note:** *VibeSQL Server (production version) includes HMAC authentication and configurable tier limits. See [VibeSQL Server](https://github.com/PayEz-Net/vibesql-server) for production deployments.
241
+
242
+ ---
243
+
244
+ ## Production Use
245
+
246
+ VibeSQL Micro is **production-ready** and battle-tested. Perfect for:
247
+
248
+ - **Edge computing** — AI-enhanced devices, IoT sensors, embedded systems
249
+ - **Local-first apps** — Offline-first applications with sync
250
+ - **Single-tenant deployments** — One database per customer
251
+ - **Development tools** — Build tools, CI/CD pipelines, testing frameworks
252
+ - **Desktop applications** — Electron, Tauri, native apps
253
+
254
+ **Included:**
255
+ - Comprehensive test suite
256
+ - PostgreSQL 16.1 stability and ACID guarantees
257
+ - Built-in safety checks and validation
258
+ - Production-grade reliability
259
+
260
+ **Not included (see VibeSQL Cloud):**
261
+ - Multi-instance replication
262
+ - Managed backups and point-in-time recovery
263
+ - Built-in authentication and authorization
264
+ - Horizontal scaling and load balancing
265
+
266
+ ---
267
+
268
+ ## Development
269
+
270
+ Clone the repo:
271
+
272
+ ```bash
273
+ git clone https://github.com/PayEz-Net/vibesql-micro.git
274
+ cd vibesql-micro
275
+ ```
276
+
277
+ Build:
278
+
279
+ ```bash
280
+ go build -o vibesql-micro ./cmd/server
281
+ ```
282
+
283
+ Run:
284
+
285
+ ```bash
286
+ ./vibesql-micro
287
+ ```
288
+
289
+ Test:
290
+
291
+ ```bash
292
+ go test ./...
293
+ ```
294
+
295
+ ---
296
+
297
+ ## Tech Stack
298
+
299
+ - **Language:** Go
300
+ - **Database:** Embedded PostgreSQL 16.1 (full PostgreSQL, not a fork)
301
+ - **HTTP:** Standard library (`net/http`)
302
+ - **Packaging:** npm (via npx)
303
+ - **Binary size:** ~68MB (includes PostgreSQL binaries)
304
+
305
+ ---
306
+
307
+ ## Contributing
308
+
309
+ Contributions welcome. Open an issue or pull request.
310
+
311
+ ---
312
+
313
+ ## License
314
+
315
+ Apache 2.0 License. See [LICENSE](LICENSE).
316
+
317
+ ---
318
+
319
+ ## Links
320
+
321
+ - **Website:** [vibesql.online](https://vibesql.online)
322
+ - **Admin UI:** [github.com/PayEz-Net/vibesql-admin](https://github.com/PayEz-Net/vibesql-admin)
323
+ - **Docs:** [vibesql.online/docs](https://vibesql.online/docs)
324
+ - **Discord:** [discord.gg/vibesql](https://discord.gg/vibesql)
325
+
326
+ ---
327
+
328
+ Built for developers. Zero config. Just works.
329
+
330
+ ---
331
+
332
+ <div align="right">
333
+ <sub>Powered by <a href="https://idealvibe.online">IdealVibe</a></sub>
334
+ </div>
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const { execFileSync } = require("child_process");
5
+ const path = require("path");
6
+ const fs = require("fs");
7
+
8
+ const ext = process.platform === "win32" ? ".exe" : "";
9
+ const binary = path.join(__dirname, `vibesql-micro${ext}`);
10
+
11
+ if (!fs.existsSync(binary)) {
12
+ console.error("vibesql-micro: binary not found. Run `npm install` or download from:");
13
+ console.error("https://github.com/PayEz-Net/vibesql-micro/releases");
14
+ process.exit(1);
15
+ }
16
+
17
+ try {
18
+ execFileSync(binary, process.argv.slice(2), { stdio: "inherit" });
19
+ } catch (err) {
20
+ process.exit(err.status || 1);
21
+ }
package/index.js ADDED
@@ -0,0 +1,5 @@
1
+ // vibesql-micro
2
+ // This package provides the `vibesql-micro` CLI binary.
3
+ // Use `npx vibesql-micro` or install globally with `npm install -g vibesql-micro`.
4
+ // Docs: https://vibesql.online/docs.html
5
+ module.exports = {};
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "vibesql-micro",
3
+ "version": "1.0.0",
4
+ "description": "PostgreSQL + JSONB + HTTP API in one command. Embedded PostgreSQL 16.1 for edge computing.",
5
+ "main": "index.js",
6
+ "bin": {
7
+ "vibesql-micro": "./bin/vibesql-micro.js",
8
+ "vibe": "./bin/vibesql-micro.js"
9
+ },
10
+ "files": [
11
+ "index.js",
12
+ "bin/vibesql-micro.js",
13
+ "scripts/install.js",
14
+ "README.md",
15
+ "LICENSE"
16
+ ],
17
+ "scripts": {
18
+ "postinstall": "node scripts/install.js"
19
+ },
20
+ "keywords": [
21
+ "database",
22
+ "sql",
23
+ "postgresql",
24
+ "postgres",
25
+ "jsonb",
26
+ "http-api",
27
+ "developer-tools",
28
+ "zero-config",
29
+ "ai",
30
+ "vibesql"
31
+ ],
32
+ "author": "PayEz <opensource@payez.net>",
33
+ "license": "Apache-2.0",
34
+ "homepage": "https://vibesql.online",
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "https://github.com/PayEz-Net/vibesql-micro.git"
38
+ },
39
+ "bugs": {
40
+ "url": "https://github.com/PayEz-Net/vibesql-micro/issues"
41
+ },
42
+ "engines": {
43
+ "node": ">=14.0.0"
44
+ }
45
+ }
@@ -0,0 +1,95 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const https = require("https");
5
+ const fs = require("fs");
6
+ const path = require("path");
7
+ const { execSync } = require("child_process");
8
+
9
+ const VERSION = "1.0.0";
10
+ const REPO = "PayEz-Net/vibesql-micro";
11
+ const BIN_DIR = path.join(__dirname, "..", "bin");
12
+
13
+ const PLATFORM_MAP = {
14
+ "win32-x64": "vibesql-micro-windows-x64.exe",
15
+ "linux-x64": "vibesql-micro-linux-x64",
16
+ "darwin-x64": "vibesql-micro-macos-amd64",
17
+ // "darwin-arm64": "vibesql-micro-macos-arm64", // TODO: build on Apple Silicon Mac
18
+ };
19
+
20
+ const platform = process.platform;
21
+ const arch = process.arch;
22
+ const key = `${platform}-${arch}`;
23
+ const binaryName = PLATFORM_MAP[key];
24
+
25
+ if (!binaryName) {
26
+ console.error(`vibesql-micro: unsupported platform ${key}`);
27
+ console.error(`Supported: ${Object.keys(PLATFORM_MAP).join(", ")}`);
28
+ console.error("macOS support coming soon. See https://github.com/PayEz-Net/vibesql-micro/releases");
29
+ process.exit(1);
30
+ }
31
+
32
+ const dest = path.join(BIN_DIR, platform === "win32" ? "vibesql-micro.exe" : "vibesql-micro");
33
+ const url = `https://github.com/${REPO}/releases/download/v${VERSION}/${binaryName}`;
34
+
35
+ if (fs.existsSync(dest)) {
36
+ console.log("vibesql-micro: binary already exists, skipping download");
37
+ process.exit(0);
38
+ }
39
+
40
+ fs.mkdirSync(BIN_DIR, { recursive: true });
41
+
42
+ console.log(`vibesql-micro: downloading ${binaryName} for ${key}...`);
43
+
44
+ function download(url, dest, redirects) {
45
+ if (redirects > 5) {
46
+ console.error("vibesql-micro: too many redirects");
47
+ process.exit(1);
48
+ }
49
+
50
+ const proto = url.startsWith("https") ? https : require("http");
51
+ proto.get(url, { headers: { "User-Agent": "vibesql-micro-npm" } }, (res) => {
52
+ if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
53
+ download(res.headers.location, dest, redirects + 1);
54
+ return;
55
+ }
56
+
57
+ if (res.statusCode !== 200) {
58
+ console.error(`vibesql-micro: download failed (HTTP ${res.statusCode})`);
59
+ console.error(`URL: ${url}`);
60
+ console.error("Download manually from: https://github.com/PayEz-Net/vibesql-micro/releases");
61
+ process.exit(1);
62
+ }
63
+
64
+ const file = fs.createWriteStream(dest);
65
+ let downloaded = 0;
66
+ const total = parseInt(res.headers["content-length"], 10) || 0;
67
+
68
+ res.on("data", (chunk) => {
69
+ downloaded += chunk.length;
70
+ if (total > 0) {
71
+ const pct = Math.round((downloaded / total) * 100);
72
+ process.stdout.write(`\rvibesql-micro: ${pct}% (${Math.round(downloaded / 1024 / 1024)}MB)`);
73
+ }
74
+ });
75
+
76
+ res.pipe(file);
77
+
78
+ file.on("finish", () => {
79
+ file.close();
80
+ console.log("");
81
+
82
+ if (platform !== "win32") {
83
+ fs.chmodSync(dest, 0o755);
84
+ }
85
+
86
+ console.log(`vibesql-micro: installed to ${dest}`);
87
+ });
88
+ }).on("error", (err) => {
89
+ console.error(`vibesql-micro: download error: ${err.message}`);
90
+ console.error("Download manually from: https://github.com/PayEz-Net/vibesql-micro/releases");
91
+ process.exit(1);
92
+ });
93
+ }
94
+
95
+ download(url, dest, 0);