advanced

MikroORM

Understand MikroORM through identity map, Unit of Work, entity manager, and Data Mapper style persistence.

MikroORM interviews target Data Mapper workflows: identity map, Unit of Work, and entity manager scoping. Often optional for FullStack roles but useful for discussing rich domain models in TypeScript.

Subtopics: identity map, Unit of Work, entity manager.

On interviews: explain request forking, flush timing, and why global entity managers are unsafe in web servers.

Common pitfalls: detached entity confusion; flush surprise; cascades deleting unexpected graphs.

The trade-off is domain-centric persistence versus ceremony and scope discipline.

Checklist:

  • Fork entity manager per request.
  • Understand dirty checking and flush.
  • Keep cascades explicit.
  • Do not share persistence context across users.