mikro-orm / mikro-orm

TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, MariaDB, MS SQL Server, PostgreSQL and SQLite/libSQL databases.
https://mikro-orm.io
MIT License
7.36k stars 500 forks source link

Who uses MikroORM in production? #296

Open jeffbum opened 4 years ago

jeffbum commented 4 years ago

Hi there, I am currently evaluating a bunch of orm-a-like libraries for an upcoming project.

I have experience with sequelize and waterline. I found mikro-orm while trying to choose a new ORM for a company I work for. I noticed there are not a ton of stars or used by stats quite yet on this project, but after reading through the docs, I think it has great potential.

It deserves more traction and I am asking myself - why is mikro-orm not more popular? And who is actually using it in production?

I know it sounds stupid, but is there some who-uses-it listing I can show to an IT decision maker?

Nevertheless, you did an awesome job and built a great library!

P.S.-- I stole the outline of this comment from https://github.com/Vincit/objection.js/issues/1069.

B4nan commented 4 years ago

Hello there and thanks! Unfortunately there is no list of users/companies, obviously I know about few people using it (starting with myself :]). Let's keep this open and pinned to the top, hopefully we will get some feedback here.

About the "low" popularity, I think I am the one to blame - I love programming, much more than writing (and if I do write, I usually write the docs instead of articles). There are very little articles about MikroORM and those that I wrote did not get much traction. Unfortunately I have very weak (and not very programming oriented) audience on social networks, so it is hard for me to promote it properly.

Regarding articles, I picked medium.com as the platform of choice, but I have seen pretty negative feedback in general to medium during last few months, so I am considering to go with dev.to as the main platform (reposting it to medium too). I do have simple blog now on the website as well, but there are no comments and reactions available, so I think dev.to will be better choice. Another problem I had was with Daily.JS, I had to ask multiple times to promote the article (share on their behalf) on their twitter account. Maybe another publisher would suite better.

I hope the v3 release will get more traction and things will start moving more rapidly. I spend last 2 weeks vacationing, but I'd like to finalize the release article soon and get it out finally.

Btw keep in mind that this project is still relatively young, I "went public" with it with v2 in 04/2019. And you know, it's just another ORM in the JS world :]

jeffbum commented 4 years ago

@B4nan Thanks for replying! I have been researching ORM's for Node this past week, and am really intrigued with Mikro-orm. I'm presenting it as an option for my company.

lookfirst commented 4 years ago

@jeffbum You don't know me, but trust me, go with Mikro.

As @B4nan says, it is just a popularity contest. Mikro is pretty new, v3 is definitely new, but the code is excellent and Martin is totally wonderful to work with. This is by far the best ORM for JS/TS on the market. The rest do not even compare.

jeffbum commented 4 years ago

@lookfirst I appreciate the recommendation. At the moment, chose another direction, but I am quietly duplicating efforts in Mikro to be able to compare side-by-side with the other orm. Just in case I want to make a mid-game switch ;)

lookfirst commented 4 years ago

@jeffbum Interesting feedback for sure! Can we expand on that? Would be good to know your thoughts. Your thoughts are appreciated because I think it would help others make their decisions as well as help this project in marketing.

  1. What ORM did you end up with?
  2. What made you not choose Mikro as the primary?
  3. Are you sure you can make a comparison? For example, no other ORM will allow you to do UoW modifications so I'm wondering how you would handle that.

Maybe others have questions for you as well...

ujwal-setlur commented 4 years ago

I am doing the same research for my project, and was considering prisma2, when I ran across Mikro-ORM in a medium article. Looks very very intriguing, so I guess I am going to dig more.

lookfirst commented 4 years ago

For me, one primary thing I deem absolutely necessary with working with sql databases, is strong transactional support. Just searching the respective repositories should give you a hint about which one to go with... Mikro ORM vs. Prisma2

doublemcz commented 4 years ago

