A production Drupal MLM platform models members and positions as Drupal entities, runs commission calculations on queue workers (not the request cycle), uses Drupal Commerce for orders and repurchase, and protects payout integrity with database transactions and idempotent ledger writes.

Architecture

Drupal MLM architecture that scales

The patterns we use to keep genealogy fast and payouts correct as a network grows into millions of members.

Model members and positions as entities

Every distributor is a Drupal user; every placement in a plan is a content entity referencing a sponsor and an upline path. Storing the materialised path (not just parent links) lets the genealogy tree and downline counts load in a single indexed query instead of recursive walks.

Rule of thumb: never compute a downline by walking parents at request time. Store the path, index it, and let the database do the work.

Run commissions on a queue, never in the request

Commission runs touch thousands of ledger rows. We push each run onto Drupal's Queue API and process it with a worker, so a payout calculation can never time out a member's page load. Each job is idempotent — re-running it produces the same ledger, which makes retries safe.

Protect payout integrity with transactions

Wallet debits, commission credits and withdrawal requests all write through database transactions with row-level locking. A single writer owns the ledger so two concurrent runs can't double-pay. The ledger is the source of truth; balances are a cached projection of it.

Lean on Drupal Commerce for money movement

Orders, repurchase, autoship, taxes and promotions are handled by Drupal Commerce rather than custom code. That means battle-tested cart, checkout and payment-gateway plumbing, and a clean event to trigger commission accrual when an order completes.

Cache aggressively, invalidate precisely

Public replicated sites and dashboards are cached with Drupal's cache tags. When a member's rank or balance changes, only their tags are invalidated — so the platform stays fast without ever showing stale money.

Decisions

Architecture choices at a glance

ConcernPatternWhy
Genealogy readsMaterialised upline path + indexO(1) downline queries
Commission runsQueue API + idempotent workersNo request timeouts, safe retries
Payout integrityDB transactions + single writerNo double payments
Orders & repurchaseDrupal CommerceProven checkout & gateways
Scale-outRedis cache + read replicasHandles traffic spikes
Security

Compliance is built in, not bolted on

Role-based access, KYC gates and immutable audit logs are first-class in Drupal. Every money-moving action is attributable to a user and a timestamp.

  • Coordinated security patches from the Drupal Security Team
  • Granular permissions per role and plan
  • Full audit trail on wallet and rank changes
  • Data residency on your own infrastructure

Ready to get started?

Book a free demo or ask our AI assistant anything — it's here 24/7.