Registry / database / kay-orm

kay-orm

JSON →
library2.1.3jsnpmunverified

A lightweight TypeScript ORM with a focus on simplicity and type safety. Current stable version is 2.1.3. It provides basic CRUD operations and a simple query builder. Differentiates from heavier ORMs like TypeORM or Sequelize by having a minimal API surface and zero dependencies. Suitable for small to medium projects that need quick setup without complex migrations or relationships.

npm install kay-orm
INSTALL
IMPORT
SIG · KAY-ORM
K
kay-orm
databasejavascriptv2.1.3
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.

KayORM
import { KayORM } from 'kay-orm'
import KayORM from 'kay-orm'
It is a named export, not default.
Model
import { Model } from 'kay-orm'
const { Model } = require('kay-orm')
Library is ESM-only; do not use require().
QueryBuilder
import { QueryBuilder } from 'kay-orm'
import { QueryBuilder } from 'kay-orm/build/query-builder'
Do not import from internal paths; they may change.

Connects to an in-memory SQLite database, defines a User model, and demonstrates create, read, update, and delete operations.

import { KayORM, Model } from 'kay-orm'; interface User { id: number; name: string; email: string; } class UserModel extends Model<User> { tableName = 'users'; } const orm = new KayORM({ dialect: 'sqlite', database: ':memory:', }); async function main() { await orm.connect(); const userModel = new UserModel(orm); // Create const newUser = await userModel.create({ name: 'John', email: 'john@example.com' }); console.log('Created:', newUser); // Find all const users = await userModel.findAll(); console.log('All users:', users); // Update await userModel.update({ id: 1, name: 'Jane' }); // Delete await userModel.delete({ id: 1 }); await orm.close(); } main().catch(console.error);
Debug
Known issues
gotchaThe library does not support migrations or schema synchronization. You must create tables manually.
fix
Execute CREATE TABLE statements before using models, or use a migration tool like knex.
affects: >=0.0.0
gotchaOnly SQLite is supported as a dialect; other databases will throw an error.
fix
Use only SQLite. For other databases, consider using TypeORM or Sequelize.
affects: >=0.0.0
breakingVersion 2.0 changed the API: 'connect()' is now async and requires a config object.
fix
Update to use 'new KayORM({ dialect: 'sqlite', database: 'file.db' })' and await 'connect()'.
affects: >=2.0.0 <3.0.0
deprecatedThe 'findOne' method is deprecated in favor of 'findById'.
fix
Use 'model.findById(id)' instead of 'model.findOne({ id })'.
affects: >=2.1.0
Errors
Common errors & fixes
TypeError: orm.connect is not a function
Using version 1.x where connect was synchronous or missing.
fix
Upgrade to version 2.x and ensure you await the connect method.
No dialect provided in config
Missing dialect option when creating KayORM instance.
fix
Add dialect: 'sqlite' to the config object.
Model does not have a tableName property
Forgetting to set tableName in the Model subclass.
fix
Add static get tableName() { return 'users'; } to your model class.
Upgrade
Version history
2.1.3latest on npm
Audit
Dependencies

No dependency data recorded yet.

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