sqlite-hub 0.17.0 → 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.
Files changed (83) hide show
  1. package/README.md +101 -19
  2. package/bin/sqlite-hub.js +83 -401
  3. package/examples/api/queries.js +31 -0
  4. package/examples/api/rows.js +27 -0
  5. package/frontend/assets/mockups/charts_1_bars_1200.webp +0 -0
  6. package/frontend/assets/mockups/charts_2_pie_1200.webp +0 -0
  7. package/frontend/assets/mockups/charts_3_scatter_plot_1200.webp +0 -0
  8. package/frontend/assets/mockups/connections_1200.webp +0 -0
  9. package/frontend/assets/mockups/data_1_1200.webp +0 -0
  10. package/frontend/assets/mockups/data_2_row_editor_1200.webp +0 -0
  11. package/frontend/assets/mockups/documents_1200.webp +0 -0
  12. package/frontend/assets/mockups/media_tagging_1_setup_1200.webp +0 -0
  13. package/frontend/assets/mockups/media_tagging_2_tagging_queue_1200.webp +0 -0
  14. package/frontend/assets/mockups/media_tagging_3_media_viewer_1200.webp +0 -0
  15. package/frontend/assets/mockups/overview_1200.webp +0 -0
  16. package/frontend/assets/mockups/settings_1200.webp +0 -0
  17. package/frontend/assets/mockups/sql_editor_1_1200.webp +0 -0
  18. package/frontend/assets/mockups/sql_editor_2_query_details_1200.webp +0 -0
  19. package/frontend/assets/mockups/sql_editor_3_export_column_1200.webp +0 -0
  20. package/frontend/assets/mockups/sql_editor_4_export_column_as_markdown_1200.webp +0 -0
  21. package/frontend/assets/mockups/sql_editor_5_export_query_result_1200.webp +0 -0
  22. package/frontend/assets/mockups/structure_1_1200.webp +0 -0
  23. package/frontend/assets/mockups/structure_2_inspector_1200.webp +0 -0
  24. package/frontend/assets/mockups/table_designer_1_1200.webp +0 -0
  25. package/frontend/assets/mockups/table_designer_2_checks_1200.webp +0 -0
  26. package/frontend/js/api.js +25 -0
  27. package/frontend/js/app.js +183 -26
  28. package/frontend/js/components/formControls.js +38 -0
  29. package/frontend/js/components/modal.js +79 -19
  30. package/frontend/js/components/queryResults.js +18 -1
  31. package/frontend/js/components/rowEditorPanel.js +42 -34
  32. package/frontend/js/store.js +129 -2
  33. package/frontend/js/utils/jsonPreview.js +31 -0
  34. package/frontend/js/utils/rowEditorValues.js +41 -0
  35. package/frontend/js/utils/tableScrollState.js +39 -0
  36. package/frontend/js/views/charts.js +8 -0
  37. package/frontend/js/views/data.js +4 -1
  38. package/frontend/js/views/editor.js +2 -0
  39. package/frontend/js/views/settings.js +141 -5
  40. package/frontend/styles/components.css +6 -0
  41. package/frontend/styles/tailwind.generated.css +2 -2
  42. package/package.json +6 -6
  43. package/server/middleware/apiTokenAuth.js +30 -0
  44. package/server/middleware/localRequestSecurity.js +84 -0
  45. package/server/routes/connections.js +35 -1
  46. package/server/routes/externalApi.js +222 -0
  47. package/server/routes/settings.js +64 -4
  48. package/server/server.js +34 -2
  49. package/server/services/apiTokenService.js +101 -0
  50. package/server/services/databaseCommandService.js +399 -0
  51. package/server/services/nativeFileDialogService.js +260 -0
  52. package/server/services/sqlite/dataBrowserService.js +0 -4
  53. package/server/services/sqlite/exportService.js +5 -1
  54. package/server/services/sqlite/sqlExecutor.js +51 -2
  55. package/server/services/storage/appStateStore.js +113 -0
  56. package/server/utils/errors.js +7 -0
  57. package/server/utils/sqliteTypes.js +17 -8
  58. package/tests/api-token-auth.test.js +127 -0
  59. package/tests/cli-service-delegation.test.js +43 -0
  60. package/tests/connections-file-dialog-route.test.js +89 -0
  61. package/tests/copy-column-modal.test.js +48 -0
  62. package/tests/database-command-service.test.js +102 -0
  63. package/tests/export-blob.test.js +46 -0
  64. package/tests/form-controls.test.js +34 -0
  65. package/tests/json-preview.test.js +49 -0
  66. package/tests/local-request-security.test.js +85 -0
  67. package/tests/native-file-dialog.test.js +105 -0
  68. package/tests/query-results-truncation.test.js +20 -0
  69. package/tests/row-editor-null-values.test.js +131 -0
  70. package/tests/settings-api-tokens-route.test.js +76 -0
  71. package/tests/settings-view.test.js +47 -0
  72. package/tests/sql-identifier-safety.test.js +9 -3
  73. package/tests/sql-result-limit.test.js +66 -0
  74. package/tests/table-scroll-state.test.js +70 -0
  75. package/frontend/assets/mockups/connections.png +0 -0
  76. package/frontend/assets/mockups/data.png +0 -0
  77. package/frontend/assets/mockups/data_row_editor.png +0 -0
  78. package/frontend/assets/mockups/home.png +0 -0
  79. package/frontend/assets/mockups/sql_editor.png +0 -0
  80. package/frontend/assets/mockups/sql_editor_croped.png +0 -0
  81. package/frontend/assets/mockups/sql_editor_querydetail.png +0 -0
  82. package/frontend/assets/mockups/structure.png +0 -0
  83. package/frontend/assets/mockups/structure_inspector.png +0 -0
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # sqlite-hub ⚡️
2
2
 