I use this ORM in 3 apps and so far I must say, it is brilliant. The simple usage of MikroORM is really nice. I switched to this because TypeORM and Typegoose have really bad UX.

I use this FW as follows at this moment:

1) With Restify - Rock solid Production env - app is doing accounting stuff (wages!, it must be really stable, I have not found an issue) 2) With Nest.js - Production - IoT server for managing client subscriptions and writing them to the DB 3) With Nest.js - App is in RC - Gaming API 4) Electron - I am working on an Electron app that wraps VPN Cisco AnyConnect client to build nicer UI with features like automatic setting up proxy and more - this ORM should act like bridge for logging to HDD. I haven't progressed yet, but this is the target. Hopefully, I will crack it soon.

Martin

Kudos to @B4nan. Once I am in Prague, will pay you some nice and delicious pizza or burger.

RDeluxe commented 4 years ago

We started using Mikro for our projects, and we plan to continue in the future. Great work, we are spreading the word !

CosmeLorim commented 4 years ago

I am using it in one project and a co-worker is using it in two more projects by my recommendation, all in a serverless environment. Using mikro-orm has been very productive!

jasonpincin commented 4 years ago

Hello! This is not a feature request, but rather feedback, since this issue seems to be seeking it.

I'm evaluating "light" ORMs for a big project and mikro-orm looks fantastic. The one likely blocker for me choosing it is the seeming inability to have multiple database connections (correct me if I'm wrong). For this project, we aim to expose the ability for subsystems/models to choose from one of several persistence layers, and as such need the ability to dictate which layer a model is backed by.

Typeorm supports this via: @Entity({ database: "dbName" })

Unfortunately, no matter what ORM I choose I need to implement a custom driver for one of our stores, and the path to accomplishing that is not nearly as clear in Typeorm as it is in Mikro-orm, so I'm still at a cross-roads on my evaluation. I'd like to offer our contributors a consistent modeling language without having to be concerned with all the details, but easier said than done.

Regardless, great work going on here! I will certainly be watching this project πŸ‘

B4nan commented 4 years ago

Why do you think it's not possible? You can have multiple ORM instances, and let it discover different entities:

const orm1 = await MikroORM.init({ entities: [EntityA], dbName: 'db1' });
const orm2 = await MikroORM.init({ entities: [EntityB], dbName: 'db2' });

You would have to create custom CLI script that would handle the distinction for you, but that is also very simple (just instantiate the ORM with right config based on some argument - everything from the CLI can be used programatically.

jasonpincin commented 4 years ago

Oh, interesting - I was digging into the possibility of that, when I found this comment:

https://github.com/mikro-orm/mikro-orm/issues/77#issuecomment-513963245

Which seemed to imply there was some global state that would make multiple instances not a good idea. Perhaps this has changed; I'll look further! Thanks so much for the response.

B4nan commented 4 years ago

The problem with that was reusing the entity definition, but if you will have dedicated entities for each connection, there is no problem.

Btw ORM's tests are using the same set of entities for mysql and postgres.

jasonpincin commented 4 years ago

Fantastic - didn't mean to derail the thread; but with this news I look forward to reporting back on production usage after we POC this.

whocaresk commented 3 years ago

Hello, we are running MikroORM v3 in production for six month or so at our time tracker app. So far no issue at all. Compared to typeorm, used previously - it is just and ideal ORM, that really reduced complexity of our infra layer and let focus on domain logic.
Overall - every ORM, that i tried before in nodejs world wasn't that friendly as MikroORM is. High quality types and good library design. Just fell in love with it :)

If you are interested in checking out our app - here is main site link: https://workapp.ai/en/ and app link is: https://private.workapp.ai/auth/register/?lang=en
Free till the end of this year for up to 100 employees. :)

vimmerru commented 3 years ago

Switched from TypeORM and use it in 3 production projects already. Main reasons:

Disadvantages:

In general time consumed with fighting bugs compensated with profit by clean code and absence of boilerplate.

