Integrating multiple system with graphql and postgres

170 Views Asked by At

Application is built using graphql (hasura), postgres and nodejs. The app gets deployed to each clients separately having different DB and so on. Currently, we need to make connection to different clients, so they can access each other DB.

One architecture which makes sense is mesh where multiple clients can connect across each other. So there are basically 3 things which needs to be implemented: Query, Mutation and Subscription.

I am trying to merge the results of the query fetching from all the clients when the request is triggered. This works but, is there any good way so I don't need to rewrite each and every custom query and mutation in hasura to handle multiple requests combing all the results. Same approach for mutation but redirecting the request to particular client.

Maybe a good way to do in Database itself combining multi DB? Or is there any good high level design which solves this problem?

1

There are 1 best solutions below

0
Kaspar L. Palgi On

There are a three different approaches for integrating multiple systems:

  1. Hasura Remote Schemas that allows you to merge multiple GraphQL schemas into one unified schema: https://hasura.io/docs/latest/remote-schemas/overview/

  2. GraphQL Federation is an architecture pattern that allows you to build a unified API across multiple services. Apollo Federation, for example, is a popular implementation of this pattern.

  3. Connect multiple PostgreSQL databases to a single Hasura instance.