should i use drizzle or prisma?

share

Summary of results

GPT-4o
Warning: quote links might not work while streaming
2.
3.

Do you like Prisma?

I think it's cool but it sucks that their prisma schema doesn't support constraints and more complex things. It is very basic and for any real world use migrations need to be used.

And I've had issues using it with SQLite. It doesn't support case insensitive filtering when using SQLite (I know, neither does SQLite). But as a result, i have to build a custom query which is pretty much what i wanted to avoid by using Prisma.

4.

Prisma is good for writing simple selects, updates, and deletes. But the moment you need to write any kind of advanced query with joins, nested queries, unions, etc. it gets frustrating very quickly.

Kysely and Knex are far more flexible for writing complex queries and don't get in your way.

5.

When I used prisma a few years ago I was not impressed and it couldn't do a lot of what I needed so I had to dump into raw sql queries anyway. It was easier for me to use knex and get the types mostly right.

6.

Do you support Prisma? I don't recommend using Drizzle because their migrations tool is completely proprietary and closed source, but they bundle it with their open source offering in a bait and switch.

7.

+1 for Drizzle. I was really drawn to Prisma because it seemed elegant, but the problems surfaced by this blog post are really concerning.

8.

do yourself a favor and ditch Prisma. It's a bloody mess of a project and codebase. I recommend https://github.com/drizzle-team/drizzle-orm to anyone that'll listen.

9.

Hmm. I might be wrong as I haven't used Drizzle, just read the docs, but isn't Drizzle just like Prisma? That's really not the same as this. I find Prisma at least one of the most terrible things I ever worked with in my life; the rigidity (which I guess is the arrogance of the devs which they call opinionated; their right but he), the weird querying dsl, the terrible tooling. Just checked 'Drizzle queries' again and see it looks exactly like Prisma is it not? That's really not anything like this imho?

10.

You should consider the similar reasons why you chose Kysely over Prisma. Prisma has far broader adoption. https://npmtrends.com/drizzle-orm-vs-kysely-vs-prisma

11.

I've been evaluating both (kysely, drizzle), and I'm leaning towards Kysely. Drizzle is the latest, but both are moving fast if you look at the git insights. I find Kysely more enjoyable and straightforward -- intellisense autocompletions work better (for me at least), and the expression builder combined w/ helper methods like jsonArrayFrom offer a lot of flexibility over how to shape the output, so you're in full control, which is one of the reasons I wanted to explore alternatives to primsa in the first place. I had actually decided on kysely, but am taking another look at drizzle because of recent support for relations added. The added support is a nice addition, but there's boilerplate one needs to write to take advantage of and, frankly, I just find it easier to get same results w/ kysely, again, w/ added flexibility (it is not trying to be an orm). Some things I really like about drizzle are not needing to generate schema and lets you map column names (e.g., created_at db col maps to createAt object name). Drizzle can also infer types from schema, but, I haven't found this to be a big pro relative to kysely because 1) it takes very little effort to build a zod schema that "satisifies" the kysely type definitions and 2) I'm overriding the drizzle inferred types anyway to get the finally runtime checks implemented (e.g., is a cuid2 of 16 len, not just is a string). I've also been using prisma-kysely, which gives me ubiquitously supported prisma tooling for handling migrations, etc.

edit: while not exhaustive, I'm seeing better perf (by about 20%) using kysely compared to drizzle for identical queries on planetscale. Take this with a grain of salt since I've made no attempt to measure exhaustively, or optimize -- just using "as-is" so to speak, but thought it would be with noting and nothing to indicate to me that drizzle offers big perf improvement over kysely as has been suggested. Thanks for this post btw. Drizzle is hot and shiny right now (Theo just promoted big time), but after taking a second look at drizzle and in the process of writing up my thoughts here, it's become clear to me that I'm sticking w/ kysely.

12.

Drizzle-kit, the migration part of drizzle is not open source, though they said they will open source it in future, but not at this point. Kysley is 100% open source, feature rich and more stable, again back to active development.

atlasgo io looks promising to handle migrations and is open source as well. I am currently using prisma.

13.

Would be interesting to know how it fares against Prisma which is becoming pretty popular these days.

14.

I've been going thru Astro tutorials and playing around with it. Haven't done anything with Drizzle yet, but I like it a lot, thanks again for the suggestion.

17.

