Active Record(-ish) Pattern for Mikro-ORM (v1.0.6). Adds repository methods (findOne, create, persist, flush, getRepo) directly as static methods on entities, eliminating the need to manually retrieve the entity manager or repository. Designed for @mikro-orm/core ^4.0.0-rc.4. Alternative to Data Mapper pattern; opinionated and lightweight. Low release cadence (no recent updates). Ships TypeScript declarations.
npm install mikro-orm-arpNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to define an entity extending BaseEntity, initialize MikroORM, register the active record pattern, and use static methods like findOneOrFail, create, persist, flush, and getRepo.
Call register(orm) inside the .then() callback or await init.
Use @mikro-orm/core@^4.0.0-rc.4; upgrade cannot be done without package update.
Consider using Mikro-ORM's native entity manager or custom repositories.
Run npm install mikro-orm-arp @mikro-orm/core and ensure tsconfig.json includes "moduleResolution": "node".
Call register(orm) immediately after MikroORM.init().
Ensure register(orm) receives the full orm object from MikroORM.init().