Registry / database / sqlite-hub

sqlite-hub

JSON →
library0.12.0jsnpmunverified

sqlite-hub is a local-first, lightweight SQLite management app with a browser-based UI and backend, currently at v0.12.0. It provides a full-featured SQL editor with syntax highlighting, query history, performance metrics, and charting; a data browser with filtering, sorting, pagination, and in-place row editing with SQL diff preview; a schema inspector with relationship graphs; table designer with live SQL preview; and export to CSV/TSV/Markdown. Unlike heavy database clients (e.g., DBeaver, DataGrip) or cloud tools, it runs entirely locally, requires no server setup beyond the bundled SPA shell, and focuses on speed and minimalism for SQLite workflows. Releases are frequent (monthly) with incremental feature additions.

npm install sqlite-hub
INSTALL
IMPORT
SIG · SQLITE-HUB
S
sqlite-hub
databasejavascriptv0.12.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
const sqliteHub = require('sqlite-hub')
import sqliteHub from 'sqlite-hub'
Package uses CommonJS. ESM import is not supported.
createDatabase
const { createDatabase } = require('sqlite-hub')
const createDatabase = require('sqlite-hub').createDatabase;
Named export via destructuring works.
Server
const { Server } = require('sqlite-hub')
Server class for programmatic control. Requires Node.js >= 14.

Creates an in-memory SQLite database, creates a table, inserts records, queries data, and closes the database. Demonstrates core CRUD with synchronous better-sqlite3 API.

const { createDatabase } = require('sqlite-hub'); // Create a new SQLite database in memory const db = createDatabase(':memory:'); // Create a table const createTableSQL = `CREATE TABLE users ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, email TEXT UNIQUE NOT NULL )`; db.exec(createTableSQL); // Insert sample data const insertSQL = `INSERT INTO users (name, email) VALUES ('Alice', 'alice@example.com'), ('Bob', 'bob@example.com')`; db.exec(insertSQL); // Query data const rows = db.query('SELECT * FROM users'); console.log(rows); // Output: [ { id: 1, name: 'Alice', email: 'alice@example.com' }, { id: 2, name: 'Bob', email: 'bob@example.com' } ] db.close();
Debug
Known issues
breakingv0.10.0 changed the query() API from returning raw arrays to named objects. Old code using row[0] will break.
fix
Access columns by name: row.name instead of row[0]. Or destructure: const { name } = row;
affects: >=0.10.0
breakingcreateDatabase() now returns a wrapper object, not a raw better-sqlite3 Database instance. Methods like .exec() and .query() are on the wrapper.
fix
Use db.exec() and db.query() instead of raw instance methods. If you need the raw instance, use db.getRawDatabase().
affects: >=0.11.0
deprecatedThe execRaw() method is deprecated. Use exec() with error handling instead.
fix
Replace db.execRaw('...') with db.exec('...') wrapped in try/catch.
affects: >=0.12.0
gotchaquery() returns an array of plain objects. For large result sets, use queryStream() to avoid memory issues.
fix
For large queries, use: const stream = db.queryStream('SELECT * FROM big_table'); for (const row of stream) { ... }
affects: >=0.12.0
gotchaExecuting multiple statements at once is not supported by default. Use execMulti() for batches.
fix
Use db.execMulti('STATEMENT1; STATEMENT2;') instead of db.exec().
affects: >=0.12.0
securityNo built-in query parameterization — all input passed directly to exec() or query() is vulnerable to SQL injection if it contains user input.
fix
Always use parameterized queries: db.query('SELECT * FROM users WHERE id = ?', [userId])
affects: <=0.12.0
Errors
Common errors & fixes
TypeError: db.exec is not a function
Using an older version (<0.11.0) where createDatabase() returned a raw better-sqlite3 instance without exec() wrapper.
fix
Upgrade to v0.11.0+ and use db.exec('...'). Or access the raw instance: const rawDb = require('better-sqlite3'); const db = rawDb('file.db');
Error: SQLITE_MISUSE: not an error
Trying to run a query on a closed database connection.
fix
Ensure db.close() is called after all queries are done. Re-open the database if needed.
Error: SQL_LOGIC: No query to execute
Calling query() with an empty string or whitespace-only SQL.
fix
Provide valid SQL statement. Check for empty strings before calling query().
TypeError: Cannot read properties of undefined (reading 'name')
Accessing column name in results from an older version that returned arrays.
fix
Upgrade to v0.10.0+ and access columns by name. Or upgrade and add migration code.
Upgrade
Version history
0.12.0latest on npm
Audit
Dependencies
better-sqlite3requiredSynchronous SQLite3 bindings for Node.js, used for all database operations.
Agent activity
13 hits · last 30 days
node
10
Meta
2
OpenAI (training)
1
Resources
sqlite-hub — npm install sqlite-hub · libregistry