Hi guys, I am from blitzjs. Currently, I want to implement multitenancy on my application and I am looking for separate database option. Unfortunately, blitzjs does not support it. Multitenancy - Blitz.js
I have to admit, I’ve not thought a lot about multi-tenancy - I’m sure @dthyresson@thedavid@adriatic will have better ideas/more experience than I do…
I think the best usage of directives is not to access the database to determine if you can access the database but to do everything in memory
To that end I’d probably start by storing the users’ tenantId in the context.currentUser upon login and then access that in the queries - maybe not use a directive after all…
And I don’t know how you’re structuring your data storage. Maybe you’re keeping each tenant’s data in a different [postgres] schema - so you could put the schema name into the context.currentUser…
Or you’re over the top, and doing a different db per tenant then you might be using vanity urls to determine the db to query & forwarding the GQL using GraphQL Mesh (https://www.the-guild.dev/blog/graphql-mesh_