Table of Contents

1. System Overview

NMXpert is a multi-tenant SaaS MLM & Network Business Management Platform. It enables companies to run binary, unilevel, matrix, generation, board, breakaway, matching, rank, leadership, pool, and hybrid compensation plans — all from a single installation.

Tagline SMART NETWORK. SMARTER GROWTH.

Key Capabilities

11 Plan Types

Binary, Unilevel, Matrix, Generation, Board, Breakaway, Matching, Rank, Leadership, Pool, Hybrid

5 Wallet Types

Commission, Purchase, Cashback, Reward, Main — each for different earning/spending

11 User Roles

Super Admin down to Customer, with granular permission-based access control

Fraud Detection

Automated checks for duplicate KYC, bank accounts, UPI IDs, and multiple registrations

2. Architecture & Tech Stack

┌─────────────────────────────────────────────────────────┐
│                    CLIENT BROWSERS                       │
│         Admin Portal │ Member Portal │ Customer Portal   │
│              Bootstrap 5 + Chart.js + Vanilla JS         │
└────────────────────────┬────────────────────────────────┘
                         │  HTTP/HTTPS (JSON API)
┌────────────────────────▼────────────────────────────────┐
│                   PHP 8.3+ BACKEND                       │
│  Controllers (13) │ Services (8) │ Middleware (3)        │
│  Helpers (5) │ Models (1) │ Config (3)                   │
└────────────────────────┬────────────────────────────────┘
                         │  PDO (MySQL)
┌────────────────────────▼────────────────────────────────┐
│                    MySQL 8+ DATABASE                     │
│              75 tables │ nmxpert database                │
└─────────────────────────────────────────────────────────┘

File Structure

NMXpert/
├── backend/
│   ├── config/          # database.php, app.php, constants.php
│   ├── app/
│   │   ├── Controllers/ # Auth, Dashboard, Member, Product, Order,
│   │   │                # Wallet, Withdrawal, Genealogy, Kyc,
│   │   │                # Report, Notification, Support, Search
│   │   ├── Services/    # Commission, Wallet, PlanEngine, Rank,
│   │   │                # Audit, Notification, Fraud, Currency
│   │   ├── Middleware/   # Auth, Role, RateLimiter
│   │   ├── Helpers/     # Response, Validator, JwtHelper, Logger, FileUploader
│   │   └── Models/      # Database (PDO singleton)
│   └── public/          # index.php (API entry point)
├── web/
│   ├── admin/           # 16 admin pages
│   ├── member/          # 14 member pages
│   ├── customer/        # 1 customer page
│   ├── includes/        # header, footer, topbar, sidebars
│   └── assets/          # css/, js/, img/
├── database/
│   └── schema.sql       # 75 tables + seed data
└── docs/
    └── MANUAL.md        # This manual

3. User Roles & Portals

Three Portals

PortalURLPurpose
Admin/web/admin/Company management, member oversight, approvals
Member/web/member/MLM distributor self-service
Customer/web/customer/Product browsing & purchase

11 Role Types

#RoleSlugAccess Level
1Super Adminsuper-adminFull system access
2Company Admincompany-adminCompany-level management
3Branch Adminbranch-adminBranch-level management
4Finance Managerfinance-managerWallets, withdrawals, reports
5Sales Managersales-managerOrders, products, members
6KYC Managerkyc-managerKYC review & approval
7Warehouse Managerwarehouse-managerInventory & stock
8Support Executivesupport-executiveTicket management
9AuditorauditorAudit logs, read-only reports
10MembermemberMLM distributor
11CustomercustomerProduct purchaser

Default Login Credentials

RoleEmailPassword
Super Adminadmin@nmxpert.comAdmin@123
Demo Memberdemo@member.compassword

4. System Flows

4.1 Registration Flow

New Member ──► Visits Registration Page │ ▼ Enters: Name, Mobile, Email, Password Enters: Sponsor Code (required) Enters: Position (left/right for binary) │ ▼ Backend validates input → Checks sponsor exists → Creates users record (role = member) → Creates members record with: • Unique member_code (MEM000001) • Unique referral_code (ABC12345) • sponsor_id → links to sponsor • placement_id → links to binary tree parent → Creates 5 wallets → Places in genealogy tree → Sends notification to sponsor │ ▼ Member Status: "inactive" KYC Status: "pending"

