So far, the best thing I've found in the node ecosystem is Prisma [1], and it's better than the alternatives by a very long shot in my opinion.
Show HN: ORM for TypeScript with no query-builder, supporting full SQL queries
11–20 of 124 posts
Re: Show HN: ORM for TypeScript with no query-builder, supporting full SQL queries
#12still yet to find an ActiveRecord equivalent for javascript.
Re: Show HN: ORM for TypeScript with no query-builder, supporting full SQL queries
#13still yet to find an ActiveRecord equivalent for javascript.
This bills itself as 'ActiveRecord for Javascript'. Kinda relies on Graphiti's implementation of the JSON API spec. I really like Graphiti and Spraypaint though.
Re: Show HN: ORM for TypeScript with no query-builder, supporting full SQL queries
#14All these things fall short the moment you need real "production" features, such as reliable migrations (writing them by hand? no thanks. Outsourcing to another library like knex? no thanks), transactions, community support, relationship/nested/join queries without a ton of boilerplate and being battle tested. So far, the best thing I've found in the node ecosystem is Prisma [1], and it's better than the alternatives…
Re: Show HN: ORM for TypeScript with no query-builder, supporting full SQL queries
#15For a long time, I have been frustrated with the state-of-the-art about the existing ORMs. I like things to be simple, but somehow all ORMs seems to be bloated and overcomplicate a lot of things. When designing a new project, I have been trying to find a more satisfying design while avoiding the existing ORMs. I especially wanted to use proper SQL rather than reducing it's syntax to fit it in another language. This i…
Long version: i've been seriously frustrated with the state of ORM (in Javascript in particular) for years.
Javascript ORM are nice and handy if all you're doing is simple CRUD stuff. If you're starting with more complex relational queries (we're using an RDBMS so why wouldn't we?) you quickly reach the limits of what the ORM can map. If you start doing more complex aggregations or stuff like window functions and the likes, you most certainly have to fallback to raw queries, usually rendering the whole mapping function of the ORM completely useless.
Also projects like Knex.js (or for example HQL in the Java world) look nice at first but are mostly useless IMHO because they just replace SQL with another syntax you have to learn. Why stay with the language everybody familiar with RDBMS can speak if you can invent some useless abstraction, right? And please don't tell me you want to support multiple RDBMS in the same codebase. How often is this really an important use-case?
I really loved the way MyBatis did this in Java: instead of mapping tables to objects, mapping result sets to objects and leaving the full power of SQL to the developer.
Always wanted (and actually started something almost the same as you did some weeks ago) to basically do MyBatis in Javascript and never had the time to.
Thanks for getting it started.
Re: Show HN: ORM for TypeScript with no query-builder, supporting full SQL queries
#16still yet to find an ActiveRecord equivalent for javascript.
What about this? https://github.com/typeorm/typeorm/blob/master/docs/active-r... (Forgive me if this isn't what you are looking for, not super familiar with ActiveRecord myself, just recalled seeing that yesterday!
Re: Show HN: ORM for TypeScript with no query-builder, supporting full SQL queries
#17Earlier quoted context omitted.
"you can freely use the full-power of SQL" Sounds like Dapper from the .Net world - which I like precisely for that reason: https://github.com/StackExchange/Dapper
OP's project is a little more opinionated than Dapper in that it defines repositories and whatnot. Dapper's more like just a set of query extensions that support basic object mapping. I love it personally, but I wouldn't even call it a micro-ORM.
If one had to, i'd separate these things in different libraries and let the developer opt in to what he needs.
Re: Show HN: ORM for TypeScript with no query-builder, supporting full SQL queries
#18For a long time, I have been frustrated with the state-of-the-art about the existing ORMs. I like things to be simple, but somehow all ORMs seems to be bloated and overcomplicate a lot of things. When designing a new project, I have been trying to find a more satisfying design while avoiding the existing ORMs. I especially wanted to use proper SQL rather than reducing it's syntax to fit it in another language. This i…
Re: Show HN: ORM for TypeScript with no query-builder, supporting full SQL queries
#19still yet to find an ActiveRecord equivalent for javascript.
https://github.com/stephenh/joist-ts/
Disclaimer docs aren't amazing yet, so looking through the examples/integration tests are the best way to see how it works.
Prisma has a few mentions in this thread; joist's differentiator is that it leans more "domain model" i.e. validation rules, derived values, and business-logic-y things being in the model.
Which is not for everyone (i.e. the ORM-less approach of the OP/kiss-orm is fine too), but if you're looking for that sort of thing...
Joist also has a novel approach for modeling the lazy-initialized collections/references of ORMs, which is historically tricky in Node/JS/TS. In Joist, all collections/references require `await` to access by default, but that gets tedious very quickly, so you can use populate hints to get a now-synchronously-accessible sub-view of the object graph.
Re: Show HN: ORM for TypeScript with no query-builder, supporting full SQL queries
#20Like in Kiss, you write queries in SQL. But unlike other "light ORMs", it also provides type safety by generating type declarations by directly connecting to your database instance and type-checking your query templates.
Honestly, I think it's the best of both worlds, and would love to see more developers finally learning SQL and ditching "fat ORMs" that try to hide it under abstraction layers that always end up leaking.