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.
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.
Architecture choices at a glance
| Concern | Pattern | Why |
|---|---|---|
| Genealogy reads | Materialised upline path + index | O(1) downline queries |
| Commission runs | Queue API + idempotent workers | No request timeouts, safe retries |
| Payout integrity | DB transactions + single writer | No double payments |
| Orders & repurchase | Drupal Commerce | Proven checkout & gateways |
| Scale-out | Redis cache + read replicas | Handles traffic spikes |
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.