4.2 Activation Flow

New Member ──► Submits KYC Documents │ ▼ Uploads: PAN, Aadhaar, Photo, Bank Statement → kyc_requests record created → kyc_documents records created │ ▼ Admin Reviews KYC → FraudService checks: • Duplicate PAN/Aadhaar • Duplicate bank account • Duplicate UPI ID • Multiple accounts from same IP → Risk score calculated (0-100) │ ▼ KYC Approved → Member Status: "active" KYC Rejected → Member must resubmit │ ▼ OR: Member self-activates via product purchase

4.3 Order & Commission Flow

Member ──► Places Order (Product Purchase) │ ▼ Order Created → order_number generated → total_bv, total_pv computed → payment processed │ ▼ CommissionService Triggered: │ ├─── 1. BINARY BONUS │ → Updates left/right BV │ → Matches pairs → Credits commission wallet │ ├─── 2. DIRECT BONUS │ → % of order BV → Credits sponsor's wallet │ └─── 3. LEVEL BONUS → Walks up sponsor chain (5 levels) → Each gets % → Credits respective wallets │ ▼ Wallet Transactions Logged Rank Evaluation Triggered Notifications Sent

4.4 Withdrawal Flow

Member ──► Requests Withdrawal │ ▼ Validates: balance, KYC, limits → Deducts fee + TDS → Debits wallet immediately → Status: "pending" │ ▼ Admin Reviews → Approves or Rejects │ ├─── APPROVED → Processes payment → Status: "paid" └─── REJECTED → Credits wallet back → Notifies member

5. Admin Portal Guide

5.1 Dashboard

Overview of all key metrics at a glance.

MetricDescription
Total MembersAll registered members in the company
Active MembersMembers with "active" activation status
New TodayMembers registered today
Total SalesSum of all confirmed order amounts
Total CommissionSum of all approved/paid commissions
Pending WithdrawalsWithdrawal requests awaiting review
Pending KYCKYC submissions awaiting review
Total ProductsActive products in catalog

Also includes: Sales Trend chart, Commission Distribution chart, Recent Members, Recent Orders.

5.2 Members Management

5.3 Products

5.4 Orders

5.5 Plans

5.6 Commissions

5.7 Wallets

5.8 Withdrawals

5.9 Ranks

5.10 KYC

5.11 Reports

5.12 Settings

6. Member Portal Guide

6.1 Dashboard

WidgetShows
Member InfoName, code, rank, activation status
Wallet BalancesBy type (commission, purchase, etc.) + total
IncomeToday's income, Monthly income, Total income
BV/PVPersonal BV, Team BV, Personal PV, Team PV
Team StatsDirect members, total team, active, inactive
Rank ProgressCurrent rank, next rank, progress bar

6.2 My Network

6.3 Shop

6.4 Wallet

6.5 Withdrawals

7. MLM Compensation Plans

NMXpert supports 11 plan types. A company can configure one or combine multiple.

7.1 Binary Plan

Sponsor / \ Left Right (Leg) (Leg) Pair Matching: pair_count = min(left_bv, right_bv) / pair_bonus_rate commission = pair_count × pair_bonus_rate Rules: - Max pairs per day configurable - Carry forward (unmatched BV rolls over) - Flush percentage (resets unmatched BV) - Minimum personal BV required

7.2 Unilevel Plan

You / | | | \ L1 L1 L1 L1 ← Level 1: 10% /|\ ... L2 L2 L2 ← Level 2: 5% ... L5 L5 L5 ← Level 5: 1% Up to 10 levels configurable Each level has its own percentage

7.3 Matrix Plan

Fixed width × depth: 3×2 matrix = 3 wide × 2 deep = 9 members max 2×3 matrix = 2 wide × 3 deep = 14 members max Completion bonus when matrix fills Re-entry option for earning again

7.4 Other Plans

PlanDescription
GenerationPays on generational depth with leadership bonus on deep legs
BoardCycling boards (2×1, 2×2) with completion bonuses
BreakawayStrong legs "break away" as separate businesses
MatchingMatches earning of personally sponsored members
RankBonus paid when rank is achieved
LeadershipBonus for leadership positions
PoolProfit pool shared among top rankers
HybridCombination of multiple plan types

