All case studies
Case Study · 2025 · Internal R&D · 14 engineering days

Multi-Tenant SaaS Metering Core

Tenant isolation, entitlement, and metering foundation for a B2B SaaS product with per-plan limits.

Reference implementation for our SaaS platform foundation standard.

platform.internal / billing / tenant usageMeteringUsageEntitlementsPlansInvoicesWebhooksEventsTenant usage & entitlementsevent-sourced meters · hourly rollups · 214 tenantsMetered events — 30 daysEntitlementsSeatsAPI callsStorageSSOAudit exportTop tenants this cycleTENANTPLANMETEREDSTATUStenant_ac-1042Scale4.2M eventsInvoicedtenant_ac-0988Growth1.8M eventsOpen cycletenant_ac-0917Scale1.1M eventsOpen cycle
The problem

SaaS products usually bolt on plans, limits, and tenancy after launch, and then spend the next year fighting the consequences: leaked data across tenants, limits enforced in three inconsistent places, and a pricing change that requires an engineering project.

What we built
  • Row-level tenant isolation enforced at the database layer with policy tests that fail the build if a query can cross a tenant boundary.
  • A declarative entitlement model where plans, features, and limits are data, so a pricing change is a configuration change rather than a release.
  • A metering core recording usage against tenant and feature with soft and hard limit behaviour, plus in-product warnings before enforcement.
  • Subscription lifecycle wiring to the payment provider with webhook idempotency, proration handling, and reconciliation against provider state.
The result

Cross-tenant access tests passed on all 340 generated policy cases, and introducing a new plan tier required configuration only, with no application code change across the harness.

Want this level of documentation on your project?

Every engagement ships with the same written record: what changed, why, and what it measured.

Start a conversation