3
- ![](./frontend/assets/mockups/home.png)
3
+ [![SQLite Hub database overview](./frontend/assets/mockups/overview_1200.webp)](./frontend/assets/mockups/overview_1200.webp)
4
4
 
5
5
  A focused local-first app for browsing, editing, and querying SQLite databases.
6
6
 
@@ -13,61 +13,113 @@ Many database tools are powerful, but feel oversized when all you want is to ins
13
13
  SQLite Hub keeps that workflow sharp:
14
14
 
15
15
  - browse tables and rows
16
+ - open existing databases or create new SQLite files with a native save dialog
17
+ - manage recent connections with labels, custom icons, and read-only mode
18
+ - inspect database health, storage metrics, and schema connectivity from one overview
16
19
  - filter, sort, page through, and export table data
17
20
  - inspect schema, structure, and relationships
18
- - edit records in place with an SQL diff preview before saving
21
+ - edit records in place with typed value previews and an SQL diff preview before saving
19
22
  - export tables and query results as CSV, TSV, Markdown, or duplicate them as a table
20
23
  - copy result columns with formatting, headers, first-10 previews, TXT export, and Markdown todo export
21
24
  - keep database-scoped Markdown documents with previews, autosave, imports, exports, and saved-query inserts
22
25
  - switch between recent databases with sidebar quick picks
23
26
  - create simple local backups of the active database
24
27
  - run and format SQL in a syntax-highlighted editor with history, messages, and performance metrics
28
+ - keep large interactive query results bounded while full exports remain available
25
29
  - turn query-history results into local charts
26
30
  - create and edit tables with a live SQL preview
27
31
  - stay local and move fast
28
32
 
29
33
  ## Features
30
34
 