alpharder commented 3 years ago

One production project is in the middle of migration from TypeORM, the second one uses MikroORM since day 0.

In general MikroORM is much more thoughtful and predictable than TypeORM. Even junior developers got used it within a single day. I can really say that MikroORM saves time instead of eating it like many ORMs do.

There are some things that are missing comparable to TypeORM but I'm still unsure whether they are actually needed at all.

The support is awesome and this is the first ever library that I've backed with donations. Keep going, its awesome! Going to contribute with PRs as I dive into it little bit deeper.

lookfirst commented 3 years ago

There are some things that are missing comparable to TypeORM but I'm still unsure whether they are actually needed at all.

Like what?

elmpp commented 3 years ago

There are some things that are missing comparable to TypeORM but I'm still unsure whether they are actually needed at all.

Like what?

For SQLite, the feature sets aren't even close:

I suspect that for Web 3.0 (graphql etc) style applications Mikro will be a no brainer.

However, just look at TypeORM's test suite to truly appreciate the cumulative effort that goes into supporting such a featureset

Personally, i feel the maintainers of TypeORM are really underappreciated

alpharder commented 3 years ago

Like what?

Native JSON support for filtering, sorting etc.

bverhoeve commented 3 years ago

I'm considering using Mikro ORM in production at my company. Do you have an idea of the future of the project and the roadmap? We are trying to assess the risk of discontinuation of the project when it's an integral part of our stack. Cheers!

Jasenkoo commented 3 years ago

Currently in the process of switching to MikroORM v4 in my company. Previously used TypeORM, but had so many issues in the applications that relay heavily on the database. I really like like this library, so far no complaints. DX is on point. Other reasons like vimmerru comment pros. You are doing an amazing job.

bkstorm commented 3 years ago

I'm going to use Mikro ORM in my next project, it's an important service in our system, TypeORM has so many issues, that is why I looked for a new ORM library, and I think Mikro ORM maybe a good choice. Anyway, I will use it and let you know pros and cos.

jbmikk commented 3 years ago

I work for a consulting firm and we are using it for one of our clients. It is not in production yet, but we already have an MVP that's going to be released soon. We rely on some new features, custom-types specifically, so we are still catching some bugs. But so far we managed to fix those and get the fixes in pretty quickly.

lytc commented 3 years ago

I've just gave to this repo 2 stars! I was using Sequelize, Bookshelf and TypeORM but MikroORM look very impressive to me compare to those libs!

ujwal-setlur commented 3 years ago

We use MikroORM at Byte Technology in a microservices environment with moleculer,TypeGraphQL, and casl. We took our first service into production last year, with more to come this year. MikroORM is great!

jjhbw commented 3 years ago

We use it in production for an Electron application combined with sqlite. We migrated from TypeORM before release because it contained a few too many nasty surprises. Very satisfied so far, especially with query performance and the documentation.

The identity map pattern took some time to get used to, as it seems tailored towards a request-response API endpoint context where the identity map will only live as long as the runtime of the request handler. Our DB layer logic was a bit too tightly coupled to the views, so we had to introduce an abstraction layer to ensure the identity map lifetime was properly managed. Anyway, the query optimizations that this pattern enables (even with complex nested entities) are totally worth it.

jahudka commented 3 years ago

I'm currently starting a new project and considering Mikro. In a couple of other projects at our company we're using TypeORM and although I've had my fair share of issues with it, in the end I don't think my experience with it was as bad as everyone else's here.. but Mikro looks so good that I'm tempted anyway.

The only issue I'm not sure how to solve is that this new project should be backed by Cockroach DB. Now, I know it should be easy enough to implement a custom driver, especially since it could be derived from the existing Postgres implementation - but I need to be able to specify multiple nodes in the cluster to connect to and have the ORM use those that are alive. This is different from read replicas as the nodes are all equivalent.

