This is an example project to run Nexus with the Prisma-multi-tenant plugin. (See also the tutorial "Adding multi-tenancy to your Nexus app")
npm install
npm run dev
Go to https://localhost:4000 and try the following query:
query {
posts {
id
title
body
published
}
}
Then, go to api/app.ts
, and change the tenant name to "prod"
:
use(
prismaMultiTenant({
tenantRouter: () => 'prod',
})
)
Finally, re-run the GraphQL query!
This will list the available tenants:
pmt list # or prisma-multi-tenant list
This will open studio for the tenants (dev & prod):
pmt studio dev
pmt studio prod
This will make you create a new tenant:
pmt new