35
+ ### Connections
36
+
37
+ [![SQLite Hub connections](./frontend/assets/mockups/connections_1200.webp)](./frontend/assets/mockups/connections_1200.webp)
38
+
39
+ Open an existing SQLite file with a native file picker or create a new database with a native save dialog from the Connections view. Manual absolute-path entry remains available as a fallback for both actions.
40
+
41
+ Recent connections show file size, modification time, last-opened time, and access mode. Connections can be activated, relabeled, moved to another path, opened read-only, assigned a PNG/JPG/WEBP icon, reset to the default icon, or removed from the recent-connections registry without deleting the database file.
42
+
43
+ ### Overview
44
+
45
+ The database overview combines operational and schema information for the active database:
46
+
47
+ - file size, page count, table/view counts, index/trigger counts, journal mode, and foreign-key status
48
+ - largest tables by row count and estimated size
49
+ - database path, modification time, SQLite version, page size, freelist count, and encoding
50
+ - schema-map statistics for foreign-key links, connected clusters, and isolated tables
51
+ - integrity and quick-check results, access mode, user version, and schema version
52
+ - shortcuts to the SQL Editor, Structure view, and the database location in Finder
53
+
31
54
  ### Structure view
32
55
 
33
- ![](./frontend/assets/mockups/structure.png)
56
+ <p>
57
+ <a href="./frontend/assets/mockups/structure_1_1200.webp"><img src="./frontend/assets/mockups/structure_1_1200.webp" alt="SQLite Hub relationship graph" width="49%"></a>
58
+ <a href="./frontend/assets/mockups/structure_2_inspector_1200.webp"><img src="./frontend/assets/mockups/structure_2_inspector_1200.webp" alt="SQLite Hub structure inspector" width="49%"></a>
59
+ </p>
34
60
 
35
- Inspect tables, columns, types, indexes, foreign keys, and schema details without losing pace. The graph view visualizes relationships, the table list is searchable, and SQLite Hub remembers the last selected table while you move between views.
61
+ Inspect tables, views, indexes, triggers, columns, declared types, primary keys, nullability, foreign keys, and DDL without losing pace. The searchable object list and relationship graph support fit, relayout, selection clearing, direct navigation to table data, and a hideable inspector/sidebar. SQLite Hub remembers the last selected table while you move between views, and DDL can be copied directly from the inspector.
36
62
 
37
63
  ### Data browser
38
64
 
39
- ![](./frontend/assets/mockups/data.png)
65
+ [![SQLite Hub data browser](./frontend/assets/mockups/data_1_1200.webp)](./frontend/assets/mockups/data_1_1200.webp)
66
+
67
+ Scan rows, sort columns, move through local data quickly, and export full tables as CSV, TSV, or Markdown. The Data browser also supports duplicating exports as a new table, searchable and hideable table navigation, page sizes up to 250 rows, and advanced filters with column/operator/value controls. Text filters support case-insensitive `contains`, `not contains`, and exact `equals` matching.
40
68
 
41
- Scan rows, sort fast, move through local data quickly, and export full tables as CSV, TSV, or Markdown. The Data browser also supports duplicating exports as a new table, table search, page sizes up to 250 rows, and advanced filters with column/operator/value controls. Text filters support case-insensitive `contains`, `not contains`, and exact `equals` matching.
69
+ Wide tables keep their horizontal scroll position when sorting causes the grid to re-render. Cells use compact previews for long values, BLOBs, and detected file paths, while exports retain complete BLOB content.
42
70
 
43
71
  ### Row editing
44
72
 
45
- ![](./frontend/assets/mockups/data_row_editor.png)
73
+ [![SQLite Hub row editor](./frontend/assets/mockups/data_2_row_editor_1200.webp)](./frontend/assets/mockups/data_2_row_editor_1200.webp)
46
74
 
