Need advice about which tool to choose?Ask the StackShare community!
Prisma vs graphql-yoga: What are the differences?
ORM vs. Server Library: Prisma is primarily an ORM (Object-Relational Mapping) tool that provides a query builder and database client, enabling developers to interact with databases easily. On the other hand, graphql-yoga is a server library that helps in creating a GraphQL server with various features like schema generation, resolvers, and Middleware.
Database Integration: Prisma integrates with databases directly by generating a client that communicates with the database. It abstracts away the database layer and provides a type-safe API for database operations. In contrast, graphql-yoga allows developers to integrate any database of their choice by writing custom resolvers to handle data fetching and manipulation.
Development Focus: Prisma focuses on simplifying database access and management, providing tools for data modeling, migrations, and advanced queries. It is more suitable for projects that heavily rely on database operations. On the other hand, graphql-yoga is focused on building GraphQL APIs and managing server-side logic with features like subscriptions, data loaders, and error handling.
Server Environment: Prisma requires a separate server environment to run queries and interact with databases, making it suitable for backend applications. In contrast, graphql-yoga can be used for both frontend and backend development as it is responsible for handling GraphQL requests and responses on the server-side.
Community Support: Prisma has a growing community of developers that contribute to its development and provide support through forums, documentation, and tutorials. graphql-yoga, being built on top of popular libraries like Express and Apollo Server, benefits from the vast community of these tools, providing extensive resources for troubleshooting and development.
Ease of Use: Prisma simplifies database operations with its type-safe API, query builder, and schema migrations, making it easier for developers to work with databases. graphql-yoga, with its declarative approach to defining schemas and resolvers, simplifies the process of creating a GraphQL server with minimal boilerplate code, enhancing developer productivity.
In Summary, Prisma is primarily focused on database access and management through an ORM approach, while graphql-yoga specializes in building GraphQL servers with features like schema generation and resolvers, catering to different aspects of GraphQL development.
Hey guys,
My backend set up is Prisma / GraphQL-Yoga at the moment, and I love it. It's so intuitive to learn and is really neat on the frontend too, however, there were a few gotchas when I was learning! Especially around understanding how it all pieces together (the stack). There isn't a great deal of information out there on exactly how to put into production my set up, which is a backend set up on a Digital Ocean droplet with Prisma/GraphQL Yoga in a Docker Container using Next & Apollo Client on the frontend somewhere else. It's such a niche subject, so I bet only a few hundred people have got a website with this stack in production. Anyway, I wrote a blog post to help those who might need help understanding it. Here it is, hope it helps!
Pros of graphql-yoga
- Easy to setup. No boilerplate code3
Pros of Prisma
- Type-safe database access12
- Open Source10
- Auto-generated query builder8
- Supports multible database systems6
- Increases confidence during development6
- Built specifically for Postgres and TypeScript4
- Productive application development4
- Supports multible RDBMSs2
- Robust migrations system2
Sign up to add or upvote prosMake informed product decisions
Cons of graphql-yoga
Cons of Prisma
- Doesn't support downward/back migrations2
- Doesn't support JSONB1
- Do not support JSONB1
- Mutation of JSON is really confusing1
- Do not support JSONB1