all projects
Multi-Tenant E-Commerce preview

Multi-Tenant E-Commerce

Privateweb

Nx monorepo enabling code sharing across multiple e-commerce storefronts. Multi-tenant architecture with shared core packages and per-tenant customization layers.

NxNext.jsReact.jsTypeScript
One codebase, N storefronts, zero copy-paste.

The problem

Operating multiple e-commerce brands means either (a) maintaining N nearly-identical codebases that drift over time, or (b) shipping bug fixes by copy-pasting across repos. Both are awful.

The approach

Modeled it as an Nx monorepo with a shared `core` package (cart, checkout, product API client, design tokens) and a thin per-tenant layer that supplies branding, copy, and any tenant-specific overrides. New storefronts spin up as a new tenant package that imports `core` — no fork, no copy-paste. Affected-builds in Nx mean a PR only rebuilds the tenants it actually touches.

Tech decisions

Nx monorepo
Affected-graph builds + cached task runs make N tenants tractable; turbo would also work, Nx fit the team's prior experience
Shared `core` package
Single place to fix a bug; every tenant inherits the fix on next deploy
Per-tenant branding layer
Tenants differ in design, not in checkout logic — let them differ where it matters
TypeScript everywhere
Types propagate from the core to every tenant; a breaking change surfaces at compile time

Outcomes

  • New tenants spin up as a thin package, not a fork
  • Bug fixes ship to all tenants from one PR
  • Nx affected-graph means CI only rebuilds what changed
  • Per-tenant branding + copy without code duplication

What I learned

Monorepos earn their keep the moment you have more than two consumers of the same domain logic. The shared-`core` discipline is half the value — the rest is the build tooling that makes 'one PR, N deployments' fast.