8. Commission Engine

Commission Types

TypeTriggerRecipientCalculation
direct_bonusOrder placedSponsor% of order BV
binary_bonusBinary pair matchBinary parentFixed per pair
level_bonusOrder placedUpline chain% per level (up to 10)
pair_bonusBinary matchBinary parentPer matched pair
matching_bonusReferral earnsSponsor% of referral's commission
rank_bonusRank achievedQualified memberFixed per rank
leadership_bonusMonthlyTop performersPool distribution
cashbackOrder placedBuyer% of order value

How Commissions Are Calculated

  1. Member places an order and payment is confirmed
  2. CommissionService.processOrderCommission(orderId) is triggered
  3. Runs inside a database transaction (all or nothing)
  4. Calculates Binary Bonus: matches left BV vs right BV pairs
  5. Calculates Direct Bonus: percentage of order BV to sponsor
  6. Calculates Level Bonus: walks up sponsor chain (5 levels deep)
  7. Each commission creates a commission_transactions record
  8. 10% tax deducted, net amount credited to member's commission wallet
  9. Wallet transaction logged with balance before/after
  10. Rank evaluation triggered for the member
  11. Notifications sent to all commission recipients

9. Wallet System

5 Wallet Types

WalletPurposeCredits FromDebits For
CommissionMLM earningsCommission paymentsWithdrawals, transfers
PurchaseProduct buyingAdmin creditProduct orders
CashbackCashback rewardsOrder cashbackWithdrawals
RewardBonus rewardsAchievementsWithdrawals
MainGeneral purposeAdmin creditVarious

Wallet Operations

10. Withdrawal Process

Step-by-Step

  1. Member requests → Selects wallet type, amount, payment method (bank/UPI)
  2. Validation → Balance check, KYC check, limit check
  3. Deductions → Fee (% from plan) + TDS (% from plan) deducted
  4. Wallet debited → Balance reduced immediately
  5. Status: pending → Awaits admin review
  6. Admin reviews → Approves or rejects with reason
  7. If approved → approved → payment processed → paid
  8. If rejected → rejected → wallet credited back → member notified

Withdrawal Limits (Default)

ParameterDefault ValueConfigurable
Minimum₹100Yes (per plan)
Maximum₹50,000Yes (per plan)
Fee2%Yes (per plan)
TDS5%Yes (per plan)

11. KYC Verification

Required Documents

DocumentType KeyPurpose
PAN CardpanIdentity & tax
Aadhaar CardaadhaarAddress proof
PassportpassportIdentity
Driving Licensedriving_licenseIdentity
Voter IDvoter_idIdentity
Bank Statementbank_statementAddress proof
PhotophotoProfile photo

KYC Status Flow

pending ──► approved │ └──► rejected ──► resubmission ──► pending (resubmitted)

Fraud Detection Checks

Before KYC approval, FraudService automatically checks:

12. Rank & Achievement System

8 Default Rank Levels

LevelRankMin Personal BVMin Team BVMin Direct
1Member000
2Associate5001,0002
3Bronze1,0005,0003
4Silver2,00015,0005
5Gold5,00050,00010
6Platinum10,000150,00020
7Diamond25,000500,00050
8Crown50,0001,000,000100

How Rank Promotion Works

  1. RankService.evaluateMember(memberId) is called after every order
  2. Fetches member's current stats (BV, team size, direct members)
  3. Iterates through ranks in ascending order
  4. Checks all thresholds: personal BV, team BV, direct members, left/right BV
  5. If ALL thresholds met → auto-promotes
  6. Creates member_ranks and rank_achievements records
  7. Sends rank promotion notification

13. Genealogy / Network Tree

Two Tree Types

Sponsor Tree

Shows who recruited whom. Hierarchical: your recruits → their recruits → etc. Used for tracking the recruitment chain.

Placement Tree

Shows binary position placement (left/right legs). Used for binary pair matching and BV tracking.

Tree Node Data

Each node displays: Member Code, Name, Personal BV, Team BV, Activation Status, Rank.

API Endpoints: GET /genealogy/sponsor and GET /genealogy/placement

14. Product & Order Management

Product Attributes

