Registry / database / crx-orm

crx-orm

JSON →
library1.1.0jsnpmunverified

A lightweight ORM for Chrome extension storage that provides a structured way to define schemas and interact with chrome.storage.local/sync. Version 1.1.0 is current; it supports schema-based model definitions with validation, querying, and CRUD operations. Differentiates from raw chrome.storage by offering a familiar ORM pattern with type safety, migration support, and automatic serialization. Development appears infrequent, with limited releases since initial publish.

npm install crx-orm
INSTALL
IMPORT
SIG · CRX-ORM
C
crx-orm
databasejavascriptv1.1.0
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.

default
import CrxOrm from 'crx-orm'
const CrxOrm = require('crx-orm')
Package is ESM-only; CommonJS require will fail.
Model
import { Model } from 'crx-orm'
Named export for defining models.
Schema
import { Schema } from 'crx-orm'
Named export for defining schemas.

Defines a schema and model for User, creates a record, and queries it using chrome.storage.

import CrxOrm from 'crx-orm'; const schema = new CrxOrm.Schema({ name: { type: String, required: true }, age: { type: Number, default: 0 } }); const User = new CrxOrm.Model('User', schema); async function main() { await User.create({ name: 'Alice', age: 30 }); const users = await User.find({ name: 'Alice' }); console.log(users); } main();
Debug
Known issues
gotchacrx-orm only works in a Chrome extension context (chrome.storage API). It will fail in Node.js or browser without chrome runtime.
fix
Ensure code runs inside a Chrome extension background script or popup where chrome.storage is available.
affects: >=0.0.0
deprecatedThe package is not actively maintained; the last release was version 1.1.0 with no recent updates. May not support Manifest V3 fully or newer Chrome APIs.
fix
Consider alternatives like webextension-polyfill or raw chrome.storage if updates are needed.
affects: >=0.0.0
gotchaQuota limits of chrome.storage apply (5MB for sync, unlimited for local with permission). crx-orm does not handle quota errors gracefully.
fix
Monitor storage usage and handle quota errors in your own code.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: chrome.storage is not defined
Code executed outside Chrome extension environment (e.g., Node.js, browser tab without extension APIs).
fix
Run inside a Chrome extension context (background script, popup, etc.).
Error: Schema validation failed: required field 'name' is missing
Creating a record without required fields as per schema definition.
fix
Ensure all required fields are provided when calling create().
Upgrade
Version history
1.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

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