Multi-tenant sites and a shop
Two new plugins: run several sites or clients from one CMS, and sell from your site with carts, Stripe, PromptPay or bank transfer.
Agencies run many small sites; shops need more than posts. Two plugins arrived in 0.44 to 0.46, and they work together.
Multi-tenant
import { multiTenantPlugin } from '@easy-cms/plugin-multi-tenant'
plugins: [
multiTenantPlugin({
collections: ['posts', 'pages', 'media'], // each document belongs to one tenant
globals: ['site-settings'], // one value per tenant
}),
],You get a tenants collection, members with a role in each tenant, a tenant switcher in the admin, and frontends that name their tenant by header, ?tenant= or domain. Since 0.45, uploads, media folders, nested pages, redirects and forms work per tenant too, and admins of a tenant see its own audit log.
A shop
@easy-cms/plugin-ecommerce adds products with variants and prices in several currencies, carts that guests keep, and checkout with Stripe (card and PromptPay) or bank transfer. Orders are made exactly once however often a payment is confirmed, and stock is taken safely and put back on a cancel or refund. Customers get accounts and order emails, and pages get a client with React hooks and Vue composables. With the multi-tenant plugin, each tenant is a shop of its own.
New in the core
Both plugins are built on pieces you can use yourself: onRequest gives each request a context that access rules and hooks receive, site members (auth.members) sign in on the site and never get into the admin, and events with cms.emit() send your own webhooks. One change to note: isLoggedIn no longer counts members; isSignedIn does.
The Multi-tenant, Ecommerce and Members guides have the setup.