Meanwhile, some companies are building products with Prisma and are enjoying their choice. I love Prisma with Postgresql and Typescript, it's a very productive tool.

My first opinion wasn't very far from yours, but then I adopted it. It has served me well after a year and multiple projects.

18.

I rather like the experience of working with Remix. Though it has some quirks. `remix-auth` is OK. `drizzle` works ok. I dunno, it depends on a lot of factors but in the spirit of your question this is what I'll answer.

19.

I posted this ‘cause I found it funny and coming from a data engineering world just dipped into Typescript APIs and ORMs in the past two weeks for a personal project.

I have no affiliation with any provider/ name/ person in this space.

I condone making premature judgements.

I have no clue about Drizzles behavior and the only thing I learned about Prisma in the last two weeks is that they have their own schema definition language, a separate Rust proxy and seemingly didn’t address open feature requests for a couple of years which is why for now I didn’t pick them in my project.

20.

Been using Drizzle for the past couple of weeks and liking it a lot. Their relation feature is awesome and solves the n+1 problem very nicely.

21.

Prisma was born out of graph.cool (https://www.graph.cool/) and their GraphQL implementation became the middleware between the Prisma DB client (@prisma/client) and their Rust db abstraction layer (prisma-engine).

I believe they're getting rid of the residual GraphQL bits though, if I'm not mistaken.

22.

Prisma is pretty good, but I'm hoping they pay attention to migrations soon and reverse the decision not to use transactions in migrations.

23.

Prisma does the heavy lifting on our project:

https://www.prisma.io

I don't have experience with Knex so I, unfortunately, don't have an answer to your question.

24.

Completely off-topic, but do you like prisma, and how are you using it (scale, complexity, solo vs team, etc).

I toyed around with it a while back, and it looked potentially awesome, but different enough that I was worried about using it on a work project in case it failed in some use case.

Im so sick of the SQL ORM situation in Typescript, but Prisma might have an answer.

25.

Prisma maybe? https://www.prisma.io/

It's mostly part of a JS/TS ORM, but it uses a declarative schema language, and there are libraries in other languages to parse and process it. E.g. https://prisma-client-py.readthedocs.io/en/stable/

26.

As someone who uses both prisma and knex (so something like kysely):

Prisma is very very nice, it has maybe the best DX out there. My issue with it is performance. It is much slower than query builders or raw sql. It's also a huge black box, although I haven't had any issues, you're dealing with a complex beast.

Knex (and other query builders) is nicer than raw sql, has good performance, and it's fairly transparent (it's not a 800 pound gorilla like Prisma)

27.

Curious why have you decided for Drizzle over Kysely.

I was recently exploring the space, and Kysely came on top as a framework with broader adoption.

https://npmtrends.com/drizzle-orm-vs-kysely

28.

If you're interested in trying out Prisma for yourself, consider using Amplication as a starting point for your next project. With Amplication's built-in Prisma integration, you can easily create a fully functional backend with Prisma, NestJS, GraphQL, REST API and more

29.

Prisma is a nice DB client library but does't do any of the things I'm interested in - reactive queries on the client, recursive graph traversal, raising level of abstraction for the organization. Schematizing the DB & a type-safe DB client is nice, but I'm more interested in stuff one or two levels of abstraction up. Like, after the data comes into memory Prisma is done and out of the picture. But getting the data into memory is the easy part IMO. Traversing it, adding permissions and business logic, managing & composing mutations, dealing with caching and reactivity.. that's the good stuff, and I'm not sure what if any Prisma offers there.

30.

A lot has changed in the past years of Prisma, it's a really great tool, to be honest, "raw sql" escape hatches to do anything raw when you need it, if you haven't tried it in years, I'd recommend you to try again since if you tried it years ago, it was a very different maturity level.

32.

I rarely see SQL Server being used alongside Next.js. But Prisma is quite popular in js land. There's also DrizzleORM, which is still relatively new. I'd recommend spending some time exploring both to see what fits you best :)

https://orm.drizzle.team/docs/quick-start

https://www.prisma.io/docs/getting-started/quickstart

33.

Another "almost" like SQL library that I've heard floating around:

https://github.com/drizzle-team/drizzle-orm

I think I've reached the limits of Prisma and embarrassingly I'm thinking about ripping it out. The benefits of not having to constantly reference your DB schema and having IDE guidance is not matching up to the idiosyncrasy and incomplete DB support of Prisma.

