Tiny Memory DB is a zero-dependency, in-memory database library for JavaScript and TypeScript environments. Currently at version 0.4.2, it is in active development, with a release cadence that reflects its pre-1.0 status, meaning updates occur as features are implemented or bugs are addressed. Its primary differentiators are its minimal footprint and lack of external dependencies, making it ideal for lightweight data management. It provides a structured 'Table' abstraction for defining data schemas with attributes and primary keys, and supports a concise, string-based query language. Unlike persistent databases, Tiny Memory DB operates entirely in RAM, prioritizing speed and simplicity, though users can implement external mechanisms for data persistence if needed. It ships with comprehensive TypeScript types, ensuring type safety and an improved developer experience for TS projects.
npm install tiny-memory-dbVerified import paths — ran on the pinned version, not inferred.
This example demonstrates creating a typed in-memory table, adding data, querying by exact match and regular expression, updating records, and deleting records.
Pin the exact package version in package.json (e.g., `"tiny-memory-db": "0.4.2"`) and manually verify functionality after any update.
Monitor memory usage, paginate query results, and consider using it only for datasets that comfortably fit within available memory. For persistent storage or very large datasets, evaluate disk-backed or external database solutions.
Implement external mechanisms for loading and saving data, such as writing table contents to a JSON file, `localStorage`, or an external database at appropriate lifecycle events (e.g., application shutdown, regular intervals).
Familiarize yourself with the exact query syntax provided in the library's documentation. For highly complex filtering, consider retrieving a broader dataset using simpler queries and then applying additional filtering logic programmatically using standard JavaScript array methods.
Reduce the amount of data stored, or increase the Node.js memory limit if applicable (`--max-old-space-size`). Re-evaluate if an in-memory solution is appropriate for your dataset size.
Ensure you are using `import { Table } from 'tiny-memory-db';` with an environment configured for ESM (e.g., `"type": "module"` in package.json for Node.js, or a bundler like Webpack/Rollup).After calling `table.query()`, you typically need to call `.scan()` on the returned `ResultSet` to get the iterable data. Correct usage is `(await table.query(...)).scan()`.
No dependency data recorded yet.