Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to handle multi tenancy in graphql server ? Apollo/Prisma/ Hasura anything has this pugin?

Im trying to create a graphql server but in my case i need to setup multiple servers of diffrent customers. How can I implement multitenancy in graphql server?

Tried with apollo and prisma but none of them really worked.

Any libraries or plugin which i can use ?

like image 587
sooraj Avatar asked Jan 24 '26 12:01

sooraj


1 Answers

Depending on the level of data separation needed, multi-tenancy can be achieved with a good attribute-based access control authorization setup at the GraphQL server level. Prebuilt solutions are available with a service like Auth0, or you can roll your own with a library like https://www.npmjs.com/package/passport.

The server lib (like Apollo Server!) can check the user’s tenancy at the time of request with middleware, then route to where ever it needs to go

On the database side, you can separate data by database, table, or just rely on the server level auth, depending on your separation requirements.

like image 187
Mitchell Alderson Avatar answered Jan 26 '26 03:01

Mitchell Alderson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!