Reading through the code I think that at the end of the day this actually isn't something easily solved within Mikro, because Mikro relies on Knex to create and manage the connection, and Knex only supports the pg driver, which currently doesn't support this. TypeORM, on the other hand, uses pg-native, if it's available - and since libpq supports multiple hosts, so does pg-native, and therefore so does (or should) TypeORM.

I'll try to make things work with Mikro anyway, because I think it's awesome and I'm really excited to try it!

yomansk8 commented 2 years ago

We are using MikroORM at Vytruve too! It's powering our main API alongside NestJS since the beginning of the project in May 2021.

We're using it with postgresql driver, and for now, it's only love between MikroORM and our devs team!

Thanks for such a great work! πŸ™

Frank-D commented 2 years ago

The only issue I'm not sure how to solve is that this new project should be backed by Cockroach DB. Now, I know it should be easy enough to implement a custom driver, especially since it could be derived from the existing Postgres implementation - but I need to be able to specify multiple nodes in the cluster to connect to and have the ORM use those that are alive. This is different from read replicas as the nodes are all equivalent.

Reading through the code I think that at the end of the day this actually isn't something easily solved within Mikro, because Mikro relies on Knex to create and manage the connection, and Knex only supports the pg driver, which currently doesn't support this.

I'll try to make things work with Mikro anyway, because I think it's awesome and I'm really excited to try it!

Hi @jahudka ! I was about to start a new project, and after several online research and readings, I was looking at exactly the same ~db setup as you, e.g. MikroORM+Cockroach DB [serverless] (..on top of nestjs+graphql/apollo-server-fastify).

I was wondering if you've been able to make any good progress since the time you posted that comment above?

Do MikroORM & Cockroach play well together? Did you have to write lots of custom code (any at all?) to make them work together? I'm wondering how much effort is required to write the custom driver to add support for cockroach, I haven't looked at this topic yet.. (e.g. adapt the existing ootb mikro's postgres driver to support cockroach..). How about the problem you were precisely describing, around having Mikro to handle multiple Cockroach live hosts/nodes connections, have you made any progress on that one? Any insights would be much appreciated, thanks!


I haven't seen much info online re the use of MikroORM + CochroachDB, and one of the only one I found is a +- recent issue created on 2021-09-05 (ref.: https://issueexplorer.com/issue/mikro-orm/mikro-orm/2171), someone getting a "error: server requires encryption" error trying to connect to cockroach db using MikroORM v4.5.9 and the ootb postgres driver. (perhaps that user was missing at least the key param in ssl config obj to properly encrypt, and optionally the ca param too if also needed by cockroach, or based on the user's client cert structure/bundling..? ref.)

jahudka commented 2 years ago

Hi @Frank-D, I'm using Mikro with Cockroach on a single project for now and although I do have some custom code to make it play nice, it's mostly to make migrations work (to an extent). I haven't been able to make the driver select a live node from a list, but I haven't really spent a lot of time on it. As I understand it, there's some work which needs to be done in pg and in knex to achieve true compatibility in MikroORM and it appears that some of that work is in fact being done, so I figured I'd wait before digging deeper.

Frank-D commented 2 years ago

Thanks @jahudka for your quick reply. I'm currently unable to make it work ootb on my local, using Mikro with the 'postgresql' type, against a local running cockroachdb docker image, because when starting node, Knex tries to verify the db version from the connection mikro config I provided, and it fails since it receives from db the version string "Cockroach..." instead of expected "Postgre..." (ref.), which gives me the below error:

<my_project>/node_modules/@mikro-orm/knex/node_modules/knex/lib/dialects/postgres/index.js:148
        resolver(/^PostgreSQL (.*?)( |$)/.exec(resp.rows[0].version)[1]);
                                                                    ^
TypeError: Cannot read properties of null (reading '1')
    at Query.<anonymous> (<my_project>/node_modules/@mikro-orm/knex/node_modules/knex/lib/dialects/postgres/index.js:148:69)

