Skip to content
This repository has been archived by the owner on Jul 10, 2024. It is now read-only.

Latest commit

 

History

History

Nexus Example for Prisma-multi-tenant

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")

Installation

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!

Commands you can try

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