
MikroOrm v4 /w GraphQL example project that I created over the weekend - croewens
https://github.com/driescroons/mikro-orm-graphql-example
======
bazza451
Currently using TypeORM in a production system, has caused us so many issues
to be honest highly recommend everyone avoiding.

IMO they’ve added every feature under the sun but not bothered on focusing on
quality, some things just don’t work at all, or you get stuck with horrific
performance issues. If we weren’t so far down the line with it I’d rip the
whole thing out although it’s causing so much pain I might just bite the
bullet and do it anyways

I did see MikroORM the other day and looked promising so cheers for the quick
review, if anyone else has any recommendations would be good to hear!

~~~
davedx
Looking through the docs it looks kind of like EntityFramework, which may or
may not be a good thing depending on your use case.

My goto for nodejs is still sequelize but without typescript...

------
dfee
I've also torn it up with MikroORM this weekend. I figured I'd give my 2¢
review of ORMs in NodeJS.

MikroORM: is maintained, with a lead developer who is receptive to feedback,
checks issues and responds. It's also built around the unit-of-work pattern.
Unfortunately, there are some bugs – and having looked at the lack and quality
of tests, this is unsurprising. Also, look at my note on type-native at the
end. Ultimately, I left the weekend with the following thoughts:

1) is using an ORM in NodeJS even worth it or should I just go a level higher
to Knex?

2) how smart is it to adopt a framework that may go unmaintained in the
future, and is already big enough (in complexity) with a lack of quality tests
and promising-but-incomplete docs? am I pointing a gun at my foot?

3) if I were going to go with an ORM in TypeScript today, this would be it. I
hope that download numbers will increase, the community will get larger, and
the product will continue to advance. The owner cares, but I don't think he
can get there on his own.

Non-MikroORM / Community: Many of the ORMs are abandoned – this includes
TypeORM, or aren't type-native [f1]. TypeORM was promising (I guess), but I'm
really reluctant to work with it on even the most basic tasks. That the
documentation is out of date, the issues are unresolved, and maintenance is
lacking make this a no-go for me.

p.s. I do sorely miss SQLAlchemy (thanks zzzeek for those good times) when
working with DBs in NodeJS.

[f1] type-native: this is actually a double edged sword. The ORM is never
going to have type-parity with the underlying DB. So, you really shouldn't
invest in building your "schemas" or "migration files" from type metadata. And
you'll also only ever be able to type the most basic queries. I'm concerned
MikroORM has gone too far down this path.

~~~
mdahlstrand
I went through the same thoughts as you and went straight to knex for my last
project. Turns out knex also has bugs and the limitations from having it
support all the databases means some really useful features are not available.

For my latest project I've gone with pg, writing sql directly, and I'm not
looking back. It's so nice not having to write sql through the abstraction
layer of knex.

Of course if you think you'll swap your database provider down the line, maybe
stay with knex. But I really can't see why I'd want to switch away from
postgres at a later date.

~~~
nawgz
Have you looked at Hasura?

For some of my latest dev, I've just stopped worrying about writing data
plumbing. I have a tool that I can use to update the schema from any arbitrary
state to any arbitrary state so long as there are no column modifications, and
then Hasura is able to query my entire schema via GraphQL.

You also get row, column, & table-level permissions, an easy auth hook, and
the promise of schema stitching (which I must admit I haven't used yet, so I
don't know if it's easy or performant).

I can't really speak to performance, but I think the Hasura guys did their
best to use Postgres' internals wherever possible. Try it out!

Also, a similar tool is "Xgenecloud", but I didn't like it as much and have
only invested time into Hasura.

~~~
xgenecloud
hey, XgeneCloud creator here. How can we improve ? which parts you didn't like

~~~
nawgz
I don't have great feedback for you, it's just that I downloaded and ran
xgenecloud and was exceedingly confused what to do from the UI that it
spawned. It didn't seem clear to me how I could get started, and my options
were plentiful; I would've been ok to make a new database thru your UI, point
your tool at an existing database, or anything else, but I just didn't have a
clear path to querying a schema.

With Hasura, I could run it with about 2 docker commands and build a schema
thru their web UI, use GraphiQL in their web UI to query the schema, and read
docs to get a clear path on how I might use this artifact in production.

I guess I would just use Hasura if I was you and see what the experience is
like vs XgeneCloud, maybe it will show you what I saw.

~~~
xgenecloud
I hear you - thank you for the feedback. I've got similar feedback from devs
who are liking XgeneCloud as well. We are in really early days of our journey
- I promise to improve this flow by many folds.

The way it currently works is :

* Each new project has a folder in your filesystem where GraphQL API source code is generated on pointing to database! So when we generate APIs, we also generate source code for those APIs (node.js/express.js) behind the scenes. This is a big leap on how easy it becomes to customise APIs or put some business logic in them

* Thereafter, as and when a developer changes schema (add table, add column etc) - the underlying GraphQL code also gets updated automatically.

Here is a demo of generating GraphQL on postgres & GUI based schema design:

[https://youtu.be/QEq3Mjbeelg](https://youtu.be/QEq3Mjbeelg)

[https://youtu.be/ETEEcY4mmEg](https://youtu.be/ETEEcY4mmEg)

Feel to free reach out on twitter/Discord (in profile). Happy to help you get
started.

edit: sentence corrections

------
moltar
I’m loving zapatos now.

Although not an ORM, it fits my needs.