FieldDescription
nameProduct name
skuStock keeping unit
priceRetail price
sale_priceDiscounted price
bvBusiness Volume (for commissions)
pvPoint Volume (for rank)
cvCommission Volume
tax_percentageGST/VAT rate
is_activePublished or hidden

Order Lifecycle

pending ──► confirmed ──► processing ──► shipped ──► delivered ├──► cancelled └──► returned

Order Financial Breakdown

subtotal = sum(item_prices)
tax_amount = sum(item_taxes)
discount_amount = coupon discount
shipping_amount = shipping charge
total_amount = subtotal + tax - discount + shipping
total_bv = sum(item_bv × quantity)   ← for commissions
total_pv = sum(item_pv × quantity)   ← for rank qualification

15. Notifications & Support

Notification Events

System sends in-app notifications for: registration, new_referral, order, payment, commission, rank_achievement, kyc, withdrawal, product, subscription, support_ticket, announcement.

Support Ticket System

Ticket Lifecycle: open → in_progress → waiting → resolved → closed Priority Levels: low → medium → high → urgent Features: - Threaded messages - Internal notes (staff only) - File attachments - Assignment to staff - Status tracking

16. API Reference

Base URL

http://localhost/NMXpert/backend/public/index.php/

Authentication

All authenticated endpoints require: Authorization: Bearer <jwt_token>

Response Format

{
  "success": true,
  "message": "Request successful",
  "data": { ... },
  "errors": []
}

Complete Endpoint List

MethodEndpointAuthDescription
POST/authNoLogin
POST/auth/registerNoRegister
POST/auth/refreshNoRefresh token
POST/auth/logoutYesLogout
GET/auth/meYesCurrent user
POST/auth/forgot-passwordNoReset password
GET/dashboardAdminAdmin stats
GET/dashboard/memberMemberMember stats
GET/membersAdminList members
GET/members/{id}AdminShow member
POST/membersAdminCreate member
PUT/members/{id}AdminUpdate member
DELETE/members/{id}AdminDelete member
GET/productsYesList products
POST/productsAdminCreate product
GET/ordersYesList orders
POST/ordersYesCreate order
GET/walletYesList wallets
POST/wallet/transferYesTransfer funds
POST/withdrawalsYesRequest withdrawal
PUT/withdrawals/{id}/statusAdminApprove/reject
GET/genealogy/sponsorMemberSponsor tree
GET/genealogy/placementMemberPlacement tree
POST/kycMemberSubmit KYC
PUT/kyc/{id}/statusAdminReview KYC
GET/reports/membersAdminMember report
GET/reports/salesAdminSales report
GET/notificationsYesList notifications
GET/supportYesList tickets
POST/supportYesCreate ticket
GET/searchYesGlobal search

17. Troubleshooting

"Network error. Please try again."
Cause: API endpoint not reachable.
Fix:
  1. Ensure XAMPP Apache is running
  2. Check http://localhost/NMXpert/backend/public/index.php/ loads
  3. Verify .htaccess is in backend/public/
  4. Check Apache mod_rewrite is enabled
"Table 'nmxpert.rate_limits' doesn't exist"
Cause: Database not fully imported.
Fix: Open phpMyAdmin → Create database nmxpert → Import database/schema.sql
"Invalid credentials"
Cause: Wrong email/password or user doesn't exist.
Fix: Use default: admin@nmxpert.com / Admin@123
"Authentication token is required"
Cause: Not logged in or token expired.
Fix: Login again. Token expires after 24 hours by default.
"Insufficient permissions"
Cause: User role doesn't have access.
Fix: Check user's role_id in users table. Admin pages require roles 1, 2, or 3.
Dashboard shows loading forever
Cause: API returning error silently.
Fix:
  1. Open browser DevTools (F12) → Network tab
  2. Click the failing request
  3. Check Response tab for error message
  4. Check Console for JavaScript errors
Commission not calculated
Cause: Order not paid or commission already processed.
Fix: Check orders.payment_status = 'paid' and orders.commission_processed = 0.
Wallet balance not updating
Cause: Wallet not created for member.
Fix: Check wallets table has record for the member. Check wallet_transactions for credit/debit records.

18. Frequently Asked Questions

General

