Multitenant

Home

Multitenant — config-driven tenant and market resolution for TypeScript.

Config-driven tenant and market resolution for TypeScript: one tenants.config.json, createTenantRegistry, and adapters for Next.js (App + Pages), Express, Nest, and React — with typed errors you can branch on in production.

Adapters & packages

Every adapter expects a TenantRegistry from createTenantRegistry(config) where config is your validated TenantsConfig (JSON file, loadTenantsConfig, or validateTenantsConfig after a CMS map).

Scaffold stubs: npx @multitenant/cli init --framework ….

PackageUse case
@multitenant/next / next-app / next-pagesNext.js — meta package, App Router, Pages Router — guide
@multitenant/reactTenantProvider, hooks — guide
@multitenant/expressmultitenantExpressreq.tenantguide
@multitenant/nestMultitenantModuleForRoot, @Tenant()guide
@multitenant/drizzle / kysely / prisma / typeormReference ORM wiring — pools per tenant; see Packages

Edge vs Node (App Router)

RuntimeResolve tenantDB / Node APIs
Edge middlewareYes — thin, static JSONNo
Node servergetTenantFromHeaders / requireTenantYes — e.g. @multitenant/database ALS

Details: Next.js — App Router.

The monorepo also ships reference ORM packages (Drizzle, Kysely, Prisma, TypeORM) and @multitenant/database (ALS scope). Deep-dive markdown for contributors remains in the GitHub docs/ tree.

On this page