{"id":43994,"library":"sqlweb","title":"SqlWeb","description":"SqlWeb is an extension of JsStore that allows using SQL queries for IndexedDB operations. Current stable version is 1.6.2. It provides a familiar SQL interface on top of JsStore's SQL-like query builder. The library is maintained alongside JsStore but has a distinct release cadence. Key differentiator: it enables direct SQL syntax (e.g., SELECT * FROM) instead of JsStore's JSON-based query objects. Requires JsStore >=4.0.3 as a peer dependency. Ships TypeScript definitions. Suitable for developers migrating from WebSQL or those preferring SQL syntax over programmatic APIs.","status":"active","version":"1.6.2","language":"javascript","source_language":"en","source_url":"https://github.com/ujjwalguptaofficial/sqlweb","tags":["javascript","indexeddb","sql","jsstore","alternative","websql","typescript"],"install":[{"cmd":"npm install sqlweb","lang":"bash","label":"npm"},{"cmd":"yarn add sqlweb","lang":"bash","label":"yarn"},{"cmd":"pnpm add sqlweb","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Runtime peer dependency; SqlWeb is a plugin for JsStore and cannot function without it.","package":"jsstore","optional":false}],"imports":[{"note":"The default export is a constructor/plugin function. Named export is not available.","wrong":"import { SqlWeb } from 'sqlweb'","symbol":"default","correct":"import SqlWeb from 'sqlweb'"},{"note":"If using TypeScript, import the type if you only need the type definition (not the value).","wrong":"import { SqlWeb } from 'sqlweb'","symbol":"SqlWeb (type)","correct":"import type SqlWeb from 'sqlweb'"},{"note":"JsStore requires namespace import (import *) because it exports multiple functions as named exports.","wrong":"import JsStore from 'jsstore'","symbol":"JsStore","correct":"import * as JsStore from 'jsstore'"}],"quickstart":{"code":"import * as JsStore from 'jsstore';\nimport SqlWeb from 'sqlweb';\n\nconst workerPath = 'path/to/jsstore.worker.js'; // or use CDN\nconst connection = new JsStore.Instance(workerPath);\n\nasync function main() {\n  await connection.addPlugin(SqlWeb);\n  \n  // Create table (if not exists) and insert data\n  const createResult = await connection.$sql.run(`\n    CREATE TABLE IF NOT EXISTS Customers (\n      id INTEGER PRIMARY KEY,\n      name TEXT NOT NULL,\n      email TEXT\n    )\n  `);\n  console.log('Table created:', createResult);\n\n  const insertResult = await connection.$sql.run(`\n    INSERT INTO Customers (name, email) VALUES ('John Doe', 'john@example.com')\n  `);\n  console.log('Insert result:', insertResult);\n\n  const rows = await connection.$sql.run('SELECT * FROM Customers');\n  console.log('All customers:', rows);\n}\nmain().catch(console.error);","lang":"typescript","description":"Shows basic setup of SqlWeb with JsStore: create connection, add plugin, run SQL queries including CREATE TABLE, INSERT, and SELECT."},"warnings":[{"fix":"Call connection.addPlugin(SqlWeb) after creating the connection instance.","message":"SqlWeb is a plugin for JsStore—you must add it to an existing JsStore connection before using $sql.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Refer to SqlWeb documentation or source for supported SQL syntax.","message":"The SQL syntax supported by SqlWeb is a subset of standard SQL; not all SQL features are available (e.g., JOINs may be limited).","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use consistent casing when creating tables and querying them.","message":"Table and column names are case-sensitive in IndexedDB; SQL queries must match exactly.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Each $sql.run call is a separate transaction. Group operations carefully.","message":"Transactions are automatically handled; explicit BEGIN/COMMIT are not supported.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.6.2':20 '4.0.3':70 'allow':9 'alongsid':41 'altern':96 'api':91 'base':65 'builder':36 'cadenc':48 'current':16 'definit':77 'depend':74 'develop':80 'differenti':50 'direct':53 'distinct':46 'e.g':56 'enabl':52 'extens':5 'familiar':24 'indexeddb':14,93 'instead':59 'interfac':26 'javascript':92 'json':64 'json-bas':63 'jsstore':7,30,42,61,69,95 'key':49 'librari':38 'like':34 'maintain':40 'migrat':81 'object':67 'oper':15 'peer':73 'prefer':86 'programmat':90 'provid':22 'queri':12,35,66 'releas':47 'requir':68 'select':57 'ship':75 'sql':11,25,33,54,87,94 'sql-like':32 'sqlweb':1,2 'stabl':17 'suitabl':78 'syntax':55,88 'top':28 'typescript':76,98 'use':10 'version':18 'websql':83,97","created_at":"2026-06-05T17:02:28.332547+00:00","updated_at":"2026-06-05T17:02:28.332547+00:00","problems":[{"fix":"Add connection.addPlugin(SqlWeb) after creating the connection.","cause":"Forgot to call connection.addPlugin(SqlWeb) before using $sql.","error":"Uncaught (in promise) TypeError: connection.$sql is undefined"},{"fix":"Run 'npm install jsstore@latest' to update to a compatible version.","cause":"Installed version of jsstore is older than 4.0.3.","error":"Error: SqlWeb plugin requires jsstore >=4.0.3"},{"fix":"Verify the table name matches exactly (case-sensitive) and that it was created before the query.","cause":"Trying to query a table that doesn't exist or hasn't been created with the correct name.","error":"Uncaught (in promise) DOMException: Failed to execute 'transaction' on 'IDBDatabase': One or more of the specified object stores is not found."}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/ujjwalguptaofficial/sqlweb#readme","github":"https://github.com/ujjwalguptaofficial/sqlweb","docs":null,"changelog":null,"pypi":null,"npm":"sqlweb","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-05","next_check":"2026-09-03","install_tag":null}}