Adds multi-tenancy to Payload by injecting a tenant field into selected collections and a tenants array field into the users collection. It applies tenant-based access constraints and list filters, and adds a tenant selector to the admin panel. Tenants live in a configurable collection, and super-admin access can be defined with a custom function.
Multi Tenant plugin for Payload
Installation
npm i @payloadcms/plugin-multi-tenant46.1k
Stars
4.5k
Forks
1821
Open Issues
Today
Last Updated
165.4k
Weekly Downloads
v3.94.2
npm Version
441.8 KB
Unpacked Size
0
Dependencies
46.1K+1.8K since Sep 6
| Date | Stars |
|---|---|
| Dec 5, 2026 | 46,136 |
| Dec 4, 2026 | 46,125 |
| Dec 3, 2026 | 46,106 |
| Dec 2, 2026 | 46,087 |
| Dec 1, 2026 | 46,068 |
| Nov 30, 2026 | 46,059 |
| Nov 29, 2026 | 46,037 |
| Nov 28, 2026 | 46,035 |
| Nov 27, 2026 | 46,022 |
| Nov 26, 2026 | 46,012 |
| Nov 25, 2026 | 45,993 |
| Nov 24, 2026 | 45,976 |
| Nov 23, 2026 | 45,958 |
| Nov 22, 2026 | 45,947 |
| Nov 21, 2026 | 45,937 |
| Nov 20, 2026 | 45,926 |
| Nov 19, 2026 | 45,901 |
| Nov 18, 2026 | 45,868 |
| Nov 17, 2026 | 45,852 |
| Nov 16, 2026 | 45,831 |
| Nov 15, 2026 | 45,820 |
| Nov 14, 2026 | 45,807 |
| Nov 13, 2026 | 45,792 |
| Nov 12, 2026 | 45,779 |
| Nov 11, 2026 | 45,763 |
| Nov 10, 2026 | 45,742 |
| Nov 9, 2026 | 45,731 |
| Nov 8, 2026 | 45,722 |
| Nov 7, 2026 | 45,704 |
| Nov 6, 2026 | 45,681 |
| Nov 5, 2026 | 45,670 |
| Nov 4, 2026 | 45,647 |
| Nov 3, 2026 | 45,629 |
| Nov 2, 2026 | 45,611 |
| Nov 1, 2026 | 45,603 |
| Oct 31, 2026 | 45,592 |
| Oct 30, 2026 | 45,574 |
| Oct 29, 2026 | 45,561 |
| Oct 28, 2026 | 45,543 |
| Oct 27, 2026 | 45,519 |
| Oct 26, 2026 | 45,492 |
| Oct 25, 2026 | 45,472 |
| Oct 24, 2026 | 45,449 |
| Oct 23, 2026 | 45,430 |
| Oct 22, 2026 | 45,405 |
| Oct 21, 2026 | 45,259 |
| Oct 20, 2026 | 45,239 |
| Oct 19, 2026 | 45,213 |
| Oct 18, 2026 | 45,192 |
| Oct 17, 2026 | 45,165 |
| Oct 16, 2026 | 45,148 |
| Oct 15, 2026 | 45,122 |
| Oct 14, 2026 | 45,100 |
| Oct 13, 2026 | 45,082 |
| Oct 12, 2026 | 45,057 |
| Oct 11, 2026 | 45,032 |
| Oct 10, 2026 | 45,023 |
| Oct 9, 2026 | 45,003 |
| Oct 8, 2026 | 44,983 |
| Oct 7, 2026 | 44,959 |
| Oct 6, 2026 | 44,935 |
| Oct 5, 2026 | 44,924 |
| Oct 4, 2026 | 44,907 |
| Oct 3, 2026 | 44,891 |
| Oct 2, 2026 | 44,876 |
| Oct 1, 2026 | 44,859 |
| Sep 30, 2026 | 44,846 |
| Sep 29, 2026 | 44,829 |
| Sep 28, 2026 | 44,805 |
| Sep 27, 2026 | 44,787 |
| Sep 26, 2026 | 44,769 |
| Sep 25, 2026 | 44,737 |
| Sep 24, 2026 | 44,709 |
| Sep 23, 2026 | 44,691 |
| Sep 22, 2026 | 44,669 |
| Sep 21, 2026 | 44,641 |
| Sep 20, 2026 | 44,628 |
| Sep 19, 2026 | 44,609 |
| Sep 18, 2026 | 44,595 |
| Sep 17, 2026 | 44,570 |
| Sep 16, 2026 | 44,548 |
| Sep 15, 2026 | 44,523 |
| Sep 14, 2026 | 44,501 |
| Sep 13, 2026 | 44,488 |
| Sep 12, 2026 | 44,470 |
| Sep 11, 2026 | 44,447 |
| Sep 10, 2026 | 44,427 |
| Sep 9, 2026 | 44,402 |
| Sep 8, 2026 | 44,384 |
| Sep 7, 2026 | 44,364 |
| Sep 6, 2026 | 44,352 |
Shared by 12 plugins in payloadcms/payload.
159.6K+86.6K since Sep 6
| Date | Weekly downloads |
|---|---|
| Dec 5, 2026 | 159,635 |
| Dec 4, 2026 | 154,627 |
| Dec 3, 2026 | 145,959 |
| Dec 2, 2026 | 149,385 |
| Dec 1, 2026 | 153,268 |
| Nov 30, 2026 | 153,198 |
| Nov 29, 2026 | 151,139 |
| Nov 28, 2026 | 157,961 |
| Nov 27, 2026 | 161,426 |
| Nov 26, 2026 | 167,509 |
| Nov 25, 2026 | 165,771 |
| Nov 24, 2026 | 164,790 |
| Nov 23, 2026 | 165,356 |
| Nov 22, 2026 | 165,510 |
| Nov 21, 2026 | 167,204 |
| Nov 20, 2026 | 165,850 |
| Nov 19, 2026 | 161,128 |
| Nov 18, 2026 | 154,261 |
| Nov 17, 2026 | 151,390 |
| Nov 16, 2026 | 151,679 |
| Nov 15, 2026 | 154,638 |
| Nov 14, 2026 | 147,972 |
| Nov 13, 2026 | 153,025 |
| Nov 12, 2026 | 154,576 |
| Nov 11, 2026 | 159,944 |
| Nov 10, 2026 | 166,382 |
| Nov 9, 2026 | 169,354 |
| Nov 8, 2026 | 167,478 |
| Nov 7, 2026 | 169,634 |
| Nov 6, 2026 | 166,556 |
| Nov 5, 2026 | 164,187 |
| Nov 4, 2026 | 160,739 |
| Nov 3, 2026 | 156,792 |
| Nov 2, 2026 | 155,302 |
| Nov 1, 2026 | 156,227 |
| Oct 31, 2026 | 155,939 |
| Oct 30, 2026 | 151,358 |
| Oct 29, 2026 | 125,733 |
| Oct 28, 2026 | 100,085 |
| Oct 27, 2026 | 100,055 |
| Oct 26, 2026 | 110,158 |
| Oct 25, 2026 | 118,154 |
| Oct 24, 2026 | 113,158 |
| Oct 23, 2026 | 90,308 |
| Oct 22, 2026 | 116,888 |
| Oct 21, 2026 | 137,458 |
| Oct 20, 2026 | 134,040 |
| Oct 19, 2026 | 121,128 |
| Oct 18, 2026 | 107,865 |
| Oct 17, 2026 | 110,666 |
| Oct 16, 2026 | 137,160 |
| Oct 15, 2026 | 131,897 |
| Oct 14, 2026 | 133,072 |
| Oct 13, 2026 | 131,964 |
| Oct 12, 2026 | 132,211 |
| Oct 11, 2026 | 128,712 |
| Oct 10, 2026 | 129,787 |
| Oct 9, 2026 | 124,155 |
| Oct 8, 2026 | 124,592 |
| Oct 7, 2026 | 122,780 |
| Oct 6, 2026 | 123,345 |
| Oct 5, 2026 | 122,758 |
| Oct 4, 2026 | 126,069 |
| Oct 3, 2026 | 119,414 |
| Oct 2, 2026 | 119,503 |
| Oct 1, 2026 | 116,728 |
| Sep 30, 2026 | 116,009 |
| Sep 29, 2026 | 112,246 |
| Sep 28, 2026 | 108,674 |
| Sep 27, 2026 | 100,424 |
| Sep 26, 2026 | 96,694 |
| Sep 25, 2026 | 91,621 |
| Sep 24, 2026 | 88,613 |
| Sep 23, 2026 | 85,408 |
| Sep 22, 2026 | 86,416 |
| Sep 21, 2026 | 87,716 |
| Sep 20, 2026 | 95,114 |
| Sep 19, 2026 | 96,399 |
| Sep 18, 2026 | 94,393 |
| Sep 17, 2026 | 90,340 |
| Sep 16, 2026 | 85,505 |
| Sep 15, 2026 | 86,621 |
| Sep 14, 2026 | 84,947 |
| Sep 13, 2026 | 76,976 |
| Sep 12, 2026 | 75,997 |
| Sep 11, 2026 | 75,431 |
| Sep 10, 2026 | 75,280 |
| Sep 9, 2026 | 75,172 |
| Sep 8, 2026 | 72,948 |
| Sep 7, 2026 | 72,490 |
| Sep 6, 2026 | 73,062 |
Each point is npm's rolling 7-day download count.
Health Score
Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.
Badge for your README
[](https://payloaddirectory.dev/plugins/official-plugin-multi-tenant)<a href="https://payloaddirectory.dev/plugins/official-plugin-multi-tenant"><img src="https://payloaddirectory.dev/badge/official-plugin-multi-tenant.svg" alt="Payload Directory"></a>README
A plugin for Payload to easily manage multiple tenants from within your admin panel.
pnpm add @payloadcms/plugin-multi-tenant
type MultiTenantPluginConfig<ConfigTypes = unknown> = {
/**
* After a tenant is deleted, the plugin will attempt to clean up related documents
* - removing documents with the tenant ID
* - removing the tenant from users
*
* @default true
*/
cleanupAfterTenantDelete?: boolean
/**
* Automatically
*/
collections: {
[key in CollectionSlug]?: {
/**
* Set to `true` if you want the collection to behave as a global
*
* @default false
*/
isGlobal?: boolean
/**
* Set to `false` if you want to manually apply the baseFilter
*
* @default true
*/
useBaseFilter?: boolean
/**
* Set to `false` if you want to handle collection access manually without the multi-tenant constraints applied
*
* @default true
*/
useTenantAccess?: boolean
}
}
/**
* Enables debug mode
* - Makes the tenant field visible in the admin UI within applicable collections
*
* @default false
*/
debug?: boolean
/**
* Enables the multi-tenant plugin
*
* @default true
*/
enabled?: boolean
/**
* Field configuration for the field added to all tenant enabled collections
*/
tenantField?: {
access?: RelationshipField['access']
/**
* The name of the field added to all tenant enabled collections
*
* @default 'tenant'
*/
name?: string
}
/**
* Field configuration for the field added to the users collection
*
* If `includeDefaultField` is `false`, you must include the field on your users collection manually
* This is useful if you want to customize the field or place the field in a specific location
*/
tenantsArrayField?:
| {
/**
* Access configuration for the array field
*/
arrayFieldAccess?: ArrayField['access']
/**
* Name of the array field
*
* @default 'tenants'
*/
arrayFieldName?: string
/**
* Name of the tenant field
*
* @default 'tenant'
*/
arrayTenantFieldName?: string
/**
* When `includeDefaultField` is `true`, the field will be added to the users collection automatically
*/
includeDefaultField?: true
/**
* Additional fields to include on the tenants array field
*/
rowFields?: Field[]
/**
* Access configuration for the tenant field
*/
tenantFieldAccess?: RelationshipField['access']
}
| {
arrayFieldAccess?: never
arrayFieldName?: string
arrayTenantFieldName?: string
/**
* When `includeDefaultField` is `false`, you must include the field on your users collection manually
*/
includeDefaultField?: false
rowFields?: never
tenantFieldAccess?: never
}
/**
* Customize tenant selector label
*
* Either a string or an object where the keys are i18n codes and the values are the string labels
*/
tenantSelectorLabel?:
| Partial<{
[key in AcceptedLanguages]?: string
}>
| string
/**
* The slug for the tenant collection
*
* @default 'tenants'
*/
tenantsSlug?: string
/**
* Function that determines if a user has access to _all_ tenants
*
* Useful for super-admin type users
*/
userHasAccessToAllTenants?: (
user: ConfigTypes extends { user: unknown } ? ConfigTypes['user'] : User,
) => boolean
/**
* Opt out of adding access constraints to the tenants collection
*/
useTenantsCollectionAccess?: boolean
/**
* Opt out including the baseListFilter to filter tenants by selected tenant
*/
useTenantsListFilter?: boolean
/**
* Opt out including the baseListFilter to filter users by selected tenant
*/
useUsersTenantFilter?: boolean
}
When using multi-tenant, globals need to actually be configured as collections so the content can be specific per tenant.
To do that, you can mark a collection with isGlobal and it will behave like a global and users will not see the list view.
multiTenantPlugin({
collections: {
navigation: {
isGlobal: true,
},
},
})
In some cases, the access control supplied out of the box may be too strict. For example, if you need some documents to be shared between tenants, you will need to opt out of the supplied access control functionality.
By default this plugin merges your access control result with a constraint based on tenants the user has access to within an AND condition. That would not work for the above scenario.
In the multi-tenant plugin config you can set useTenantAccess to false:
// File: payload.config.ts
import { buildConfig } from 'payload'
import { multiTenantPlugin } from '@payloadcms/plugin-multi-tenant'
import { getTenantAccess } from '@payloadcms/plugin-multi-tenant/utilities'
import { Config as ConfigTypes } from './payload-types'
// Add the plugin to your payload config
export default buildConfig({
plugins: [
multiTenantPlugin<ConfigTypes>({
collections: {
media: {
useTenantAccess: false,
},
},
}),
],
collections: [
{
slug: 'media',
fields: [
{
name: 'isShared',
type: 'checkbox',
defaultValue: false,
// you likely want to set access control on fields like this
// to prevent just any user from modifying it
},
],
access: {
read: ({ req, doc }) => {
if (!req.user) return false
const whereConstraint = {
or: [
{
isShared: {
equals: true,
},
},
],
}
const tenantAccessResult = getTenantAccess({ user: req.user })
if (tenantAccessResult) {
whereConstraint.or.push(tenantAccessResult)
}
return whereConstraint
},
},
},
],
})
In your users collection you may want to place the field in a tab or in the sidebar, or customize some of the properties on it.
You can use the tenantsArrayField.includeDefaultField: false setting in the plugin config. You will then need to manually add a tenants array field in your users collection.
This field cannot be nested inside a named field, ie a group, named-tab or array. It can be nested inside a row, unnamed-tab, collapsible.
To make it easier, this plugin exports the field for you to import and merge in your own properties.
import type { CollectionConfig } from 'payload'
import { tenantsArrayField } from '@payloadcms/plugin-multi-tenant/fields'
const customTenantsArrayField = tenantsArrayField({
arrayFieldAccess: {}, // access control for the array field
tenantFieldAccess: {}, // access control for the tenants field on the array row
rowFields: [], // additional row fields
})
export const UsersCollection: CollectionConfig = {
slug: 'users',
fields: [
{
...customTenantsArrayField,
label: 'Associated Tenants',
},
],
}
Topics
payload gatekeeper
Role-based access control for Payload v3 with wildcard permissions, auto role assignment and a managed Roles collection
39199/wk25v3
payload plugin sharing
Share records with users and organizations through groups with Owner, Manager and Viewer levels
76425/wk0v3
payload plugin roles
Per-site role ladders and access helpers for multi-tenant Payload sites
76128/wk0v3
payload plugin guard
Central access policy file, typed predicates and guarded endpoints for Payload plugins and Local API calls
73664/wk37v3
rbac
Database-driven role-based access control with a per-collection permissions matrix and admin localization
5915/wk0v4
payload plugin rbac
Database-driven role-based access control with a permission matrix and data scopes for Payload collections
5874/wk10v3