Registry / database / backbone-orm

backbone-orm

JSON →
library0.7.14jsnpmunverified

BackboneORM is a polystore ORM that provides a consistent interface for database operations across MongoDB and SQL databases (PostgreSQL, MySQL) as well as in-memory and HTTP stores. Version 0.7.14 is the latest stable release. Key differentiators include Node.js-style callbacks and streams, MongoDB-like query language, REST controller for browser search bar queries, CouchDB-inspired paging, JSON-rendering DSL, automatic ISO8601 date parsing, and versioning support via BackboneMongo. Released under MIT license with weekly or monthly updates via npm.

npm install backbone-orm
INSTALL
IMPORT
SIG · BACKBONE-ORM
B
backbone-orm
databasejavascriptv0.7.14
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

BackboneORM
import BackboneORM from 'backbone-orm'
const BackboneORM = require('backbone-orm')
Package uses default export; CommonJS require works but ESM import is preferred for modern environments.
Model
import { Model } from 'backbone-orm'
const Model = require('backbone-orm').Model
Named export for Model class; CommonJS require requires .Model access.
Store
import { Store } from 'backbone-orm'
const Store = require('backbone-orm').Store
Named export for Store class; CommonJS require requires .Store access.

This quickstart demonstrates setting up a memory store, defining a model, saving a new project, and querying for it using callbacks.

// Create a memory store const { Store, Model } = require('backbone-orm'); // Define a Model const Project = Model.extend({ url: function() { return '/projects'; }, schema: { name: String, is_active: Boolean } }); // Create a store connection (memory) const store = new Store({ type: 'memory' }); store.connect({}, function(err) { if (err) throw err; // Create and save a new project const project = new Project({ name: 'Test Project', is_active: true }); project.save(function(err, savedProject) { if (err) throw err; console.log('Saved project with id:', savedProject.get('id')); // Find it Project.findOne({ name: 'Test Project' }, function(err, found) { if (err) throw err; console.log('Found:', found.toJSON()); }); }); });
Debug
Known issues
gotchaBackboneORM requires Backbone as a global dependency; you must have Backbone loaded before using this library. Without it, you will get 'Backbone is not defined' errors.
fix
Ensure Backbone is installed and available globally via script tag or bundler (e.g., `require('backbone')` before `require('backbone-orm')`).
affects: >=0.7.0
deprecatedCallback-based APIs are the primary pattern, but they are not deprecated; however, the library does not natively support Promises or async/await without wrapping.
fix
Use a promisify utility (e.g., `util.promisify` from Node.js) or wrap callbacks manually.
affects: >=0.7.0
gotchaThe library relies on global Backbone.sync and Backbone.history; custom sync may interfere with operation.
fix
Ensure that no other library overrides Backbone.sync or Backbone.history before using BackboneORM.
affects: >=0.7.0
gotchaMongoDB-like query syntax includes a custom `$ids` shortcut that may conflict with other query patterns.
fix
Use explicit `{id: {$in: [1,2,3]}}` instead of `{$ids: [1,2,3]}` for portability.
affects: >=0.7.0
gotchaThe library uses streams for large datasets; improper handling can lead to memory issues.
fix
Always handle stream errors and backpressure; consider using `$each` batching or cursor with limits.
affects: >=0.7.0
gotchaThe package does not bundle TypeScript definitions; developers must write their own or find community typings.
fix
Install @types/backbone-orm if available or create custom type declarations.
affects: >=0.7.0
Errors
Common errors & fixes
Backbone is not defined
Backbone library is not loaded before BackboneORM.
fix
Add `require('backbone')` or include Backbone script tag before loading BackboneORM.
Cannot find module 'backbone-orm'
Package not installed or incorrect import path.
fix
Run `npm install backbone-orm` and ensure the import is correct: `require('backbone-orm')`.
TypeError: Project.findOne is not a function
Model not properly initialized or imported incorrectly.
fix
Ensure Model is defined via `model = Model.extend({...})` and store is connected.
Error: No store configured
Store not set up before using model operations.
fix
Create a store instance (e.g., `new Store({ type: 'memory' })`) and call `store.connect()`.
Upgrade
Version history
0.7.14latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
16 hits · last 30 days
node
14
Amazon
1
OpenAI (training)
1
Resources
backbone-orm — npm install backbone-orm · libregistry