Skip to main content

mikro-orm-neo4j

A Neo4j driver for MikroORM that keeps the familiar API and speaks Cypher underneath — directed relationships, edge properties, streaming cursors, full-text indexes, stored routines and per-tenant subgraphs.

pnpm add mikro-orm-neo4j

The ORM you already know

Entities, the EntityManager, repositories, the unit of work and the identity map all behave the way MikroORM documents them. What changes is what runs: a filter becomes a Cypher pattern, a many-to-many becomes an edge, and a populate becomes a traversal.

import { MikroORM } from 'mikro-orm-neo4j';

const orm = await MikroORM.init({
clientUrl: 'bolt://localhost:7687',
user: 'neo4j',
password: 'password',
entities: [Book, Author, Tag],
});

// Filters traverse the graph — each hop becomes a pattern subquery.
const books = await orm.em.find(
Book,
{ price: { $gte: 10 }, author: { name: 'Ann' }, tags: { $some: { name: 'Fiction' } } },
{ populate: ['author'], orderBy: { title: 'ASC' }, limit: 20 },
);

Start here, or jump to what each filter operator compiles to.