Registry / database / kv-orm

kv-orm

JSON →
library0.3.2jsnpmunverified

A Node.js ORM for key-value datastores, currently at version 0.3.2. Provides a model-based abstraction layer over KV stores like Cloudflare Workers KV, offering schema validation, relationship handling, and CRUD operations. Ships TypeScript types. Release cadence is low; pre-1.0 so APIs may break. Differentiates from raw KV clients by providing an ORM-style interface with models, attributes, and queries. Suited for simple KV-backed applications but not for complex relational needs.

npm install kv-orm
INSTALL
IMPORT
SIG · KV-ORM
K
kv-orm
databasejavascriptv0.3.2
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.

Model
import { Model } from 'kv-orm'
const Model = require('kv-orm')
ESM only; CommonJS require() will not work.
types (e.g., ModelClass)
import type { ModelClass } from 'kv-orm'
import { ModelClass } from 'kv-orm'
TypeScript users should use type-only imports for interfaces and types to avoid runtime overhead.
default export
import kvOrm from 'kv-orm'
const kvOrm = require('kv-orm')
Module has both named and default exports; use import style.

Defines a User model with schema, creates a new user, saves it to a KV store, retrieves it, and deletes it.

import { Model } from 'kv-orm'; class User extends Model { static schema = { id: { type: 'string', required: true }, name: { type: 'string' }, email: { type: 'string' } }; } const user = new User({ id: 'u1', name: 'Alice', email: 'alice@example.com' }); await user.save(); const fetched = await User.get('u1'); console.log(fetched.name); // Alice await fetched.delete(); console.log('User deleted');
Debug
Known issues
breakingPre-1.0 version: API may change without major version bump. Semver not guaranteed until 1.0.
fix
Pin to exact version and test on upgrade.
affects: >=0.0.0 <1.0.0
gotchaModel instances are not auto-synced with the store; manual save/delete required after mutation.
fix
Always call .save() after modifying instance properties.
affects: >=0.0.0
deprecatedSome internal methods may be renamed in future releases; watch for deprecation warnings in console.
fix
Use public API documented in README.
affects: >=0.3.0
Errors
Common errors & fixes
Cannot find module 'kv-orm'
Package not installed or ESM not configured
fix
Run: npm install kv-orm
Ensure your project uses ES modules (type: 'module' in package.json or .mjs extension)
TypeError: Model is not a constructor
Using CommonJS require() instead of ESM import
fix
Use: import { Model } from 'kv-orm'
Upgrade
Version history
0.3.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
packagekv-orm
kv-orm — npm install kv-orm · libregistry