In fact, Knex now seems to support cockroachdb (not sure to what extent though, was added 2-3 months back, but they now published on their website that they do support cockroach so..), starting with version knex 0.95.12.

And Mikro master currently points at knex 0.95.15, meaning that Mikro now has access to knex's new cockroachdb dialect support (current Mikro latest release is 4.5.10 which points at knex 0.21.19, which doesn't has such cockroachdb dialect though..). However, based on my super basic understanding here, I'm assuming that someone will most likely have to clone @mikro-orm/postgres, and rename/adapt it for cockroachdb, and ensure it leverages/points at knex's cockroachdb dialect, rather than the postgres one (is that fair to say @B4nan, is this what will eventually be needed to make it work with cockroach iyo? I actually cloned latest master, wanted to look into it..but after looking at the few files under the postgres package to be adapted for cockroach, it's a little more work than I anticipated πŸ˜† for the time that I have for my current project, so I need something a tad more ootb than that at this moment in time..).


In the meantime, I'm curious how you were able to make it work @jahudka, with Mikro against CockroachDB using the postgresql mikro type/driver (..which uses knex's postgres dialect..) πŸ€” (I'm not even talking about migrations, but just simple CRUD use cases at this point..)....is there anything you would be ok to share?

I really had envisioned to leverage MikroORM in production (hence this thread) with the new/recent CockroachDB Serverless offering, but without proper Mikro support for knex's cockroach dialect, I might just end up using knex directly for this one project, and revisit Mikro later to see how it stands re cockroach. Mikro was really appealing to me though, so it's not over...just, next time perhaps..:)

