Registry / database / jsonbin-orm

jsonbin-orm

JSON →
library1.1.4jsnpmunverified

A lightweight ORM for interacting with JSON Bin as a database, simplifying CRUD operations on JSON Bin collections. Current stable version is 1.1.4. It provides schema validation, query-based find/update, and record-level CRUD. Differentiators include a simple API similar to traditional ORMs, built-in schema enforcement, and zero external dependencies. The package is maintained but has a small community. Currently supports only CommonJS (require), with no ESM exports, limiting use in modern Node.js environments.

npm install jsonbin-orm
INSTALL
IMPORT
SIG · JSONBIN-ORM
J
jsonbin-orm
databasejavascriptv1.1.4
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.

bin
const { bin } = require('jsonbin-orm');
import { bin } from 'jsonbin-orm';
Package is CJS-only; ESM import will throw an error.
default
const orm = require('jsonbin-orm');
import orm from 'jsonbin-orm';
No default export; you must destructure or use .bin.
Bin
const Bin = require('jsonbin-orm').Bin;
const bin = require('jsonbin-orm').Bin;
Note: the class is exported as 'bin' (lowercase), not 'Bin'.

Shows how to initialize bin, create, find, update, and delete records using the ORM.

const { bin } = require('jsonbin-orm'); const myBin = new bin({ binId: 'your-bin-id', apiKey: process.env.JSONBIN_API_KEY ?? '', schema: { name: 'string', age: 'number' } }); async function main() { const newRecord = await myBin.createNew({ name: 'Alice', age: 25 }); console.log('Created:', newRecord); const records = await myBin.find({ name: 'Alice' }); console.log('Found:', records); await myBin.updateOneById(records[0]._id, { age: 26 }); console.log('Updated'); await myBin.deleteById(records[0]._id); console.log('Deleted'); } main().catch(console.error);
Debug
Known issues
gotchaAll methods are asynchronous and return promises; forgetting await leads to silent failures.
fix
Use await or .then() when calling any bin method.
affects: >=1.0.0
gotchaThe schema is enforced on createNew, but updateOneById and updateMany do not validate against the schema.
fix
Ensure updated fields match schema manually or use createNew for validated inserts.
affects: >=1.0.0
gotchafind() uses exact match; it does not support partial or regex queries. This can lead to unexpected empty results.
fix
Pass exact values to find(). For partial matches, consider fetching all records and filtering.
affects: >=1.0.0
gotchaThe package does not handle rate limiting from JSON Bin API; rapid requests may fail.
fix
Implement your own retry logic or delay between requests.
affects: >=1.0.0
deprecatedNo deprecation warnings; however, the API is minimal and may change in future versions.
fix
Pin version in package.json to avoid breaking changes on minor updates.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: bin is not a constructor
Attempting to use the class without destructuring or wrong import style.
fix
Use const { bin } = require('jsonbin-orm'); then new bin({...}).
Cannot read property 'createNew' of undefined
Instance not created correctly; missing new keyword or wrong variable.
fix
Ensure you call new bin(config) and store the instance.
Invalid schema error: unknown field
Attempting to insert a field not defined in the schema with createNew.
fix
Add the field to the schema or remove it from the data object.
Error: API request failed with status 429
Rate limit exceeded from JSON Bin API.
fix
Reduce request frequency or implement exponential backoff.
Upgrade
Version history
1.1.4latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
5 hits · last 30 days
node
4
Resources
jsonbin-orm — npm install jsonbin-orm · libregistry