Per-Tenant Configuration and Metering
Learn to manage per-tenant settings, feature entitlements, and usage metering that power billing and customization in advanced multi-tenant SaaS.
Per-Tenant Configuration and Metering is a free SaaS Architecture & Startup Engineering lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the SaaS Architecture & Startup Engineering learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Tenants Are Not Identical
In advanced multi-tenancy, each tenant has different needs: plan limits, enabled features, and branding. The system must track per-tenant configuration cleanly.
This lesson covers configuration, entitlements, and usage metering.
Tenant Configuration Store
Per-tenant settings live in a configuration store keyed by tenant ID. It holds plan, limits, feature flags, and preferences.
const tenantConfig = {
'42': { plan: 'pro', seats: 25, features: ['sso', 'audit_log'] },
'43': { plan: 'free', seats: 3, features: [] }
};Entitlements
An entitlement is the set of features and limits a tenant is allowed based on their plan. Code checks entitlements before granting access to a capability.
function canUse(tenant, feature) {
return tenant.features.includes(feature);
}
if (!canUse(t, 'sso')) throw new Error('Upgrade required');Plan Limits and Quotas
Limits cap resource use per tenant: API calls per month, storage, seats, or projects. Enforcing quotas prevents one tenant from overusing shared infrastructure.
When a quota is reached, you block the action or prompt an upgrade.
Why Meter Usage
Metering records how much each tenant consumes. It powers usage-based billing, quota enforcement, and capacity planning.
Accurate metering is the foundation of fair, transparent charging.
Recording Usage Events
Each billable action emits a usage event tagged with tenant, metric, quantity, and timestamp.
function recordUsage(tenantId, metric, qty) {
events.push({ tenantId, metric, qty, ts: Date.now() });
}
recordUsage('42', 'api_calls', 1);Aggregating Usage
Raw events are aggregated per tenant per billing period. The aggregate feeds both the quota check and the invoice.
function totalFor(tenantId, metric) {
return events
.filter(e => e.tenantId === tenantId && e.metric === metric)
.reduce((sum, e) => sum + e.qty, 0);
}Soft vs Hard Limits
Limits come in two flavors:
- Soft limit — warn the tenant but keep serving (then bill overage)
- Hard limit — block further use until upgrade or reset
Choosing well affects both revenue and customer satisfaction.
Feature Flags Per Tenant
Per-tenant feature flags let you roll out features to specific tenants, run pilots, or sell features as add-ons.
The same code path can behave differently per tenant based on flag evaluation.
Configuration Caching
Tenant config is read on nearly every request, so it must be fast. Cache it in memory or a distributed cache, and invalidate on plan changes.
Stale config can wrongly grant or deny features, so invalidation must be reliable.
Auditing Config Changes
Changes to entitlements and limits should be audited: who changed what, when, and why. This supports billing disputes, compliance, and debugging.
An immutable change log builds trust with enterprise customers.
Quick Check
Test your understanding of per-tenant management.
Recap
You learned per-tenant management:
- Configuration stores and entitlements per tenant
- Quotas, soft vs hard limits, and per-tenant feature flags
- Usage metering via events and aggregation for billing
- Caching with invalidation and auditing of changes
Frequently asked questions
Is the “Per-Tenant Configuration and Metering” lesson free?
Yes — the full text of “Per-Tenant Configuration and Metering” is free to read here on the web, and the SaaS Architecture & Startup Engineering course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the SaaS Architecture & Startup Engineering course, upgrade to CoddyKit PRO.
What will I learn in “Per-Tenant Configuration and Metering”?
Learn to manage per-tenant settings, feature entitlements, and usage metering that power billing and customization in advanced multi-tenant SaaS. You practise SaaS Architecture & Startup Engineering with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start SaaS Architecture & Startup Engineering?
No prior experience is required. SaaS Architecture & Startup Engineering on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Per-Tenant Configuration and Metering” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this SaaS Architecture & Startup Engineering lesson?
Yes. Every SaaS Architecture & Startup Engineering lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Tenant Isolation Strategies
- Database Sharding Techniques
- Customization & Extensibility Design
- Per-Tenant Configuration and Metering