logoalt Hacker News

mattgreenrocksyesterday at 10:04 PM5 repliesview on HN

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.


Replies

k4rlitoday at 12:12 PM

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.

actsasbuffoontoday at 2:02 AM

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.

show 1 reply
weldertoday at 10:52 AM

The go-to is Drizzle

show 2 replies
stephenyesterday at 11:19 PM

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/

esperenttoday at 1:21 AM

> 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.

show 2 replies