SellubDevelopersMulti-tenancy

Multi-tenancy

Sellub supports many sellers on one backend via Vendure’s Channel model.

What a Channel scopes

Scoped per-channelGlobal
Products, variants, collections, facetsCustomers
OrdersAdministrators (but their roles are channel-scoped)
Promotions, shipping & payment methodsTax categories, zones, countries
Storefront branding (via plugin metadata)Stock locations (selectable per channel)

Channel codes

  • __default_channel__ — the marketplace.
  • seller-<slug> — branded sellers (Type 2). Slug derived from the seller’s chosen domain.
  • donations-<slug> — Type 4 donation pages.

Provisioning on approval

When a Type 2 seller is approved, the MultiChannelOnboardingPlugin runs:

  1. Creates a Channel with the new code.
  2. Creates the Seller admin role scoped to that channel.
  3. Creates the Administrator and links the role.
  4. Configures default payment methods (Paystack), shipping methods, and tax setup for the channel.
  5. Initialises an empty wallet.
  6. Optionally: clones a starter set of collections/facets from the marketplace.

All in a single DB transaction — failure rolls back cleanly.

Storefront resolution

Incoming requests resolve to a channel via:

  1. Custom domain (Type 2): Domain → Channel mapping in domain_routes table.
  2. Subdomain or path (Marketplace): sellub.com/shop/<slug> → channel code __default_channel__ filtered by seller slug.

The Shop API requires vendure-token: <channelToken> header — set automatically by each storefront app.

Cross-channel queries

A few admin queries need cross-channel data (e.g. global Sellers list, platform-wide finance reports). These are implemented as:

  • Custom resolvers that query directly with the channel guard relaxed (only allowed for SuperAdmin/Platform roles).
  • Read-only views in Postgres for reporting.

Avoid bypassing the channel guard outside of these documented places. Channel scoping is the primary tenancy boundary; bypassing it has been the source of every multi-tenancy bug we’ve shipped.

Limits

ResourceSoft limitNotes
Channels per server~5,000Tested; beyond this consider sharding
Custom domains~2,000DNS-cert provisioning is the bottleneck
Admins per channelunlimitedPractical max ~20