Live data from Hacker News

Prisma – ORM for Node.js and TypeScript

prisma.io

11–20 of 260 posts

Re: Prisma – ORM for Node.js and TypeScript

#11
post #8
post #5

Earlier quoted context omitted.

I suggest to not add a layer. Stay close of the SQL request, you can simply have a function that will fulfill an access pattern. No need for ORM.

Yeah, I have no problem with minimum ORM (prepared statements type of thing) - That's why I am asking the question, Prisma seems a bit too much. Usually I just use simple ORM helpers (get by primary key for example) and anything complex is raw sql. What I am looking for is ideally something that helps with type saftey and seeds/migrations/schema creation.

Try Knex!

Re: Prisma – ORM for Node.js and TypeScript

#12
post #2

I'm just about to start working on DB layer for our app with TypeScript. Any other alternatives to prisma you guys prefer and why?

There are many discussions on reddit about Prisma vs TypeORM in particular. For example here: https://www.reddit.com/r/node/comments/l3xu6w/is_prisma_a_vi...

There is also a good discussion going on here: https://www.reddit.com/r/node/comments/l00fit/what_do_you_th...

Re: Prisma – ORM for Node.js and TypeScript

#13

Hmm, how does this compare to sequelize? Seems like the only reason to use prisma is the GraphQL integration. If anyone has used both please share. I've being mainly using sequelize and have being quite happy with it.

Hey, Nikolas from Prisma here!

Can you elaborate what exactly you mean with "GraphQL integration"? You might be referring to Prisma 1 which was a "GraphQL layer for your database". Prisma 2 (which we are referring to with this article) doesn't have a native GraphQL integration any more :)

Prisma is very different from Sequelize in various ways (see our docs [1]):

- Your data model lives in the Prisma schema

- Database access doesn't happen via model instances but via the Prisma Client API [2] which always returns plain JS objects making your queries much easier to reason about - Prisma Migrate auto-generates migrations based on your data model (and lets you customize these migrations when needed)

- Prisma comes with Prisma Studio out of the box – a modern database GUI

- Prisma is not a community-project but built by a VC-funded company

– We care a lot about our community, documentation, and providing support (something we've seen lots of developers complain about with other ORMs)

[1] https://www.prisma.io/docs/concepts/more/comparisons/prisma-...

[2] https://www.prisma.io/client

Re: Prisma – ORM for Node.js and TypeScript

#14
post #2

I'm just about to start working on DB layer for our app with TypeScript. Any other alternatives to prisma you guys prefer and why?

My preferred DB layer is Objection.js[0] which is simply an ORM-layer on top of knex[1], with official TypeScript support.

[0] https://vincit.github.io/objection.js/

[1] https://knexjs.org/

Re: Prisma – ORM for Node.js and TypeScript

#16

I don't have much experience with node.js, so this question might sound silly. I don't see anything about database support in the blog post. Is Prisma enough to work with a PostgreSQL database from node.js? If not, what else am I missing?

Prisma does support Postgres. https://www.prisma.io/docs/reference/database-reference/supp...

Re: Prisma – ORM for Node.js and TypeScript

#17
I’ve been using Prisma for a while and I quite like it. Best ORM for TypeScript I’ve used. My biggest issue with it is testability. Sure, I can mock the Prisma client in tests with Jest or something, but if I want to test state I pretty much have to reimplement an in-memory DB using JS mocks. I can also connect to a real DB made for testing but it’s quite overkill, I’m usually not interested in testing Prisma itself, just my own code. I wish Prisma had test mode, where you could replace the client with a temporary in-memory SQLite DB without writing tons of boilerplate.

A drop-in replacement for PrismaClient for tests would have been wonderful.

Re: Prisma – ORM for Node.js and TypeScript

#18

Hmm, how does this compare to sequelize? Seems like the only reason to use prisma is the GraphQL integration. If anyone has used both please share. I've being mainly using sequelize and have being quite happy with it.

Hey, Nikolas from Prisma here! Can you elaborate what exactly you mean with "GraphQL integration"? You might be referring to Prisma 1 which was a "GraphQL layer for your database". Prisma 2 (which we are referring to with this article) doesn't have a native GraphQL integration any more :) Prisma is very different from Sequelize in various ways (see our docs [1]): - Your data model lives in the Prisma schema - Databas…

>Prisma is not a community-project but built by a VC-funded company

Thanks for clarifying this. I know there tend to be a kneejerk reaction towards VC-funded software projects. How do you guys plan to make money on this?

Re: Prisma – ORM for Node.js and TypeScript

#19
I LOVE Prisma. I’ve used Django, SQLAlchemy, Sequelize, Knex, and TypeORM in the past. all had rough edges that continually frustrated me or didn’t provide the functionality i needed.

Prisma is different. It’s absolutely got rough edges, but the extremely strong type safety makes Sequelize look like a joke. The query engine itself, written in rust, combines and optimizes queries inside every tick of the event loop so GraphQL N+1 issues are a thing of the past.

Also, the team and community behind it are amazing! I never thought having an active dev community behind an ORM would be important, but as the author of Sequelize-Typescript was forced to abandon it late last year and the author of TypeORM was also pretty much absent, Prisma was a breath of fresh air. I REALLY hope they can find a way to build a sustainable business out of it. Support packages, feature development contracts, something to keep them financially incentivized to keep making it better.

Happy to answer any questions about my experience using it if anyone has any.

Re: Prisma – ORM for Node.js and TypeScript

#20
post #8
post #5

Earlier quoted context omitted.

I suggest to not add a layer. Stay close of the SQL request, you can simply have a function that will fulfill an access pattern. No need for ORM.

Yeah, I have no problem with minimum ORM (prepared statements type of thing) - That's why I am asking the question, Prisma seems a bit too much. Usually I just use simple ORM helpers (get by primary key for example) and anything complex is raw sql. What I am looking for is ideally something that helps with type saftey and seeds/migrations/schema creation.

https://github.com/gajus/slonik
Post reply on HN