(created request to add cockroach support in cockroach's space as well: https://github.com/cockroachdb/cockroach/issues/74564)

co-sic commented 2 years ago

We are using mikro-orm at gastromatic for our new microservice based project with a federated Graphql Api and multiple Postgres DB's, which is moving to production next week.

The whole team is really enjoying working with mikro-orm and the communication with @B4nan has been really good. Can totally recommend working with this orm!

woltob commented 2 years ago

We use MikroORM at Byte Technology in a microservices environment with moleculer,TypeGraphQL, and casl. We took our first service into production last year, with more to come this year. MikroORM is great!

Hi ujwal-setlur @ujwal-setlur , I couldn't write you on Twitter. I am wondering whether you can share with me how you successfully integrated CASL with MikroORM to have an easy approach with Permissions / Authorization etc.

Just a couple of code snippets would probably be enough. Thank you so much! Especially I am interested in the conditional queries with nested entities.

@B4nan is there any official library planned for MikroORM and CASL? This would be amazing and another good push for your ORM (check out the adapter for PRISMA https://github.com/stalniy/casl/tree/master/packages/casl-prisma)

woltob commented 2 years ago

@co-sic how to you efficiently solve the GraphQL Authorization at gastromatic? Using CASL as well or custom conditions (if-else => exceptions) with custom queries? Thanks for some insights as we all seem to share a very similar tech stack.

Alwinator commented 2 years ago

You could reach many people not only by writing articles about MikroORM but also by sharing MikroORM on YouTube. For example, YouTube channels like FireShip have a huge programming audience. I will send him a message, maybe he makes a video about MikroORM.

Jedliu commented 2 years ago

You could reach many people not only by writing articles about MikroORM but also by sharing MikroORM on YouTube. For example, YouTube channels like FireShip have a huge programming audience. I will send him a message, maybe he makes a video about MikroORM.

I think it's a good idea. It's my first day coming here by someone's recommendation. I did some research on Youtube and the internet but found very few things related. Still need to look into more to decide if should migrate from TypeOrm to MikcroOrm. Cheers!

Alwinator commented 2 years ago

@Jedliu I migrated from TypeOrm to MikroOrm. First it seemed similar, but when you actually migrate you will realize that there is more difference than expected. However, after migrating I can say that it was one of my best decisions.

productdevbook commented 2 years ago

I migrated TypeOrm to MikroOrm. with Nestjs used. Very very beatiful. Thank you @B4nan

YegorMy commented 1 year ago

I use it in my not that heavily loaded pet-projects, a small custom made CRM for 3D printing (10k+ entities and counting) and on my main job. No major issues so far

giancarlo-dm commented 1 year ago

We are using MikroORM in production with our brand new Marketing/E-commerce site (Broadway Media Distribution) that is going live in June (we are using NestJS as well). I am the tech lead of the team and I can say that I am amazed by this project! In the past (2017-2019) I used TypeORM a lot and was frustrated by the lack of documentation and support on GitHub issues (I still have an open issue with multiple people saying they had the same problem but without any official responses). With that I want to say the following about MikroORM:

nichenqin commented 1 year ago

I'm using mikro orm in my project https://github.com/undb-xyz/undb. It's a no code database so the feature unit of work help me to separate business logic from database code. I have best migration experience when I use mikro orm . Great job from @B4nan

ujwal-setlur commented 1 year ago

I’ve been using MikroORM on a number of production projects the past few years. It’s part of our tech stack which includes moleculerJS s the microservices framework. We’ll be going into production at snippetsentry.com in the next few weeks. MikroORM is awesome!

itxtoledo commented 1 year ago

We use mikro-orm at Coinsamba.com

giovanni-orciuolo commented 11 months ago

We use mikro-orm at my company Overzoom

leonard-henriquez commented 6 months ago

My company, Topo, is currently using Prisma but we are running into to many issues. We are looking to migrate another ORM. We are evaluating many options such as Drizzle, Sequelize, TypeORM, Objection, Knex, Kysely and of course, MikroORM. So far we're really impressed with what MikroORM and it seems to tick our boxes pretty well!

However, we've got some concerns about long-term support. From our research, it looks like @B4nan is the main force behind MikroORM (congrats πŸŽ‰) ! But we couldn't help but notice that the project seems to have limited active contributors, especially in terms of code contributions.

This leads us to wonder about the future of MikroORM. What would happen if you become unavailable or something happened to you (sorry to mention this scenario) ? Are there any thoughts about bringing more maintainers on board to ensure the project's longevity?

Any insights into your long-term strategy for MikroORM would be super helpful as we decide whether it's the right fit for us.

Anyways, thank you for all your hard work on this project!

B4nan commented 6 months ago

I always welcome contributions, it's usually more about the contributors not having much spare time, so not many people stick around for long. I would love to have more people on board to be able to discuss the internals, and in a way, things are getting better already, the slack community is pretty lively.

I do plan to continue the development in the foreseeable future, although to be able to dedicate more time to it, there would have to be some new larger sponsors, right now the funding won't pay the bills :] Even if I don't have much time for feature development in the future, I've always preferred fixing bugs and helping out others with issues, and I am dedicated to continuing to do so.

That's the best I can say right now, let's see what next year brings.

boenrobot commented 5 months ago

it's usually more about the contributors not having much spare time

As someone who now has some PRs merged and more planned, I'd like to add on top of that, the other reason for few contributors and even less sticking around is quite simple... ORMs are complex to implement. On a subject domain / knowledge base level that is (MikroORM is ok in the measurable factors of "complexity" like function size, nested levels, etc.).

My PRs are focused on the entity generator mostly because I find this subset simple to get involved in. If I though MikroORM needed significant refactor in a more substancial way, I wouldn't contribute or use it at all... I'd just look for an alternative.

And again, that is the case for ORMs in general, not MikroORM specifically, so I don't think there's an easy way to reduce complexity without losing performance, features, or both.

funduck commented 5 months ago

In Airhead we have a new service coming to prod in 3-4 weeks and it uses MikroORM + Mongo Just noticed that v6 is released a few days ago and it is so great because I worried how I deal with lack of UnderscoreStrategy in Mongo, but now it is here, thank you @B4nan!!!