Concepts
Tenancy
Single-shop and multi-shop modes.
Shopnex is always multi-tenant underneath: every tenant table has a shop_id. TENANCY_MODE only changes how the shop is resolved.
single (default) | multi | |
|---|---|---|
| Storefront | default shop | shop from request host (shop_domains) |
| Admin | default shop | session's active shop, else the user's first shop |
| New users | invited from Admin → Staff | invited, or create their own shop |
- Shops are Better Auth organizations (
shops,shop_members,shop_invitations). - Switching from single to multi needs no data migration: add rows to
shop_domainsand setTENANCY_MODE=multi. - In multi mode, outbound webhooks to private or loopback addresses are blocked (SSRF protection). Single mode allows them, e.g. n8n on localhost.