TaffyDB is an open-source JavaScript library that provides an in-memory database solution for both browser and Node.js environments. It allows developers to store and manipulate JSON data as 'tables' using a uniform, SQL-like interface. Currently at version 2.7.3, the library emphasizes stability and reliability, having been used in production for many years. It differentiates itself by offering a JavaScript-centric data selection engine with features like insert, update, unique, and count, all while being compatible with various DOM libraries and modern browsers (IE9+, FF3+, Safari 5+, Chrome 1.0+) and Node.js 0.10+. While stable, the project's focus appears to be on expanding regression test coverage rather than rapid feature development, suggesting a maintenance-oriented release cadence.
npm install taffydbVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize a TaffyDB instance with JSON data, perform basic queries using SQL-like syntax (e.g., less than), update records, and select specific fields.
Change `const TAFFY = require('taffy');` to `const TAFFY = require('taffy').taffy;`For Node.js, use `const TAFFY = require('taffy').taffy;`. For browser environments, load `taffy.js` via a `<script>` tag and use the global `TAFFY` variable.Implement manual data persistence by serializing the database content (e.g., `db().get()`) to local storage, IndexedDB, or a server, and then re-initializing the database upon application startup.
Thoroughly test TaffyDB's behavior in your specific modern Node.js environment before deploying to production. Consider alternative, more actively maintained in-memory database solutions for new projects if deep modern Node.js integration is required.
You need to access the `taffy` property from the required object: `const TAFFY = require('taffy').taffy;`TaffyDB does not provide an ESM export. Use `const TAFFY = require('taffy').taffy;` in Node.js or load it via a `<script>` tag in the browser and use the global `TAFFY` variable.Ensure you have `<script src="path/to/taffy.js"></script>` in your HTML before attempting to use the `TAFFY` global function.
No dependency data recorded yet.