sql-kite 1.0.0 → 1.0.2

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.
Files changed (2) hide show
  1. package/README.md +434 -0
  2. package/package.json +3 -2
package/README.md ADDED
@@ -0,0 +1,434 @@
1
+ <p align="center">
2
+ <img src="https://img.shields.io/badge/SQLite-Local--First-blue?style=for-the-badge&logo=sqlite" />
3
+ <img src="https://img.shields.io/badge/Node.js-18+-339933?style=for-the-badge&logo=node.js&logoColor=white" />
4
+ <img src="https://img.shields.io/badge/Offline-No%20Cloud%20Required-111827?style=for-the-badge" />
5
+ <img src="https://img.shields.io/badge/Zero%20Telemetry-Privacy%20Respecting-10b981?style=for-the-badge" />
6
+ <img src="https://img.shields.io/badge/License-MIT-f59e0b?style=for-the-badge" />
7
+ </p>
8
+
9
+ <h1 align="center">SQL Kite</h1>
10
+
11
+ <p align="center">
12
+ <strong>Version-controlled SQLite for local development.</strong>
13
+ </p>init
14
+
15
+ <p align="center">
16
+ Branch your database. Inspect every change. Recover instantly.<br/>
17
+ <b>No cloud • No accounts • No telemetry</b>
18
+ </p>
19
+
20
+ ---
21
+
22
+ <p align="center">
23
+ <a href="#quick-start">Quick Start</a> •
24
+ <a href="#features">Features</a> •
25
+ <a href="#installation">Installation</a> •
26
+ <a href="#security-model">Security</a> •
27
+ <a href="#architecture">Architecture</a>
28
+ </p>
29
+
30
+ ---
31
+
32
+ ## What is SQL Kite?
33
+
34
+ SQL Kite is a **local-first database workspace** that brings Git-style workflows to SQLite.
35
+
36
+ Instead of treating a `.db` file as a fragile binary blob, SQL Kite turns it into a managed project.
37
+
38
+ > Think of it as **Git for your SQLite database** — but purpose-built for development workflows.
39
+
40
+ You can experiment freely because every change is recorded and reversible.
41
+
42
+ ---
43
+
44
+ ## Why this exists
45
+
46
+ During development, SQLite databases usually turn into this:
47
+
48
+ ```
49
+ app.db
50
+ app_v2.db
51
+ app_new_final.db
52
+ app_new_final_real.db
53
+ app_new_final_real_fixed.db
54
+ ```
55
+
56
+ No history. No reproducibility. No safety.
57
+
58
+ SQL Kite fixes that.
59
+
60
+ > Code has Git. Databases should too.
61
+
62
+ ---
63
+
64
+ ## The Idea (in 10 seconds)
65
+
66
+ Without SQL Kite:
67
+
68
+ ```
69
+ schema.sql
70
+ app.db
71
+ backup.db
72
+ backup2.db
73
+ backup3.db
74
+ ```
75
+
76
+ With SQL Kite:
77
+
78
+ ```
79
+ main
80
+ ├── feature/auth-system
81
+ ├── testing/seed-data
82
+ └── experiment/new-schema
83
+ ```
84
+
85
+ You stop copying files.
86
+ You start managing database environments.
87
+
88
+ ---
89
+
90
+ <a name="features"></a>
91
+
92
+ ## Features
93
+
94
+ | Capability | What it gives you |
95
+ | -------------- | ------------------------------------- |
96
+ | **Branching** | Isolated DB environments for features |
97
+ | **Timeline** | Full history of SQL operations |
98
+ | **Snapshots** | Instant recovery points |
99
+ | **Migrations** | Structured schema evolution |
100
+ | **Studio UI** | Visual database explorer |
101
+ | **Import** | Adopt any existing SQLite database |
102
+
103
+ ---
104
+
105
+ ### Database Branching
106
+
107
+ Create independent database branches instantly.
108
+
109
+ You can test migrations, destructive queries, or new schemas safely.
110
+
111
+ ---
112
+
113
+ ### Timeline History
114
+
115
+ Every SQL statement is recorded.
116
+
117
+ You can inspect **who changed what and when**.
118
+
119
+ ---
120
+
121
+ ### Snapshots & Restore
122
+
123
+ Before risky operations, create a snapshot.
124
+
125
+ Restore in seconds.
126
+
127
+ > You can always go back.
128
+
129
+ ---
130
+
131
+ ### Studio UI
132
+
133
+ A clean local interface for:
134
+
135
+ * Browsing tables
136
+ * Editing rows
137
+ * Running queries
138
+ * Comparing branches
139
+ * Viewing database events
140
+
141
+ ---
142
+
143
+ ## Zero-Cloud Architecture
144
+
145
+ SQL Kite runs **entirely on your machine**.
146
+
147
+ * No remote servers
148
+ * No login
149
+ * No tracking
150
+ * No telemetry
151
+ * No internet required
152
+
153
+ > Your database never leaves your computer.
154
+
155
+ ---
156
+
157
+ <a name="installation"></a>
158
+
159
+ ## Installation
160
+
161
+ ### Requirements
162
+
163
+ * Node.js 18+
164
+ * npm
165
+
166
+ ### Install
167
+
168
+ ```bash
169
+ npm install -g sql-kite
170
+ ```
171
+
172
+ ---
173
+
174
+ <a name="quick-start"></a>
175
+
176
+ ## Quick Start
177
+
178
+ ### 1) Create a project
179
+
180
+ ```bash
181
+ npm run sql-kite new my-db
182
+ ```
183
+
184
+ ### 2) Start the studio
185
+
186
+ ```bash
187
+ npm run sql-kite start my-db
188
+ ```
189
+
190
+ Your browser opens automatically.
191
+
192
+ ---
193
+
194
+ ### Import an existing database
195
+
196
+ ```bash
197
+ npm run sql-kite import ./database.db
198
+ ```
199
+
200
+ > SQL Kite will safely adopt the file into a managed workspace.
201
+
202
+ ---
203
+
204
+ ## CLI Commands
205
+
206
+ | Command | Description |
207
+ | ---------------------------------- | --------------- |
208
+ | `npm run sql-kite new <name>` | Create project |
209
+ | `npm run sql-kite import <path>` | Import database |
210
+ | `npm run sql-kite start <name>` | Launch Studio |
211
+ | `npm run sql-kite stop <name>` | Stop server |
212
+ | `npm run sql-kite open <name>` | Open UI |
213
+ | `npm run sql-kite list` | List projects |
214
+ | `npm run sql-kite delete <name>` | Remove project |
215
+ | `npm run sql-kite ports` | Show port usage |
216
+ | `npm run sql-kite init` | Scaffold app database layer |
217
+
218
+ ---
219
+
220
+ ## App Integration
221
+
222
+ ### For React Native / Expo Apps
223
+
224
+ SQL Kite provides a database integration layer with automatic dev/production switching.
225
+
226
+ **1) Scaffold the integration:**
227
+
228
+ ```bash
229
+ cd your-app-project
230
+ npm run sql-kite init
231
+ ```
232
+
233
+ This creates:
234
+ ```
235
+ lib/database/
236
+ ├── index.js
237
+ ├── engine.dev.js
238
+ └── engine.local.js
239
+ ```
240
+
241
+ **2) Use in your app:**
242
+
243
+ ```javascript
244
+ import { runQuery } from '@/lib/database';
245
+
246
+ const users = await runQuery("SELECT * FROM users WHERE active = ?", [1]);
247
+ ```
248
+
249
+ ### Two Workflow Modes
250
+
251
+ **Development Mode:**
252
+ - Queries go to SQL-Kite server via HTTP
253
+ - API is locked to `main` branch only
254
+ - Switch branches freely in Studio - your app stays isolated
255
+ - Configure port via `SQL_KITE_PORT` env variable
256
+
257
+ **Production Mode:**
258
+ - Queries run locally via expo-sqlite
259
+ - Export `main.db` from SQL-Kite UI
260
+ - Bundle it with your app
261
+ - No server required
262
+
263
+ ### Why This Architecture?
264
+
265
+ **Same code. Different engine.**
266
+
267
+ ```javascript
268
+ // This works everywhere
269
+ runQuery("SELECT * FROM users")
270
+
271
+ // Development → HTTP to SQL-Kite
272
+ // Production → Local SQLite
273
+ ```
274
+
275
+ Your app never knows:
276
+ - That branches exist
277
+ - That you're switching between dev/prod
278
+ - About SQL-Kite's internal tooling
279
+
280
+ > Clean separation between development tools and runtime code.
281
+
282
+ ---
283
+
284
+ ## Project Structure
285
+
286
+ ```
287
+ ~/.sql-kite/runtime/<project>/
288
+ ```
289
+
290
+ ```
291
+ project/
292
+ ├── db.sqlite
293
+ ├── config.json
294
+ ├── migrations/
295
+ ├── snapshots/
296
+ └── .studio/
297
+ ├── meta.db
298
+ ├── server.json
299
+ └── locks/
300
+ ```
301
+
302
+ ---
303
+
304
+ <a name="security-model"></a>
305
+
306
+ ## Security Model
307
+
308
+ SQL Kite is intentionally restrictive.
309
+
310
+ ### Localhost Only
311
+
312
+ The server binds only to:
313
+
314
+ ```
315
+ http://localhost
316
+ http://127.0.0.1
317
+ ```
318
+
319
+ It is never publicly accessible.
320
+
321
+ ### No Elevated Permissions
322
+
323
+ Runs with normal user privileges.
324
+ No root required.
325
+
326
+ ### Filesystem Protection
327
+
328
+ * Validates project paths
329
+ * Blocks traversal
330
+ * Rejects symlinks
331
+
332
+ ### Local Data Storage
333
+
334
+ All data lives inside:
335
+
336
+ ```
337
+ ~/.sql-kite/
338
+ ```
339
+
340
+ > SQL Kite cannot access anything outside its workspace.
341
+
342
+ ---
343
+
344
+ ## Development
345
+
346
+ Run services individually:
347
+
348
+ ```bash
349
+ npm run dev:cli
350
+ npm run dev:server
351
+ npm run dev:studio
352
+ ```
353
+
354
+ Build UI:
355
+
356
+ ```bash
357
+ npm run build:studio
358
+ ```
359
+
360
+ ---
361
+
362
+ <a name="architecture"></a>
363
+
364
+ ## Architecture
365
+
366
+ | Package | Tech | Purpose |
367
+ | ------- | ------------------- | --------- |
368
+ | cli | Node.js + Commander | CLI |
369
+ | server | Fastify | Local API |
370
+ | studio | Next.js + React | UI |
371
+
372
+ ### Tech Stack
373
+
374
+ * SQLite (better-sqlite3)
375
+ * Fastify
376
+ * Next.js
377
+ * React
378
+ * Tailwind CSS
379
+ * Monaco Editor
380
+
381
+ ---
382
+
383
+ ## Troubleshooting
384
+
385
+ ### Port in use
386
+
387
+ ```bash
388
+ npm run sql-kite ports
389
+ ```
390
+
391
+ ### Restart project
392
+
393
+ ```bash
394
+ npm run sql-kite stop my-db
395
+ npm run sql-kite start my-db
396
+ ```
397
+
398
+ ### Import fails
399
+
400
+ Check:
401
+
402
+ * Valid SQLite file
403
+ * Read permissions
404
+ * Not a symlink
405
+
406
+ ---
407
+
408
+ ## Contributing
409
+
410
+ PRs welcome.
411
+
412
+ 1. Fork
413
+ 2. Branch
414
+ 3. Commit
415
+ 4. Pull Request
416
+
417
+ ---
418
+
419
+ ## License
420
+
421
+ MIT
422
+
423
+ ---
424
+
425
+ ## Author
426
+
427
+ **D Krishna**
428
+ https://github.com/Ananta-V
429
+
430
+ ---
431
+
432
+ <p align="center">
433
+ Built for developers who prefer tools they can trust.
434
+ </p>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sql-kite",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "SQL-Kite CLI — Local-first SQLite workspace with branches, migrations and snapshots.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -35,7 +35,8 @@
35
35
  },
36
36
  "files": [
37
37
  "bin/",
38
- "src/"
38
+ "src/",
39
+ "README.md"
39
40
  ],
40
41
  "dependencies": {
41
42
  "better-sqlite3": "^9.2.2",