I was doing some research on Prisma and Apollo and was wondering what’s the explicit difference between the two? As well as are they commonly implemented together? They both seem like great tools for working with Graphql and I look forward to learning both.
You can actually use them together! Prisma automates a lot of the backend code you’d write to query a database like mysql and allowing you to query it all using GraphQL. Prisma runs a GraphQL server (automatically) to do this.
It’s up to you then to build another GraphQL server that queries the Prisma GraphQL server. At this point you can use tools like apollo-server or graphql-yoga (
graphql-yoga actually uses
apollo-server under the hood and provides some extra features that make it nice to work with).
The third component here would be using something like apollo-client in your frontend application/website to query the custom GraphQL server you make.
So you’d end up with something like:
Prisma GraphQL server <-> Your Custom GraphQL server <-> Apollo Client
@drk, if Prisma itself already provides a GraphQL interface (i.e, it is a GraphQL server already), at what situation do we need another layer of Apollo-server or graphql-yoga?
I don’t see any extra benefit adding another layer. Can you shed some light on this?
To provide additional logic like access control etc. Prisma does not support roles and can’t make a difference between a logged in/out user.
When you need add business logic for certain concerns such as Authentication, Authorization, Filter and Transform data from Prisma Server and much more.
I recommend you this good course by Andrew Mead @andrew_j_mead on Twitter