Registry / database / beast-orm

beast-orm

JSON →
library1.1.5jsnpmunverified

Beast-ORM is a promise-based ORM for IndexedDB and localStorage in the browser, inspired by Django's ORM. Version 1.1.5 provides auto-incrementing fields, complex filtering with field lookups (gt, gte, lt, lte, not), bulk create/update/delete, and query chaining. It uses a single transaction for multiple requests and registers models against a database name. Key differentiators include a familiar Django-like API, TypeScript support, and plans for SQLite in v2.0.0. Release cadence is irregular as the project is relatively new and maintained by BackdoorTech.

npm install beast-orm
INSTALL
IMPORT
SIG · BEAST-ORM
B
beast-orm
databasejavascriptv1.1.5
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.

models
import { models } from 'beast-orm'
const beastorm = require('beast-orm'); const models = beastorm.models;
ESM only; no CommonJS export. Must use named import.
Model
import { models } from 'beast-orm'; class User extends models.Model { ... }
import { Model } from 'beast-orm'
Model is not directly exported; it's a property of the models object.
AutoField
import { models } from 'beast-orm'; userId = models.AutoField({primaryKey:true})
import { AutoField } from 'beast-orm'
AutoField is a property of the models object, not a separate export.

Demonstrates creating a model class, registering with IndexedDB, and executing a filtered query.

import { models } from 'beast-orm'; class User extends models.Model { userId = models.AutoField({ primaryKey: true }); username = models.CharField({ maxLength: 100 }); email = models.CharField({ blank: true, maxLength: 100 }); age = models.IntegerField(); } models.register({ databaseName: 'tutorial', version: 1, type: 'indexedDB', models: [User], }); async function main() { await User.create({ username: 'kobe', email: 'kobe@example.com', age: 30 }); const users = await User.filter({ age__gt: 20 }).execute(); console.log(users); } main().catch(console.error);
Debug
Known issues
breakingThe 'models' object is the main export; Model and fields are properties of it, not separate exports. Expect import { models } from 'beast-orm'.
fix
Use import { models } from 'beast-orm' and access models.Model etc.
affects: >=1.0.0
gotchaThe 'get' method only works with unique fields (primary key or unique).
fix
Use filter() with .execute() for non-unique lookups.
affects: >=1.0.0
gotchaQueries are lazy; you must call .execute() on filter() or use all() which returns a promise immediately.
fix
Always await or .execute() filter queries: const users = await User.filter({age:10}).execute();
affects: >=1.0.0
deprecatedThe 'type: indexedDB' is the only stable type; localStorage support may be experimental.
fix
Use 'indexedDB' for production.
affects: <2.0.0
deprecatedSQLite support is planned for v2.0.0 but not yet available.
fix
No need to fix; just be aware.
affects: <2.0.0
Errors
Common errors & fixes
TypeError: Cannot destructure property 'Model' of 'models' as it is undefined.
Importing { Model } directly instead of { models } and accessing models.Model.
fix
Change import to: import { models } from 'beast-orm' and use models.Model.
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'AutoField')
Trying to access AutoField on the models object before registration or mis-import.
fix
Ensure proper import: import { models } from 'beast-orm' and use models.AutoField inside class definition.
Error: Database name must be provided
Calling register() without a databaseName property.
fix
Include databaseName in the register options: models.register({databaseName: 'mydb', ...})
Uncaught (in promise) Error: get only works with unique fields
Using get() with a non-unique field filter.
fix
Use filter() and .execute() instead, or ensure the lookup field is unique.
Upgrade
Version history
1.1.5latest on npm
Audit
Dependencies
idboptionalBeast-ORM wraps IndexedDB operations using the `idb` library for a promise-based API.
Agent activity
44 hits · last 30 days
node
32
Bingbot
11
OpenAI (training)
1
Resources
beast-orm — npm install beast-orm · libregistry