A lightweight, type-safe ORM wrapper around the Kysely query builder, providing a model-based layer with automatic transaction management via Node.js AsyncLocalStorage. v0.9.7 (released 2023) works only with Kysely ~0.24.0 and Node >=16.2.0. Key differentiators: no separate transaction object needed, per-model operations (insert, findOne), and built-in afterCommit hooks. Replaces manual Kysely usage with a simpler, Rails-like active record pattern while preserving full type safety through TypeScript generics.
npm install kysely-ormNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a Database instance with Postgres dialect, defines a User model, and inserts a new user.
Upgrade Node to 16.2.0 or higher.
Use 'extends db.model('tablename', 'primaryKey')'.Wrap callbacks in util.promisify or AsyncResource.bind to preserve transaction context.
Consider using Kysely's built-in typed select/insert helpers or a maintained alternative.
Ensure package.json has 'type': 'module' and tsconfig.json has 'moduleResolution': 'node16' or 'bundler'.
Verify 'import { Database } from 'kysely-orm'' and that the constructor is called with a valid dialect.Add the DB type: 'new Database<DB>({ dialect: ... })'.