Can Payload CMS support a multi-tenant Next.js application?

default discord avatar
rjzhenglast year

We've built a MongoDB backed multi-tenant Next.js app where the domain of the web app will determine what project to load. Will Payload CMS be able to support this type of architecture? When we create content, we'll want to store them with an extra field

project: ObjectId

to correlate to the correct project.

  • Yeah it can! Actually working on a client project doing multi tenant right now. In our case we have authors for content, and they are assigned (many) orgs. When they login we use an afterLogin hook (auth collection hook) to check the, that determines what org they are trying to login to by doing a lookup on orgs. Orgs have an array field with domains on it, so that’s what we are looking for, then we set a field on the user i.e. lastLoggedInOrg, and we use that field when they create content, assigning that org id to the content. In your case, projects are orgs.

    I may have missed a couple things, but that’s the gist. Then we lock the collections down by the user and the org they are assigned to. When fetching public data from a frontend you will have to specify an org/project in that query

  • discord user avatar
    last year

    Also, i made a video about access control where we go through a high-level multi-tenant setup using


    as a tenant differentiator
  • default discord avatar
    rjzhenglast year

    Thanks guys, this looks great!

  • discord user avatar
    12 months ago

    We now have an official multi-tenant example! Check it out:
  • default discord avatar
    techinverted12 months ago

    @jacobsfletch I want different clients to have access to different blocks which I as a super-admin can enable and disable. How would I go about building this? Any advice would be much appreciated

  • discord user avatar
    11 months ago

    For this you’d probably set up a new field on your tenants, like “features” or similar. This could be a list checkboxes to toggle various features on and off, such as blocks. Then in your pages config, you’d write conditional logic into each block to check against the tenants feature list, and if not found, hide the block.

    The tenants collection can lock down the feature list to super-admins only, so tenants can not make changes to their own feature set.

  • default discord avatar
    skuhns_7 months ago

    @jacobsfletch following up on this - is it possible to white label the admin UI based on the tenant of the signed in admin?

    I've followed the multi-tenant guide, but it doesn't cover the branding of the admin UI

    is the best way to fetch data directly in the graphics/Logo component?

  • default discord avatar
    herb37634 months ago

    ^ Would love some info on this too

  • default discord avatar
    brianjm4 months ago

    Yes, a custom component for




    would serve your purpose.

    What I don't think you can do is dynamically white label the


    information like the


    (I may be wrong).

  • default discord avatar
    paulpopus4 months ago

    Exactly as Brian mentioned

    here you can see all the components you can override, so you could have a logo component that does a fetch or uses a react hook to get the info about the user and render different things

    @skuhns_ as well

  • default discord avatar
    herb37634 months ago

    Thanks for the information @Paul and @BrianJM 👍

Star on GitHub


Chat on Discord



Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.