Architecture choices that stay fast at scale
The patterns we use to keep genealogy reads instant and payouts correct as a network grows into millions of members.
Model positions as entities, store the path
Every distributor is a Laravel model and every placement in a plan references a sponsor plus a materialised upline path. Storing the path, not just parent links, lets downline counts and the genealogy tree load in one indexed query instead of a recursive walk.
Run commissions on Horizon, never in the request
Commission runs touch thousands of ledger rows. Each run is pushed onto a queue and processed by Horizon workers, so a payout calculation can never time out a member page load. Jobs are idempotent, which makes retries safe after a deploy or a spot instance restart.
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 cannot double pay. The ledger is the source of truth and balances are a cached projection of it.
Cache aggressively, invalidate precisely
Replicated sites and dashboards are cached in Redis and tagged per member. When a rank or balance changes, only that member tags clear, so the platform stays fast without ever showing stale money.
Decisions at a glance
| Concern | Pattern | Why it wins |
|---|---|---|
| Genealogy reads | Materialised upline path plus index | Constant time downline queries |
| Commission runs | Horizon queues, idempotent jobs | No request timeouts, safe retries |
| Payout integrity | DB transactions, single writer | No double payments |
| Orders and repurchase | Cashier plus a clean order event | Proven checkout and gateways |
| Scale out | Redis cache and read replicas | Handles launch day traffic spikes |
From order to payout, one clean path
An order completes, Cashier fires an event, the engine accrues commissions on a queue, the ledger settles, and only the affected caches clear. Every step is observable in Telescope.
Talk architecture with our team
Bring your compensation plan and we will map it to a build spec you can review.