DEV Community

Discussion on: Hasura + GraphQL Mesh = <3

huaixing profile image

I thought you treated Hasura as an orm like Prisma. The thing is, Hasura lacks some constraints, which makes it too dangerous to put it public. Like data validation, and complex auth rules. I'm always waiting for Hasura Action to make it really production. Otherwise, it's probably only suitable for internal usage. I thought you put Hasura behind GraphQL Mesh. I guess now we have to try Apollo Federation and put it in front of Hasura.

stephengfriend profile image
Stephen G. Friend Author • Edited on

I think that is a common misconception about Hasura. They mention throughout much of their documentation that running their engine at the edge is the best way to leverage their product as a platform. Many of their proposed benefits are lost once it is stuffed behind another federated endpoint. In fact, their first 3 bullets of their feature callout is in direct conflict with your concerns.

Screenshot of Hasura feature callout with bullets, 'Add to a new or existing database,' 'powerful authorization engine,' and 'can safely be used by frontend apps directly'

While we may be able to argue whether or not they are successfully performing those exact functions as we might generally expect, it is clear they intend this product to be your primary entrypoint for client-based graphs.

Here is a link to their role-based authorization documentation:

Additionally, GraphQL Mesh does not need to be run as it's own gateway. It can be used to purely generate a comprehensive SDK which is then used in whatever fashion is best for your business. One example, which I hope to showcase in the coming days, is how it could be used to quickly create data sources for your federated graph. This is extremely powerful if you have a dispersed set of endpoints with varying communication paradigms (openapi, protobuf, soap, etc...)

arnaudjnn profile image
Arnaud Jeannin • Edited on

What would be the architecture using GraphQL Mesh as it's own gateway? Would be awesome to use it as a remote schema as described here instead of OneGraph:

Thread Thread
stephengfriend profile image
Stephen G. Friend Author

The example included is exactly that. GraphQL Mesh builds the schema which is then made available to your GraphQL server implementation. In this case, I'm using Apollo Server and deploying it to Zeit Now. This endpoint is a bonafide Graph based on GraphQL Mesh. Later in the article, I use it as a remote schema in Hasura. I'm hoping for that article to come to fruition because it is the precise architecture that I'd like to work with.