47
- Open one record, edit it in place, preview the SQL diff, then commit. SQLite Hub only enables row edits when it can target a stable row identity safely.
75
+ Open one record, edit it in place, preview the generated SQL and changed values, then commit or delete the row with confirmation. SQLite Hub only enables row edits when it can target a stable primary-key or rowid identity safely.
76
+
77
+ The Row Editor adds contextual previews without changing the stored raw value:
78
+
79
+ - visible `NULL`, `EMPTY STRING`, and `VALUE` states, with untouched `NULL` values preserved on save
80
+ - formatted JSON object and array previews with indentation and line breaks
81
+ - full-row JSON preview with copy and `.json` export actions
82
+ - clickable HTTP/HTTPS URL detection
83
+ - file-path detection with filename, directory, extension, and path type
84
+ - timestamp interpretation for plausible numeric, ISO, and SQLite datetime values while protecting key columns
85
+ - character counts for non-empty text values
86
+ - select controls for simple string `CHECK (... IN (...))` constraints
48
87
 
49
88
  ### SQL editor
50
89
 
51
- ![](./frontend/assets/mockups/sql_editor.png)
90
+ [![SQLite Hub SQL editor](./frontend/assets/mockups/sql_editor_1_1200.webp)](./frontend/assets/mockups/sql_editor_1_1200.webp)
91
+
92
+ Write queries in a syntax-highlighted editor, execute them with the Run button or `Shift + Enter`, format SQL with the editor Format button, inspect results in the same workflow, and export result sets as CSV, TSV, Markdown, or duplicate them as a table. Query drafts survive reloads, query history can be searched and saved, and direct single-table `SELECT` results can be edited or deleted from the result grid when a stable row identity is available.
93
+
94
+ Interactive result sets are limited to the first 5,000 rows to keep the application responsive. A visible notice and Messages entry indicate truncation; CSV, TSV, Markdown, and duplicate-table exports execute without that interactive row limit and include complete BLOB values. Sorting wide results preserves the horizontal scroll position.
52
95
 
53
- Write queries in a syntax-highlighted editor, format SQL with the editor Format button, inspect results in the same workflow, and export result sets as CSV, TSV, Markdown, or duplicate them as a table. Query drafts survive reloads, query history can be searched and saved, and direct single-table `SELECT` results can be edited from the result grid.
96
+ [![SQLite Hub query export](./frontend/assets/mockups/sql_editor_5_export_query_result_1200.webp)](./frontend/assets/mockups/sql_editor_5_export_query_result_1200.webp)
54
97
 
55
98
  Result column menus include copy actions for a full column, a column with header, or the first 10 values. The same modal can preview the output, copy it, export it as TXT, or turn a column into Markdown todo items.
56
99
 
100
+ <p>
101
+ <a href="./frontend/assets/mockups/sql_editor_3_export_column_1200.webp"><img src="./frontend/assets/mockups/sql_editor_3_export_column_1200.webp" alt="SQLite Hub copy column dialog" width="49%"></a>
102
+ <a href="./frontend/assets/mockups/sql_editor_4_export_column_as_markdown_1200.webp"><img src="./frontend/assets/mockups/sql_editor_4_export_column_as_markdown_1200.webp" alt="SQLite Hub Markdown todo export" width="49%"></a>
103
+ </p>
104
+
57
105
  The bottom panel keeps separate tabs for:
58
106
 
59
107
  - Results
60
108
  - Performance, including execution time, statement count, returned rows, affected rows, and serialized result memory size
61
109
  - Messages, including the executed query and statement updates/errors
62
110
 
63
- Potentially destructive statements are tracked in query history, and SQLite Hub keeps the active result tab instead of forcing you back to Results after every execution.
111
+ Potentially destructive statements are tracked in query history, and SQLite Hub keeps the active result tab instead of forcing you back to Results after every execution. Multi-statement SQL is reported statement by statement, including returned rows, affected rows, truncation warnings, executed SQL, errors, timing, and serialized result size.
64
112
 
65
113
  ### Query history
66
114
 
