Jsonjsdb is a client-side relational database library specifically designed for static Single Page Applications. It enables offline data storage and querying capabilities, functioning effectively whether the application is run locally via the `file://` protocol or served over HTTP/HTTPS (e.g., localhost or production servers). The current stable JavaScript version is 0.8.10, with the project showing a somewhat active release cadence, although many recent updates have focused on its Python counterpart. A key differentiator is its unique approach to handling database file extensions (`.json.js` for `file://` and `.json` for `http(s)://`) based on the protocol, and its reliance on HTML-embedded configuration, which distinguishes it from more traditional pure JavaScript database solutions.
npm install jsonjsdbVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to instantiate `Jsonjsdb`, initialize it asynchronously, and then perform basic data retrieval operations like getting all records from a table and retrieving a specific record by ID.
Ensure your build process or deployment script handles the correct file extension for your target environment (local `file://` vs. web server `http(s)://`). Consider using a build tool to generate both versions or dynamically rename during development/deployment.
Always check the HTML `div#jsonjsdb-config` element for database path (`data-path`), application name (`data-app-name`), and database key (`data-db-key`). Ensure these attributes are correctly set or provided programmatically if the `Jsonjsdb` constructor supports it.
When upgrading between minor `0.x` versions, thoroughly review the project's main documentation (beyond the specific package README) and any available release notes for potential API changes or configuration adjustments, especially regarding `init()` options or data retrieval methods.
Ensure your database files are named with a `.json.js` extension (e.g., `users.json.js`) when running locally via `file://`. For HTTP/HTTPS, they should be `.json`.
Verify that `import Jsonjsdb from 'jsonjsdb'` is used for ES Modules, and that `const db = new Jsonjsdb()` successfully creates an instance before calling `db.init()`.
Check the `_db_` folder (or configured `data-path`) for the `__table__.json` (or `__table__.json.js`) file and ensure it correctly lists all available table names. Also, verify that the table data files themselves are present and correctly named.
No dependency data recorded yet.