What MLM plans does NMXpert support?
11 plan types: Binary, Unilevel, Matrix, Generation, Board, Breakaway, Matching, Rank, Leadership, Pool, and Hybrid. A company can use one or combine multiple.
Can multiple companies use the same installation?
Yes. NMXpert is multi-tenant. Each company has its own company_id that isolates their data. Super Admin manages all companies.
Is there a mobile app?
The web application is fully responsive and works on mobile browsers. A native React Native mobile app is planned for future development.
How are commissions calculated?
The CommissionService and PlanEngine calculate commissions automatically when an order is marked as paid. It processes binary pairs, direct bonuses, and level bonuses in a single database transaction.
Can I customize the commission percentages?
Yes. Go to Admin → Plans → Edit Plan. You can set percentages for each commission type, level, and plan-specific parameters.

Registration & Activation

How does a new member join?
Register with name, mobile, email, password, and a sponsor code. They are placed in the genealogy tree under their sponsor. Status starts as "inactive" until KYC is approved or they make a qualifying purchase.
Is the sponsor code required?
Yes. Every member must be sponsored by an existing member. The sponsor code links them in the genealogy tree.
How does KYC work?
Members upload identity documents (PAN, Aadhaar, etc.) through the KYC page. Admin reviews and approves/rejects. The system runs fraud checks before approval.
Can a member self-activate?
Yes. If the plan has an activation_amount set, purchasing products worth that amount activates the account automatically.

Commissions & Income

When are commissions paid?
Commissions are calculated and credited to the member's wallet instantly when an order is confirmed as paid. The commission status starts as "pending" and moves to "approved" then "paid".
What is BV, PV, and CV?
BV (Business Volume) — Used for binary pair matching and commission calculations.
PV (Point Volume) — Used for rank qualification.
CV (Commission Volume) — Used for commission calculations.
How does the binary bonus work?
Each member has a left leg and right leg. When orders come in on both sides, pairs are matched. Commission is paid for each matched pair up to the daily maximum.
What is the level bonus?
When a member makes a purchase, their sponsor gets a % (e.g., 10%), the sponsor's sponsor gets a % (e.g., 5%), and so on up to the configured number of levels.

Wallets & Withdrawals

How many wallets does each member have?
5 wallets: Commission, Purchase, Cashback, Reward, and Main. Each serves a different purpose.
Can I transfer between wallets?
Yes. Members can transfer funds between their own wallets through the Wallet page.
What are the withdrawal limits?
Minimum and maximum limits are configured per plan. Default: min ₹100, max ₹50,000. A fee (e.g., 2%) and TDS (e.g., 5%) are deducted.
How long do withdrawals take?
Withdrawals go through: pending → under_review → approved → processing → paid. Admin must manually approve and process the payment.
What if my withdrawal is rejected?
If rejected, the amount is credited back to your wallet. You'll see the rejection reason. You can fix the issue and request again.

Ranks

How do I get promoted?
Ranks are auto-promoted based on meeting thresholds: personal BV, team BV, direct members, and other criteria. The system evaluates after every order.
What are the benefits of higher ranks?
Higher commission percentages, rank bonus payments, leadership pool eligibility, and achievement badges.
Can rank be demoted?
The current system only promotes. Demotion rules can be added through the rank configuration.

Technical

What technology stack is used?
PHP 8.3+ (backend), MySQL 8+ (database), Bootstrap 5 (frontend), Chart.js (charts), Node.js + Socket.IO (real-time), JWT (authentication).
How do I reset the admin password?
Run this SQL in phpMyAdmin:
UPDATE users SET password = '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi' WHERE email = 'admin@nmxpert.com';
This sets the password to Admin@123.
How do I enable dark mode?
Click the moon icon in the topbar. The theme preference is saved in localStorage.
Can I change the currency?
Yes. Go to Admin → Settings → Company Settings. Change the currency code and symbol. The system supports INR, USD, EUR, GBP, and more.
How do I backup the database?
In phpMyAdmin, select the nmxpert database → Export → Quick → Go. Or use command line: mysqldump -u root nmxpert > backup.sql
How do I check if the API is working?
Open browser and navigate to: http://localhost/NMXpert/backend/public/index.php/
You should see: {"success":true,"data":{"name":"NMXpert API","version":"1.0.0"}}

NMXpert — SMART NETWORK. SMARTER GROWTH.

Document Version 1.0 | September 2026