Back to portfolioBack to all posts

Architecture

Designing a Multi-Tenant ERP with NestJS and NATS

Mar 18, 20268 min read

When multi-tenant platforms begin to grow, complexity usually appears first in authorization boundaries and shared domain state. We started by making tenant scope an explicit part of every command and event contract, rather than relying on implicit context in service handlers.

On the transport side, NATS subjects were designed around business capabilities, not technical modules. That made ownership clearer and reduced accidental coupling between billing, inventory, and subscription services.

The most practical lesson was to standardize event envelopes early. A consistent shape for correlation IDs, tenant IDs, and version metadata made observability and replay tooling much easier later in production.