@mikro-orm/core
MikroORM is a TypeScript ORM for Node.js based on the Data Mapper, Unit of Work, and Identity Map patterns, supporting PostgreSQL, MySQL, MariaDB, SQLite, and M…
Installation
npm install @mikro-orm/core @mikro-orm/postgresql
yarn add @mikro-orm/core @mikro-orm/postgresql
pnpm add @mikro-orm/core @mikro-orm/postgresql
Import
import { MikroORM, Entity, PrimaryKey, Property } from '@mikro-orm/core';Quick Example
import { Entity, PrimaryKey, Property } from '@mikro-orm/core';
@Entity()
export class User {
@PrimaryKey()
id!: number;
@Property()
name!: string;
@Property()
email!: string;
}About @mikro-orm/core
MikroORM is a TypeScript ORM for Node.js based on the Data Mapper, Unit of Work, and Identity Map patterns, supporting PostgreSQL, MySQL, MariaDB, SQLite, and MongoDB. Inspired by Doctrine (PHP) and Hibernate (Java), MikroORM provides entity management through a centralized EntityManager that tracks all loaded entities and automatically persists changes through a unit of work — meaning you modify entity properties directly and MikroORM determines the minimal set of SQL statements needed. The Identity Map ensures that loading the same database row twice returns the same JavaScript object reference, preventing inconsistency. MikroORM supports entity decorators, embedded entities, single table and joined table inheritance, collections with lazy loading, bidirectional relations, query builder with subqueries, native SQL, database migrations, and seeders. The framework integrates with NestJS, Express, and Fastify through official packages. MikroORM provides automatic change detection by comparing entity snapshots, eliminating the need for explicit save calls. The serialization system handles circular references and allows custom serialization rules. MikroORM is an excellent choice for complex domain models where the unit of work pattern provides clear benefits over simpler active record approaches.
Quick Facts
| Package | @mikro-orm/core |
| Category | Database |
| Weekly Downloads | 200K+ |
| License | MIT |
| Install | npm install @mikro-orm/core @mikro-orm/postgresql |
Related Packages
TypeORM is a full-featured ORM for TypeScript and JavaScript that supports both Active Record and Da…
Prisma is a next-generation Node.js and TypeScript ORM that provides a declarative data modeling lan…
Sequelize is a promise-based Node.js ORM that supports PostgreSQL, MySQL, MariaDB, SQLite, and Micro…
Knex.js is a batteries-included SQL query builder for Node.js that supports PostgreSQL, MySQL, Maria…
NestJS is a progressive Node.js framework for building efficient, reliable, and scalable server-side…
Browse npm Packages by Category
Explore our reference of 200 popular npm packages with install commands, examples, and quick-start guides.