67
- SQLite Hub stores query history per database. You can search SQL, titles, and notes; mark useful queries as saved; re-run previous queries; and execute saved queries from the CLI.
115
+ [![SQLite Hub query history details](./frontend/assets/mockups/sql_editor_2_query_details_1200.webp)](./frontend/assets/mockups/sql_editor_2_query_details_1200.webp)
116
+
117
+ SQLite Hub stores query history per database. You can browse recent and saved tabs, search SQL, titles, and notes, assign titles and notes, mark useful queries as saved, delete history entries, load older entries, re-run previous queries, reopen them in the editor, and execute saved queries from the CLI.
68
118
 
69
119
  ### Documents
70
120
 
121
+ [![SQLite Hub Markdown documents](./frontend/assets/mockups/documents_1200.webp)](./frontend/assets/mockups/documents_1200.webp)
122
+
71
123
  Documents are local Markdown notes scoped to the active database. SQLite Hub creates a document folder per database, keeps the sidebar fixed while the editor and preview panes scroll independently, and autosaves changes after a short debounce. You can create, rename, delete, import `.md` files, export the current document as Markdown, and toggle the editor or preview pane as needed.
72
124
 
73
125
  The preview supports regular Markdown, ordered and unordered lists, tables, code blocks, links, and clickable task-list checkboxes. Documents can also pull context from saved SQL Editor queries:
@@ -78,20 +130,48 @@ The preview supports regular Markdown, ordered and unordered lists, tables, code
78
130
 
79
131
  ### Charts
80
132
 
81
- Create charts from chartable `SELECT` query-history entries. Charts can be saved per query, reopened later, and rendered from live query results.
133
+ [![SQLite Hub bar chart](./frontend/assets/mockups/charts_1_bars_1200.webp)](./frontend/assets/mockups/charts_1_bars_1200.webp)
134
+
135
+ Create bar, line, pie/donut, and scatter charts from chartable `SELECT` query-history entries. Charts can be saved per query, edited, deleted, resized, reopened later, rendered from live query results, and exported as PNG. Chart configuration supports compatible column selection, sorting, labels, legends, line smoothing, scatter series, and optional scatter point sizing.
136
+
137
+ <p>
138
+ <a href="./frontend/assets/mockups/charts_2_pie_1200.webp"><img src="./frontend/assets/mockups/charts_2_pie_1200.webp" alt="SQLite Hub pie chart" width="49%"></a>
139
+ <a href="./frontend/assets/mockups/charts_3_scatter_plot_1200.webp"><img src="./frontend/assets/mockups/charts_3_scatter_plot_1200.webp" alt="SQLite Hub scatter plot" width="49%"></a>
140
+ </p>
82
141
 
83
142
  ### Table Designer
84
143
 
85
- Create and edit SQLite tables from the UI. The Table Designer includes a searchable table list, column controls, CSV import drafting, and a live SQL preview that can be hidden or shown.
144
+ [![SQLite Hub Table Designer](./frontend/assets/mockups/table_designer_1_1200.webp)](./frontend/assets/mockups/table_designer_1_1200.webp)
145
+
146
+ Create and edit SQLite tables from the UI. The Table Designer includes a searchable table list, validation and migration warnings, and controls for column names, SQLite types, `NOT NULL`, `UNIQUE`, primary keys, SQL defaults, foreign-key tables/columns, and check constraints. Existing composite unique constraints are surfaced as schema metadata.
147
+
148
+ CSV files can seed a new table draft and optionally fill the created table with imported rows. Every change produces a copyable live SQL preview that can be hidden or shown before the schema operation is applied.
149
+
150
+ [![SQLite Hub Table Designer checks](./frontend/assets/mockups/table_designer_2_checks_1200.webp)](./frontend/assets/mockups/table_designer_2_checks_1200.webp)
86
151
 
87
152
  ### Media Tagging
88
153
 
