Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do I really need prisma ORM for graphql?

Tags:

graphql

prisma

I have recently started to learn graphql, which at the moment I find really convenient. However, when it comes to connect it with either an object-relational or object-oriented database management system, there is a bit of complexity based on the foundations of each DBMS. For that reason, I started looking for solutions that would make the process more efficient and I found prisma. I understand that prisma is doing all the heavy-lifting mapping my data to any database, however, I see that acts as an intermediate layer between my server and the database. So, my question is:

Does it really worth to use prisma in an application, and if so, how can I explain the overhead that is added by that intermediate layer(in terms of performance)?

like image 337
Marios Simou Avatar asked Jan 01 '23 23:01

Marios Simou


1 Answers

I work at Prisma and would love to respond to this.

Prisma's biggest benefit when writing a GraphQL server is that it saves you huge amounts of CRUD boilerplate that you'd have to write in your resolvers otherwise. Paired with GraphQL Nexus, it let's you develop your GraphQL schema programmatically by building upon generated CRUD building blocks while also giving you a type-safe API to access your database.

how can I explain the overhead that is added by that intermediate layer(in terms of performance)?

When hosted alongside your application server, the Prisma server doesn't really add any performance penalties. Also note that we're currently rewriting the query engine that's running inside the Prisma server in Rust, this will make the Prisma server optional and you will be able to use Prisma as a simple library (similar to how you'd use TypeORM or Sequelize). The query engine then runs as a binary on the same host machine as your web server and connects to your database from there.

UPDATE: July 22, 2019: We've released a first version of Prisma 2. You can find all infos here.

I'd recommend you take a look at the GraphQL Nexus docs to learn more about the concrete workflows. Please let me know if you have any further questions, I'm happy to help :)

like image 89
nburk Avatar answered Jan 05 '23 18:01

nburk