34.

Those are not prism. Prism implies it used as dispersion component, which is not the case. The thing does the real work there is the dichroic thin film coating on those prism shaped glass.

35.

Prisma is an offshoot of graphql.cool, which was a "graphql API as a service". It seems to me that was a potentially good and viable business. However they stopped graphql cool and released Prisma, where there's no business model (who's gonna pay for an ORM?). I'm still left wondering why they did that?

36.

Prismix ensures brand consistency across platforms through several key methods:

1. Initial brand profile setup: We capture your brand voice, style, and key messaging.

2. Platform-specific templates: We use customized templates that adhere to your brand guidelines while optimizing for each platform's unique requirements.

3. AI fine-tuning: Our AI is trained on your existing content to learn and mimic your brand's tone and style.

4. Consistency checks: We have built-in checks to flag potential deviations from your brand guidelines.

5. Human review option: For crucial posts, we offer a human review step to ensure perfect alignment with your brand.

While our AI is highly effective, we always recommend a final human review for the most sensitive or important content to maintain absolute brand consistency.

37.

Sure! I think Kysely is great too, but went with Drizzle for a few different reasons:

Kysely is a little more established than Drizzle, which I think is one of the major reason why it has broader adoption. My bet is that Drizzle is moving really fast, gaining adoption, and might catch up at some point. It's also - in terms of performance - super fast, and nicely layers on top of fast database clients.

Some of the differences that I liked about Drizzle were the extra database drivers being core and developed as part of the main project. It supports prepared statements, which is awesome. The Drizzle API also covers an impressive percentage of what you can do in raw SQL, and when there's something missing, like a special column type, it's been pretty straightforward to add.

I prefer the way that it lets us write parts of queries, and compose them - like you import expressions like "and" and "eq" and you can write and(eq(users.id, 'x'), eq(users.name, 'Tom')) and you can actually stringify that to the SQL it generates. Or you can do a custom bit of SQL and use the names of table columns in that, like `COUNT(${users.name})`. I can't say scientifically that this is superior, and it's almost a little weird, but I've really found it a nice way to compose and debug queries.

That said, Kysely is also a great project and it'd be possible to build great products with it, too. I just found the momentum, API, and philosophy of Drizzle to be pretty compelling.

38.

What are you using for your ORM? Last I checked Prisma is the new hotness, but it's testing story is frankly unacceptable (i.e. manual DB purges, https://www.prisma.io/docs/orm/prisma-client/testing/integra...).

39.

At Prisma, our long-term vision is to bring the kind of complex application data infrastructure that is common in the Java and .NET ecosystems to the TypeScript ecosystem, where great DX and quick delivery is a core expectation. That's what we call DataDX. Many companies share this vision for a better future, and by giving it a name, I hope we can make progress together faster.

For a thorough deep-dive on what we are all about, I highly recommend this book by Martin Kleppann: https://dataintensive.net/. And for a more hands-on example, take a look at this session from QCon: https://twitter.com/gunnarmorling/status/1709925808511529148

40.

I presume the services around it, e.g. their products under the Data Platform:

- https://www.prisma.io/data-platform/accelerate

and:

- https://www.prisma.io/data-platform/proxy

Whether it's a viable business is to be seen though.

I've been a happy user of Prisma for a while, and so far we've not been running into severe limitations nor need for their additional services. Who knows what the future will bring though.

41.

It's a solo project, CRUD stuff, but having used pretty much all JavaScript/TypeScript ORMs in existence, I can say that Prisma is way ahead of the competition. I would personally recommend it. A traditionally cumbersome and annoying thing about trying a new ORM is that you basically have to re-learn a pseudolanguage for building SQL queries but that hasn't been an issue this time, thanks to ChatGPT. So overall, happy with Prisma and plan to keep using it.

42.

They serve different purposes. Prisma provides type safety between server and database, tRPC provides type safety between client and server. You’re most likely going to have some logic between those two channels that manipulates and makes those interfaces similar but not quite the same.

43.

I bought the full set of Pragmata Pro on sale, but I also really like Iosevka.

If you like the style (slender/condensed), both are very appealing.

Pragmata Pro is several notches above in overall quality IMHO. Hand-hinting at smaller sizes makes a world of difference if this is important to you. This means you can use the same font from low-res console to a 4k monitor and will consistently look wonderful.