89
- Configure a media table, tag table, and mapping table, then work through a tagging queue for image, video, and audio assets. The workflow supports preview controls, skipped items, parent tags, and applying selected tags to the current media row.
154
+ [![SQLite Hub Media Tagging setup](./frontend/assets/mockups/media_tagging_1_setup_1200.webp)](./frontend/assets/mockups/media_tagging_1_setup_1200.webp)
155
+
156
+ Configure a media table, path/status columns, tag table, mapping table, and the SQL queries that drive tagged and untagged queues. SQLite Hub can create the default tag and mapping tables, validate the setup, reset default queries, and preview image, video, and audio assets from paths scoped to the active database directory.
157
+
158
+ The queue supports tag search, tag creation/removal, parent tags, copying tags from the previous item, applying selected tags, skipping items, resetting skipped items, rotating visual media, hiding/showing media details, and opening the current row in Data or Structure. `Shift + Enter` applies the selected tags and advances to the next item.
159
+
160
+ <p>
161
+ <a href="./frontend/assets/mockups/media_tagging_2_tagging_queue_1200.webp"><img src="./frontend/assets/mockups/media_tagging_2_tagging_queue_1200.webp" alt="SQLite Hub tagging queue" width="49%"></a>
162
+ <a href="./frontend/assets/mockups/media_tagging_3_media_viewer_1200.webp"><img src="./frontend/assets/mockups/media_tagging_3_media_viewer_1200.webp" alt="SQLite Hub media viewer" width="49%"></a>
163
+ </p>
90
164
 
91
165
  ### UI preferences
92
166
 
93
167
  SQLite Hub remembers common workspace preferences in local storage, including hidden panels, selected editor tabs, query drafts, chart panels, table row size, and Table Designer preview visibility.
94
168
 
169
+ ### Settings
170
+
171
+ [![SQLite Hub settings](./frontend/assets/mockups/settings_1200.webp)](./frontend/assets/mockups/settings_1200.webp)
172
+
173
+ The Settings view reports the installed SQLite Hub version and the actual SQLite runtime version used to execute queries. It also keeps the custom-port CLI command, project website, and source repository available in the application.
174
+
95
175
  ### Database quick picks
96
176
 
97
177
  The active database footer in the sidebar opens a quick-pick panel with the five most recent databases, so you can switch databases without going back to the Connections view.
@@ -102,7 +182,7 @@ Create timestamped local backups of the active SQLite database in one click. Bac
102
182
 
103
183
  ### Local-first
104
184
 
105
- Built around local SQLite files, not hosted dashboards or team complexity.
185
+ Built around local SQLite files, not hosted dashboards or team complexity. The server binds explicitly to the IPv4 loopback interface, and API middleware rejects foreign hosts and cross-origin mutations while still allowing same-origin browser and local CLI requests.
106
186
 
107
187
  ## Install
108
188
 
@@ -280,9 +360,7 @@ Legacy aliases such as `--database-path:name`, `--database-size:name`, `--databa
280
360
 
281
361
  ### SQL editor CLI example
282
362
 
283
- ![](/frontend/assets/mockups/sql_editor_croped.png)
284
-
285
- In the screenshot above, you can see a saved query from the SQL editor. You can create these queries using the graphical interface and execute them via the CLI if you want. To execute one, you would run:
363
+ Saved queries created in the graphical SQL Editor can also be executed through the CLI. To execute one, run:
286
364
 
287
365
  ```bash
288
366
  sqlite-hub --database:Unit-00 --execute:"Group by creation Year"
@@ -308,6 +386,10 @@ Results:
308
386
  [2] 2026 | 40
309
387
  ```
310
388
 
389
+ ## API
390
+
391
+ SQLite Hub also provides a local JSON API for database metadata, tables, saved queries, exports, and documents. Access is protected by database-specific API tokens created in Settings. See the [API documentation](./docs/API.md) for authentication, endpoints, and examples.
392
+
311
393
  ## Changelog
312
394
 
313
395
  [Changelog](./docs/changelog.md)