Registry / database / brackets-memory-db

brackets-memory-db

JSON →
library1.0.5jsnpmunverified

brackets-memory-db is an in-memory implementation of the `CrudInterface` for the `brackets-manager.js` ecosystem, designed to store tournament bracket data directly in application memory. The current stable version is 1.0.5, last published over two years ago, indicating a stable but infrequent release cadence. It provides a simple, type-safe storage solution that is particularly well-suited for client-side applications running in the browser, where data persistence is managed by the client's session or explicitly handled by the application logic. It's also an excellent choice for testing, prototyping, or scenarios requiring temporary, ephemeral storage without the overhead of a persistent database. Its key differentiators are its tight integration with `brackets-manager.js` and its straightforward, zero-configuration setup for in-memory operations.

npm install brackets-memory-db
INSTALL
IMPORT
SIG · BRACKETS-MEMORY-DB
B
brackets-memory-db
databasejavascriptv1.0.5
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

MemoryStorage
import { MemoryStorage } from 'brackets-memory-db';
const { MemoryStorage } = require('brackets-memory-db');
The primary export is a named class, `MemoryStorage`. While CommonJS `require` might technically work in some setups, ESM import syntax is recommended and correctly typed.
MemoryStorage
import type { CrudInterface } from 'brackets-manager';
import { MemoryStorage, CrudInterface } from 'brackets-memory-db';
The `CrudInterface` itself is typically imported from `brackets-manager` for type declarations, not `brackets-memory-db`, as this package implements that interface.

This quickstart demonstrates how to set up `brackets-manager` with `brackets-memory-db` as its storage backend, creating a simple tournament and stage entirely in memory. It highlights the basic instantiation and interaction pattern.

import { BracketsManager } from 'brackets-manager'; import { MemoryStorage } from 'brackets-memory-db'; async function setupTournament() { // 1. Instantiate the in-memory storage. const storage = new MemoryStorage(); // 2. Pass the storage instance to the BracketsManager. const manager = new BracketsManager(storage); // 3. Create a new tournament. await manager.create.tournament({ name: 'My Awesome Tournament', slug: 'my-awesome-tournament', description: 'A test tournament running in memory.', sport: 'esports', }); // 4. Create a stage for the tournament. const tournamentId = (await manager.get.tournament('my-awesome-tournament'))?.id; if (tournamentId === undefined) { throw new Error('Tournament not found'); } await manager.create.stage({ tournamentId, name: 'Single Elimination Stage', type: 'single_elimination', seeding: ['Team A', 'Team B', 'Team C', 'Team D'], settings: { size: 4 }, }); console.log('Tournament and stage created in memory!'); const matches = await manager.get.matches(tournamentId); console.log('Current matches:', matches); } setupTournament().catch(console.error);
Debug
Known issues
gotchaData stored in `brackets-memory-db` is volatile and will be lost when the application process terminates or the browser page is refreshed. It does not provide any inherent persistence mechanism.
fix
For persistent storage, consider other `brackets-manager` implementations like `brackets-json-db`, `brackets-prisma-db`, or `brackets-sql-db`, or implement custom serialization/deserialization logic to save/load the in-memory state.
affects: >=1.0.0
gotchaThis package is suitable for browser-based applications or backend processes where data can be re-generated or is explicitly saved externally. It is not designed as a primary, durable database for production systems requiring data integrity across restarts.
fix
Evaluate your persistence requirements. For server-side applications, choose a database-backed `CrudInterface` implementation. For browser apps, ensure any critical data is saved to `localStorage`, `indexedDB`, or a remote API.
affects: >=1.0.0
gotchaThe package's last publish was over two years ago. While this can indicate stability, it also means infrequent updates, which might lead to slower bug fixes or a delay in adopting new features or TypeScript versions from its `brackets-manager` peer dependency.
fix
Review the GitHub repository's issue tracker and commit history for current activity. Be mindful of potential compatibility issues with newer versions of `brackets-manager` if this package is not updated concurrently.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'brackets-memory-db' or its corresponding type declarations.
This error often occurs when mixing CommonJS `require()` with an ESM-first package, using an incorrect import path, or when TypeScript cannot find the type definitions.
fix
Ensure you are using ESM `import { MemoryStorage } from 'brackets-memory-db';`. If in Node.js, ensure your `package.json` has `"type": "module"` or you are using `.mjs` files. For TypeScript, verify `tsconfig.json` settings (`moduleResolution`, `module`).
TypeError: Cannot read properties of undefined (reading 'create')
This error typically indicates that the `BracketsManager` instance was not properly initialized with a valid storage implementation, or the storage instance itself is `undefined`.
fix
Double-check that `const storage = new MemoryStorage();` successfully creates an instance and that `new BracketsManager(storage);` is correctly called, passing the `storage` object.
Upgrade
Version history
1.0.5latest on npm
Audit
Dependencies
brackets-managerrequiredThis package provides an in-memory `CrudInterface` implementation that must be passed to an instance of `BracketsManager`.
Agent activity
16 hits · last 30 days
node
14
Amazon
1
OpenAI (training)
1
Resources
brackets-memory-db — npm install brackets-memory-db · libregistry