Hacker News new | ask | show | jobs
by mattgreenrocks 408 days ago
Yep. The ORM situation in JS is not great. There’s no one go-to, and it seems like the question often prompts a patronizing response about how ORMs aren't really necessary. Kysely is really great, but it’s not an ORM.

My take: the JS ecosystem tends to avoid abstraction for whatever reason. Example: they don’t believe that their web framework should transparently validate that the form submission has the correct shape because that’s too magical. Instead the Right Way is to learn a DSL (such as Zod) to describe the shape of the input, then manually write the code to check it. Every single time. Oh and you can’t write a TS type to do that because Reasons. It all comes off as willful ignorance of literally a decade or more of established platforms such as Rails/Spring/ASP.NET. All they had to do was steal the good ideas. But I suspect the cardinal sin of those frameworks was that they were no longer cool.

I have a hard time relaying this without sounding too negative. I tried to get into SSR webdev with TS and kept an open mind about it. But the necessary ingredients for me weren’t there. It’s a shame because Vite is such a pleasure to develop with.

5 comments

The curse of being an experienced developer is watching good things go away, and then get re-invented and everyone hails them as a major innovation without any awareness that this has existed for a long time.

Someone will steal the good ideas eventually. And everyone will act like it’s the first time this idea has ever come up. I’ve seen it happen a few times now, and each time it makes me feel ancient.

It's happening for me too often the older I get. I remember reading the seniors of my days complaining about it. I guess it's my turn now...

As a side effect this reminds me how much I must not know what I don't know. It's a bit scary.

> There’s no one go-to

I thought Prisma.js was the most popular by far? It's the one I've always seen used in docs and examples.

Yes it's pretty good though it falls short of my golden standard (Django) by missing good automatic migrations and transactions in migrations.
We had to write a migration layer on top of Prisma that can run arbitrary code to do things like transactions in migrations. Kind of a bummer that something like that's not built-in to the system but it was also trivial to put together.
Not anymore, now it's Drizzle
lol and next year it'll be something else. Drizzle isn't even 1.x
Well, we're not the "go to" yet :-) but if you want an entity-based ORM that isn't just a query builder, Joist has several amazing features (no N+1s) and great ergonomics https://joist-orm.io/
What's wrong with TypeORM (besides being javascript of course)? Works alright, creates migrations based on entities automatically, and I really haven't had any issues with it. Even having several different dbs in the same project is straightforward.
The go-to is Drizzle
That's funny, I would say the go-to is Prisma. We use it heavily and have not had any issues.
Very lucky to not have encountered one of the 500 open and confirmed bugs!
A project suffering from success. The more usage, the more edge cases you'll find and the more bug reports.
I've used both and Drizzle has become the goto now in the TS community.
I'll try it out next time I need to build something.

Where I work, as an org, we have gone all-in on Prisma across dozens of projects so getting buy-in to try something else will be an uphill battle.

When not even 1.x?