I used TypeORM and ended up regretting it because of bugs and regressions. I felt that it was unsalvageable. Prisma is from a company so I did not consider it. I found MikroORM and got very interested with.
Relations can be resolved directly from an object (ie. user.org.load()) reducing the dependencies for a service (ie. just need an OrgService, not UserService).
Making mutations is a matter of simply changing a property. Normally, updates are flushed manually using em.flush(), but I have a hook to do it at the end of every requests.
Its request storage means that a lot of queries get deduplicated, which happens a lot on fat codebases:
// in FooWarehouseProcessorExcelExportManager
// performs a SELECT
const org = await user.org.load()
// logs 'ACME'
console.log(org.displayName)
org.displayName = 'ACME Corp Inc.'
// later in BarStorageMiddlewareS3UploadSession
// no SELECT! fetched from the request cache
const org = await user.org.load()
// logs 'ACME Corp Inc.'
console.log(org.displayName)
// at the end of the request, in PostgreSQL
begin
# other mutations
update org where id = 'blah' set displayName = 'ACME Corp Inc.'
commit
Finally, the maintainer is very responsive and generally great to interact with. It's probably the library that improved my work the most for the past two years.