Skip to content

Migrate off of the Payload multi-tenant plugin components/functions #552

Closed

Description

@busbyk

@payloadcms/plugin-multi-tenant is currently a blocker to upgrading Payload which we want to do for #339 and just to stay up to date in general. See: #450 (comment)

It makes sense to move off the Payload multi-tenant plugin because there is a key difference in how we do multi-tenancy and how the plugin expects us to be doing multi-tenancy.

The plugin expects there to be a tenants array on a user. But we determine association between a user and a tenant via rules-based, tenant-scoped roles. So it seems likely that we'll run into more issues in the future and I don't think it makes sense to request the Payload team to support our use case since they've made a clear decision on how tenancy is expected to work with their plugin.

Right now, we're only using components and helper functions from their plugin anyways. We can easily copy and paste these into our own repo from a version that works for us and maintain our own divergent copies. We may want to make updates to these based on our approach (although they'll likely stay very similar at first).

The work here should actually be pretty minimal - mostly just making sure that we maintain functionality.

There might be a gotcha if there are many dependencies that we need to pull over from the plugin but I think we can manage.

Activity

  1. added this to the Start of 25/26 Season milestone on Sep 25, 2025
  2. self-assigned this
    on Oct 1, 2025
  3. stevekuznetsov commented on Oct 2, 2025

    @stevekuznetsov
    Contributor

    Does this mean we could also go back to putting the tenant domain/slug into the cookie, instead of the db ID, and obviate that indirection?

  4. busbyk commented on Oct 5, 2025

    @busbyk
    CollaboratorAuthor

    Does this mean we could also go back to putting the tenant domain/slug into the cookie, instead of the db ID, and obviate that indirection?

    Yea, actually, we could do that. That might be really nice to simplify that. We wouldn't need to fetch from the edge config to get tenant ids and could hardcode all avalanche center slugs in the middleware directly.

    That's a hard refactor to justify though, tbh. I've created a issue for that: #579

    We could discuss at our next check-in to see if we think it's worth doing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions