A lightweight, non-invasive ORM for TypeScript/JavaScript that stores object trees into relational databases. Current version is 1.0.0-rc.1 (release candidate). Uses knight-criteria for query definitions and knight-sql for SQL generation. Designed to be minimal and flexible, supporting PostgreSQL, MySQL, and SQLite. Unlike heavier ORMs, it keeps domain objects free from framework annotations, using a separate schema definition for mapping. Supports CRUD operations, transactions via companion packages, and optional type safety with TypeScript.
npm install knight-ormNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows schema definition, ORM instantiation with PostgreSQL, and basic store operation.
Pin exact version and test after each RC update.
Always provide newInstance in schema options.
Set primaryKey: true on column mapping.
Add generated: true to primary key column.
Use dedicated dialect factories like MysqlFactory, PostgresFactory when available.
Correct import: import { Schema } from 'knight-orm' then const schema = new Schema()Add primaryKey: true to the id column definition in schema.addTable
Ensure table column mapping includes a 'name' entry with property 'name'