🗄️
Database200K+/wkMIT

@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
npm install @mikro-orm/core @mikro-orm/postgresql
yarn
yarn add @mikro-orm/core @mikro-orm/postgresql
pnpm
pnpm add @mikro-orm/core @mikro-orm/postgresql

Import

ESM
import { MikroORM, Entity, PrimaryKey, Property } from '@mikro-orm/core';

Quick Example

usage
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
CategoryDatabase
Weekly Downloads200K+
LicenseMIT
Installnpm install @mikro-orm/core @mikro-orm/postgresql

Related Packages

Browse npm Packages by Category

Explore our reference of 200 popular npm packages with install commands, examples, and quick-start guides.