TypeScript ORM for Node.js based on Data Mapper, Unit of Work, and Identity Map patterns. Version 6.1.4-rc-sti-changes-1 supports MongoDB, MySQL, MariaDB, PostgreSQL, and SQLite databases. Heavily inspired by Doctrine and Hibernate, it provides implicit transactions via flush(), change-set based persistence, and a rich set of features like migrations, embedded entities, and query building. It ships with TypeScript definitions and requires Node >= 18.12.0. Key differentiators: full TypeScript support, no decorator metadata reflection needed, and a clean, opinionated API.
npm install yandjin-mikro-ormNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows minimal setup: define an entity, init ORM with SQLite in-memory, persist and find entities.
Switch to ESM ("type": "module" in package.json) and use import syntax.Use em.persistAndFlush() for immediate flush, or em.persist() followed by em.flush().
Pass config object directly: MikroORM.init({ entities, dbName, ... }) or use defineConfig().Set "experimentalDecorators": true and "emitDecoratorMetadata": true in tsconfig.json.
Always include @Property() on every entity field you want to persist.
Add the entity class to the 'entities' array in defineConfig({ entities: [User] }).Add "type": "module" to package.json or rename file to .mjs.
Add @Entity() decorator to class and enable experimentalDecorators in tsconfig.json.
Add @PrimaryKey() decorator to the id property.