Explore this guide
A multi-tenant iGaming platform needs explicit isolation of data, financial authority, provider access and operating actions for each tenant. Sharing application code or infrastructure does not justify sharing player permissions, wallet operations or unscoped administrative access.
This architecture guide is for B2B platform teams serving multiple operator organizations. Its policies and pseudocode are illustrative design recommendations, not a certified deployment, legal operating model or measured capacity result. For project scoping, see custom iGaming platform development.
Define the tenant boundary before the database layout
A tenant can represent an operator or another contracted isolation boundary. A brand, domain or currency is not automatically the same boundary. Record the actual legal/operating relationships with the responsible advisers and product owners.
Map which identities, funds, configuration, providers, reports and support actions belong to that tenant. If several brands legitimately share services, document the permitted relationship rather than relying on matching domain suffixes or a shared login.
AWS's tenant-isolation guidance distinguishes isolation from general authentication/authorization. A user can be logged in and allowed to use a feature while still requiring tenant-scoped resource checks.
Treat isolation as an invariant across the entire request and background-processing path, not as a filter used only on the main player list.
Technical flow
- 01Verify membership
Establish authenticated membership and authorized tenant context
- 02Bind trusted scope
Propagate trusted scope through jobs, caches and provider credentials
- 03Isolate resources
Enforce storage, financial and resource boundaries under the chosen model
- 04Audit + recover
Test support access, exports, restores and cross-tenant negative cases
The diagram follows verified identity into a trusted tenant context, scoped application/storage access and isolated evidence. A caller's claimed tenant ID is input to validate, not authority to grant.
| Layer | Isolation question |
|---|---|
| Identity | Which tenant memberships and roles are actually verified? |
| API | Does the requested resource belong to the allowed scope? |
| Storage | Are reads, writes and uniqueness constraints tenant-safe? |
| Queue/worker | Does background work retain and validate the intended scope? |
| Provider adapter | Which approved account/credentials may this tenant use? |
| Operations | Can support, reports, exports and restores cross the boundary? |
Different layers can use different controls, but every path needs a documented answer. A tenant-scoped UI does not protect an unscoped export job.
Compare pooled, dedicated and hybrid resources
Pooled application/storage can simplify shared changes and resource use while demanding fine-grained isolation and fairness. Dedicated resources can provide a coarser boundary while increasing provisioning, upgrade and recovery work. A hybrid can separate selected data or high-impact dependencies.
Select per component rather than declaring the whole platform “single” or “multi” tenant. A shared control plane can manage tenant configuration while financial stores or provider accounts remain separately scoped.
| Choice | Benefit to examine | Cost/risk to examine |
|---|---|---|
| Shared tables/resources | Common implementation and operational tooling | Query scoping, policy bypass and noisy neighbors |
| Dedicated databases/stacks | Clearer resource boundary for selected scope | Fleet changes, provisioning and restore coordination |
| Hybrid | Match isolation to component responsibility | More interface/configuration combinations to test |
No option is universally cheaper, compliant or scalable. Base the choice on actual isolation requirements, dependencies and operating evidence.
Establish trusted context at entry
Verify the caller's identity and allowed tenant membership, then bind the requested operation to that scope. Do not accept an arbitrary tenantId header as sufficient permission. Administrative “switch tenant” functions need explicit authorization and an audit trail.
Apply resource ownership checks even when identifiers appear globally unique. Guess-resistant IDs can reduce accidental discovery, but they do not replace authorization.
handle(request):
identity = authenticate(request)
membership = verify_allowed_tenant_membership(identity, request.scope)
context = create_trusted_scope(membership)
authorize_action(context, request.action)
resource = load_resource_under_scope(context, request.resource_id)
require_resource_belongs_to(context)
perform_scoped_operation(context, resource)
This is a control outline, not a runnable identity-provider integration. The trust boundary must remain valid when a worker, scheduled job or internal service calls the same operation.
Design storage and financial identities for isolation
Include tenant scope in relationships and uniqueness boundaries where identifiers are only locally unique. A provider operation reference can repeat across separate contracted accounts; an unscoped uniqueness key can either mix effects or reject legitimate operations from another tenant.
For financial writes, bind tenant, provider/account identity, player, amount, currency and operation kind to the recorded effect. A repeat with conflicting scope is an error, not an instruction to return another tenant's stored result.
PostgreSQL row-security documentation describes row-level policies and important bypass behavior for privileged roles/table owners. If using RLS, review the actual application role and applicable enforcement configuration; enabling a policy without testing its execution context is insufficient.
For pooled connections, establish and clear transaction-scoped context correctly. A previous request's tenant state must not be reused by the next borrower. Treat privileged maintenance, migration and reporting connections as separate risk paths.
The wallet architecture guide covers balanced postings and concurrency; tenant isolation adds another required dimension to those invariants.
Carry scope through caches, queues and provider adapters
Cache keys should include the dimensions that determine permitted reuse. Tenant-specific configuration, account order state and private financial records must not share a namespace merely because their market/player identifiers look similar.
Background messages need a trustworthy tenant/account context and a validated handler. A worker should not select credentials from an untrusted payload without checking that the operation is authorized for that configuration.
Bind provider credentials and data rights to the approved tenant scope. Some arrangements may permit shared reference data; others require separate access or restricted redistribution. Document the contract instead of deriving permission from a shared backend connection.
Apply both tenant fairness and provider-level limits. Giving each tenant an internal budget does not multiply an upstream allowance that applies to one shared provider account. See the rate-limit guide for scope-aware scheduling.
Separate configuration and authority
Version configuration that changes financial or operating decisions: market mappings, limits, currencies, provider routes, settlement policies and privileged roles. Record actor, tenant, reason and activation version.
Validate changes against that tenant's supported scope before activation. A control-plane change should not silently enable a payment method for an entity without its required provider approval.
Use staged rollout and an explicit rollback/reconciliation plan where changes affect accepted transactions. Rolling back a configuration file does not undo external orders or payments that already occurred.
For a hypothetical two-tenant test, changing tenant A's payout configuration should leave B's routing and active operations unchanged. Verify actual records and provider-account selection, not just which logo appears in the dashboard.
Control operational access and noisy neighbors
Support and finance tools are part of the isolation boundary. Scope searches, exports, reports and adjustment operations to authorized tenants. Record cross-tenant administrative actions and restrict emergency access to the approved process.
Protect shared capacity with bounded queues and fair scheduling where appropriate. A large report or reconnect burst from one tenant should not consume all capacity needed for another's critical financial reconciliation.
Monitor per-tenant outcomes while controlling sensitive data and metric cardinality. Report unresolved operations, processing age and isolation-policy failures without placing unnecessary player identifiers in every metric label.
Use separate escalation records for a tenant-local incident and a shared-platform incident. The receiving operator needs accurate scope, not an unexplained global “healthy” indicator.
Restore and exit without crossing boundaries
Rehearse restoring the required tenant scope in an isolated environment. A whole-database backup does not automatically support safe tenant-specific recovery or export.
Account for external operations since the restore point, including pending withdrawals, game rounds and exchange orders. Re-establish financial evidence before resuming affected actions.
Validate export contents and access permissions. Include necessary historical references/configuration while respecting the agreed retention and transfer rules. Do not delete financial history merely because a brand is deactivated or a tenant requests an unsupported cleanup action.
The migration guide provides the surrounding cutover framework; isolation determines which records and services that cutover is permitted to touch.
An isolation acceptance matrix
| Injection | Required observation |
|---|---|
| Tenant A requests B's resource ID | No unauthorized read or write |
| Reused provider reference across tenants | Correct scoped operations, no collision or shared result |
| Connection returns to pool | No leaked tenant context on reuse |
| Worker receives altered tenant/account fields | Rejected or quarantined, no credential crossover |
| Cache key omits tenant scope | Test exposes the defect before production |
| Tenant A overloads a shared path | Measured fairness/restriction behavior for B |
| Support/export/restore action | Explicit permission, scope and audit evidence |
These are proposed tests, not results from a deployed B2B platform. Run both positive allowed-sharing cases and negative isolation cases; blocking all access is not proof the intended product works.
Frequently asked questions
Is a tenant the same as a website brand?
Not necessarily. Define the actual operator and permitted resource boundary before using brand or domain labels as isolation keys.
Does authentication establish isolation?
No. Verified identity and feature permission still need tenant-scoped resource enforcement across every path.
Is a separate database always required?
No universal architecture applies. Evaluate pooled, dedicated and hybrid boundaries against actual requirements and operating evidence.
Can RLS replace application authorization?
Treat it as one storage control with a reviewed execution context. APIs, workers, caches, provider credentials and operational actions also need appropriate enforcement.
Can a shared provider account be assumed to permit all tenants?
No. Verify permissions and data rights for the actual arrangement, and apply its real account-level limits.
Further reading