TypeScript ORM for Node.js built on Data Mapper, Unit of Work and Identity Map
open sourceMITfree
MikroORM is a TypeScript ORM for Node.js based on the Data Mapper, Unit of Work and Identity Map patterns, heavily inspired by Doctrine and Hibernate. It tracks changes to entities automatically and flushes them in a single transaction. It supports MongoDB, MySQL, MariaDB, PostgreSQL (including CockroachDB and PGlite), SQLite (including libSQL), MS SQL Server and Oracle through driver packages, and has a QueryBuilder and Kysely integration, a schema generator, migrations, an entity generator and seeding.
Problems it solves
- use an ORM with unit of work and identity map in a TypeScript Node.js app
- map TypeScript entities to PostgreSQL, MySQL or MongoDB
- generate and run database migrations from TypeScript entities
Features
- Identity Map and Unit of Work: automatic change tracking, flushed in one transaction
- entities defined with defineEntity, decorators or EntitySchema
- drivers for PostgreSQL, MySQL, MariaDB, SQLite, libSQL, MongoDB, MS SQL Server and Oracle
- QueryBuilder and Kysely integration
- schema generator, migrations, entity generator and seeding
- filters, lifecycle hooks, embeddables, custom types and composite keys
Limitations
- Only the latest major version gets new features and bug fixes; the previous one gets only high and critical security fixes for 12 months.1
Alternatives
The same job
These do what MikroORM does.
- Prisma ORM One schema. Every query type-safe.
- TypeORM TypeScript ORM with DataMapper and ActiveRecord patterns
- Drizzle ORM Lightweight, type-safe TypeScript ORM for SQL databases
- Sequelize Feature-rich ORM for modern TypeScript and JavaScript
- sqlc Compile SQL to type-safe code
