Registry / database / kanso-orm

kanso-orm

JSON →
library0.0.26jsnpmunverified

A lightweight ORM for PostgreSQL, currently in early development (v0.0.26). It provides a model factory with CRUD operations, hooks (pre/post), relationships, and streaming support. Unlike more mature ORMs like Sequelize or TypeORM, Kanso is minimal and unfinished, lacking transactions, query builders, and migration tools. Release cadence is irregular.

npm install kanso-orm
INSTALL
IMPORT
SIG · KANSO-ORM
K
kanso-orm
databasejavascriptv0.0.26
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.

ModelFactory
import { ModelFactory } from 'kanso-orm'
const ModelFactory = require('kanso-orm')
ESM-only, no CommonJS export.
Model
import { Model } from 'kanso-orm'
Named export for base model class.
default
import Kanso from 'kanso-orm'
import * as Kanso from 'kanso-orm'
Default export is the main ORM instance.

Initialize a ModelFactory, define a User model with schema and methods, create a user, and save to DB.

import { ModelFactory } from 'kanso-orm'; const factory = new ModelFactory({ host: process.env.DB_HOST ?? 'localhost', port: parseInt(process.env.DB_PORT ?? '5432'), database: process.env.DB_NAME ?? 'mydb', user: process.env.DB_USER ?? 'postgres', password: process.env.DB_PASS ?? '' }); const User = factory.model('User', { schema: { id: 'serial', name: 'string', email: 'string' }, methods: { fullName() { return this.name; } } }); const user = await User.create({ name: 'Alice', email: 'alice@example.com' }); console.log(user.fullName()); // Alice await user.save();
Debug
Known issues
gotchaPasswords are logged in plaintext when connection fails.
fix
Do not use in production; wrap in try/catch and sanitize logs.
affects: 0.0.0 - 0.0.26
breakingModel schema definition changed from 'attributes' to 'schema' in v0.0.20.
fix
Use 'schema' key instead of 'attributes'.
affects: <0.0.20
deprecatedThe 'include' method in ModelFactory is unstable and signature may change.
fix
Avoid using 'include' until stable; prefer raw SQL for joins.
affects: >=0.0.15
Errors
Common errors & fixes
Cannot find module 'kanso-orm'
Package not installed or wrong import path.
fix
Run 'npm install kanso-orm' and ensure import uses ESM syntax.
TypeError: factory.model is not a function
Using CommonJS require syntax on an ESM-only package.
fix
Use 'import { ModelFactory } from 'kanso-orm'' instead of require.
Upgrade
Version history
0.0.26latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
kanso-orm — npm install kanso-orm · libregistry