MikroORM
mikro-orm.io
2
Leaving SiteNav
External Link Disclaimer
You are about to visit mikro-orm.io. This website is not operated by us. We are not responsible for its content or privacy practices.
About this website
MikroORM is a TypeScript object-relational mapper built on the Data Mapper, Unit of Work, and Identity Map patterns, created by Martin Adamek in 2018 and currently at version 7. The framework implements automatic change tracking through the Unit of Work pattern, where all entity modifications are tracked and flushed to the database in a single transactional batch when em.flush is called, eliminating the need for explicit save calls on individual entities. The Identity Map ensures that each entity is loaded only once per request context, preventing duplicate queries and maintaining referential consistency across the object graph. MikroORM supports twelve database backends including PostgreSQL, MySQL, MariaDB, SQLite, Microsoft SQL Server, Oracle, CockroachDB, MongoDB, Turso with libSQL, Cloudflare D1, PGlite for in-browser PostgreSQL, and Hasura serverless-postgres. Entity definitions can be written using three styles: the defineEntity function with full TypeScript type inference, decorator-based annotations with Entity, Property, and ManyToOne tags, or the EntitySchema builder for code-first schema generation. The query builder provides compile-time type checking for string-based filters, populate hints, and relation loading strategies including joined, select-in, and subquery approaches. Global and entity-level filters enable multi-tenancy through tenant-scoped queries, and soft delete is built in with automatic filtering of archived records. The SchemaGenerator can create, diff, and migrate schemas, while the EntityGenerator reverse-engineers entities from existing database tables. First-class Kysely integration provides a type-safe SQL query builder escape hatch for complex queries. The project is open source under the MIT license with active development and community support on Discord and Slack.
Statistics
2
Views
0
Clicks
0
Like
0
Dislike