Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including @prisma-multi-tenant/blitz with all npm packages installed. Try it out:

require("blitz/package.json"); // blitz is a peer dependency. var blitz = require("@prisma-multi-tenant/blitz")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

@prisma-multi-tenant/blitz v2.3.1

Blitz plugin for prisma-multi-tenant

Blitz plugin for Prisma-multi-tenant 🧭

Version Documentation Maintenance License: MIT Twitter: Errorname_

🧭 Add multi-tenancy to your Blitz application


npm i -g prisma-multi-tenant # CLI for tenant management
npm i @prisma-multi-tenant/blitz # Blitz plugin

prisma-multi-tenant init # Init multi-tenancy in your Blitz project


⚠️ First, make sure you followed the Prisma-multi-tenant Getting Started Guide. ⚠️

First, add the multiTenantMiddleware to your blitz.config.js file:

const { multiTenantMiddleware } = require('@prisma-multi-tenant/blitz')

module.exports = {
  // ...
  middleware: [
    multiTenantMiddleware((req, res) => {
      // The name can come from anywhere (headers, token, ...)
      return 'dev' // or 'my_tenant_A' or anything

Then, in your queries and mutations, access the tenant from the context:

export default async function getProjects(args, ctx) {
  const projects = await ctx.db.project.findMany(args)

  return projects


Check out an example application using Blitz and the multi-tenant plugin here.


Read more on how prisma-multi-tenant can help you achieve multi-tenancy for your apps:


👤 Thibaud Courtoison

🤝 Contributors

Contributions, issues, and feature requests are welcome! 🙌

Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

📝 License

Copyright © 2020 Thibaud Courtoison.

This project is MIT licensed.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free