At higher DPI settings, Pragmata has a more cohesive sense of style. This is hard to quantify as it's quite subjective, but as pixel-perfect issues go away, the overall artistic direction start to become very important IMHO. The fact that this is done by a single individual shows in both little details and overall direction.

I'm not trying to push Pragmata, I just want to say that I think the price is fully justified and absolutely worth it. The work that went into the fontset is absolutely huge.

And as I said before, I also like Iosevka. Wonderful effort as well. It's slightly less packed, which I'm not super-fond of, and I find it only really shines if you have a high-DPI monitor. I use the different stylistic sets in my editor to subtly highlight different keywords.

44.

I've been dabbling with Prisma after almost a decade of staying away from ORMs such as EJB3 / Hibernate / iBatis.

With Prisma I like the ability to generate migrations and the DB schema from a single schema definition file. I also like the autogenerated simple crud use cases.

It did not take long to have to go raw. A simple case of selecting the top most occurring unique columns from a table with a join to limit by user id is brutally trivial oneliner in SQL that just rolls off the keyboard. I took a good try to do the same with Prisma and I believe it can be done, but the complexity of what the DSL will look like is laughable.

So I still have the same opinion I've had for these past years, ORMs are okay for simple crud stuff but the moment you need something slightly beyond that bailing for the raw sql is the best thing that you can possibly do for the maintenance team that comes after you have changed projects.

45.

I really do appreciate Prisma's developer experience though. Recently I've been testing out Prisma for migrations and Kysely as the actual ORM.

Prisma is generating the Kysely type definitions automatically so it is still pretty hands off without the production overhead of prisma server/client.

46.

Prisma often does multiple queries when getting some specific data, the first only leading to the second and so on. But we might very well get there one day. You are not the only one asking for this: https://github.com/prisma/prisma/issues/5052

47.

Damn, I use Prisma, it's a good way to have a unified database schema for which you can generate code in any language you want. It was very useful for converting a TypeScript project to a Rust one, I use prisma-client-rust in particular.

https://github.com/Brendonovich/prisma-client-rust

49.

These are more akin to Dapper which is a thin layer on top of SQL. Currently I use Prisma for JS, it's a bit better, but if you haven't used EF then you probably don't know what you're missing.

50.

Any Photoprism user out there that tried this already? How does it compare, UI and updating-wise? I'm a Photprism donor but seems that development is stalling a bit lately (just a new release in over 6 months and with not so big changes, although I still have to update to be honest)

EDIT: after a quick assessment in the doc pages/features, this seems to... blow Photoprism out of the water?

51.

How does this compare to say Prisma? I want to write SQL more than I want to write Javascript. I got really hung up on writing joins with Prisma and don't want to use a raw query. How would this compare assuming they're comparable, thanks in advance.

52.

PhotoPrism is something everyone recommends. TBH I haven't had a chance to try it with my entire library yet (I'm moving from Moments to NextCloud with PhotoPrism). I probably won't be using it with videos either, so sadly I can't answer your question.

53.

Pragmata Pro is a huge influence on Iosevka, the author has admitted it. What makes Pragmata Pro work, afaict (since I've yet to actually buy the damned thing), is it is insanely well hinted... this is the one thing Iosevka will never have (it depends on ttfautohint, which although acceptable, will never be good as a talented font hinter producing his art).

Having tried, and evaluated, basically every mono font in existence worth using here, I may end up just buying Pragmata Pro.

My current daily driver is Input, and not set as a compressed or condensed style. Input is only hinted for the weights Light, Regular, Medium, and Bold, for normal width; the other three more narrow widths are not hinted at any weight. At the sizes I prefer text, Input requires the hinting supplied by the author.

54.

Prisma is an absolute joke. I remember hearing so much about it with the hype train, and I looked into it, and it's an absolute catastrophe with a very beautiful homepage. There are GitHub issues where the creator is arguing with people about not supporting foreign key constraints or something, and he didnt understand the use case (cant remember specifics right now, but this is where I immediately noped right out)

56.

Stencil has a way better DX. Especially if you’re doing a whole library of components. You pay a slightly higher perf tax for their auto loader and light vdom. Lit is the way to go if you have opinions and want no magic


Terms & Privacy Policy | This site is not affiliated with or sponsored by Hacker News or Y Combinator
Built by @jnnnthnn