Complete System Documentation

Platform Guide & Client Client Handover

A fully verified, production-ready arbitrage investment platform with 16-level MLM commissions, blockchain deposit flows, and a complete admin control centre β€” built and delivered across 4 milestones.

JWT + bcrypt Security
Production Build Verified
Delivered on Schedule
vexta.platform β€” handover.doc
VERIFIED

Milestone Progress

01Setup, Auth & Foundation
Days 1–3
02Core Logic & Deposits
Days 4–7
03Withdrawals & Admin Panel
Days 8–11
04History, Testing & Delivery
Days 12–14
43
Compiled Routes
4/4
Milestones Done
7
Languages

Table of Contents

1. Executive Summary

VEXTA is a fully-featured, production-ready arbitrage investment platform built for a multi-level marketing business model, serving a global user base with a rich multilingual interface, transparent financial ledger, and sophisticated MLM commission engine.

Blockchain Deposits

TRC20, BEP20, ERC20 β€” TX hash submission with admin verification flow.

Automated Daily Profits

Daily arbitrage ROI credited to members' wallets based on their active investment plan.

16-Level MLM Commissions

Auto-distributed across up to 16 upline sponsors on every approved deposit.

Full Admin Control Center

Approve transactions, manage users, configure fees, and toggle system-wide access controls.

2. Technology Architecture

LayerTechnologyPurpose
FrontendNext.js 16.2 (App Router)Server + client rendering, routing, 43-route generation
LanguageTypeScriptType-safe across all frontend and backend code
StylingTailwindCSS + custom CSS tokensGlassmorphic dark-mode-first premium responsive UI
DatabaseMongoDB AtlasCloud-hosted scalable NoSQL document database
ORMPrismaType-safe schema definitions, migrations, and queries
AuthJSON Web Tokens (JWT)Stateless, cookie-based session management
ValidationZodRuntime input validation on all API routes
TranslationsCustom React Context7 languages: EN Β· ES Β· VI Β· TH Β· PT Β· KO Β· FR
The application bundles 43 routes β€” 9 admin pages, 8 user dashboard pages, 19 API endpoints, and auth flows β€” all verified via yarn build.

3. Completed Milestones

01

Setup, Auth & Foundation

Days 1–3 Β· 20% of Project

Complete
  • Next.js 16 + TypeScript, Prisma ORM β†’ MongoDB, clean /app /server /components /lib /scripts architecture.
  • 9 database models: User, Plan, Investment, DailyROIEntry, ReferralLink, Commission, Transaction, Withdrawal, Settings.
  • Email OTP verification on signup, JWT cookie generation on login, password recovery with expiring tokens.
  • Dual-role architecture (user / admin) enforced on every route and page redirect via JWT claims.
  • Responsive DashboardLayout and AdminLayout with glassmorphism, animated sidebars, notification bells, mobile nav.
  • 7-language TranslationProvider (EN, ES, VI, TH, PT, KO, FR) switchable from settings with localStorage persistence.
  • WelcomeTour at /dashboard β€” animated first-login overlay guiding new users through all platform features.
02

Core Business Logic & Deposits

Days 4–7 Β· 40% of Project

Complete
  • Manual Deposit Flow at /dashboard/deposit: TX hash + amount + network β†’ held as pending until admin approves.
  • Instant Simulation at /dashboard/deposit: sandbox mode instantly credits balance for demo without blockchain.
  • Arbitrage Plans at /dashboard/arbitrage: funds deducted and locked into time-bound contracts immediately.
  • 16-Level Unilevel Commission Engine: commissions auto-distributed on every deposit approval up the full sponsor chain.
  • Daily ROI Arbitrage Engine: weekday-only, once-per-day, 300% lifetime cap enforcement.
  • Atomic Transaction Ledger: every financial event written immutably to the Transaction model.
03

Withdrawals & Admin Panel

Days 8–11 Β· 25% of Project

Complete
  • Withdrawal System at /dashboard/withdraw: amount, wallet, network β€” balance locked immediately on submit.
  • Dynamic withdrawal fee (default 6%) pulled live from Settings, shown transparently before confirmation.
  • Admin Dashboard /admin: real-time metrics β€” users, volume, pending deposits, pending withdrawals.
  • Admin Deposit Approvals /admin/deposits: inspect TX hash, approve (credits user + MLM cascade) or reject.
  • Admin User Management /admin/users: member list with balance, earnings, and activation toggle.
  • Admin Analytics /admin/analytics: charts for user growth, deposit volume, earnings trends.
  • Persistent Settings /admin/settings: Maintenance Mode, Registrations toggle, all fee rates β€” live DB-backed.
04

History, Testing & Delivery

Days 12–14 Β· 15% of Project

Complete
  • Earnings History at /dashboard/earnings: ROI payouts and commission credits with level depth indicators.
  • Withdrawal History at /dashboard/withdraw: status badges and fee breakdowns per request.
  • Portfolio View at /dashboard/portfolio: active and completed contracts with per-plan earnings tracking.
  • Referrals Page at /dashboard/referrals: referral tree, copyable link, and commission history per recruit.
  • Mobile Responsiveness: all layouts verified on mobile breakpoints with touch-friendly controls.
  • Production Build: yarn build passes all 43 routes with zero TypeScript errors.

4. Database Models

MongoDB via Prisma β€” 9 models. Complete field reference:

User β€” Member Accounts

FieldTypeDescription
emailString (Unique)Login email address
referralCodeString (Unique)Auto-generated code for referral sharing
uplineIdObjectId?Direct sponsor in the MLM chain
role"user" | "admin"Access level for the account
balanceFloatSpendable wallet balance
activeDepositFloatTotal currently locked in contracts
planRateFloatDaily ROI % of subscribed plan
totalEarnedFloatCumulative lifetime ROI received
totalCommissionFloatCumulative lifetime MLM bonuses

Settings β€” Global Platform State

FieldDefaultLive Effect When Changed
maintenanceModefalseBlocks all user API access (503). Admins unaffected.
newRegistrationstrueOFF closes registration endpoint immediately.
referralRate15.0%Applies to all future commission calculations.
withdrawalFee6.0%Deducted from all future withdrawal requests.
tradingFee2.0%Deducted from plan subscriptions.

Transaction β€” Financial Ledger Types

typeWhen CreatedKey Fields
depositOn approved blockchain depositamount, status, metadata (TX hash, network)
withdrawalOn withdrawal submissionamount (negative), reference (withdrawal ID)
daily_roiOn each ROI distribution runamount, description "Daily arbitrage profit"
commissionOn each unilevel payoutamount, fromUserId, level (1–16)

5. User Panel Guide

Click any tile below to navigate directly to that page. All user pages share the animated sidebar, balance toggle, notification bell, and language switcher.

Withdrawal Fee Breakdown Example

Gross Amount:   $1,000.00
Fee (6%):       -$60.00
Net Payout:      $940.00

Note: Fee rate pulled live from Admin Settings.

6. MLM Commission Engine

Unilevel MLM plan distributing commissions across up to 16 sponsor levels on every approved deposit.

Commission Rate Table

LevelRelationshipRate
Level 1Direct Sponsor8.00%
Level 2Sponsor's Sponsor4.00%
Level 33rd upline2.00%
Level 44th upline1.00%
Level 55th upline1.00%
Levels 6–10Extended network0.50% each
Levels 11–16Deep network0.25% each

$10,000 Deposit β€” Worked Example

RecipientLevelEarned
User EL1 Β· 8%$800.00
User DL2 Β· 4%$400.00
User CL3 Β· 2%$200.00
User BL4 Β· 1%$100.00
User AL5 Β· 1%$100.00
Total auto-distributed: $1,600.00 credited to 5 sponsors on admin approval.
  • If the chain is shorter than 16 levels, the engine stops gracefully at the top β€” no errors.
  • If a sponsor is not found at a level, that level is skipped and the engine continues upward.
  • Every commission writes a Transaction entry with depositor's ID and level index for full auditability.
  • Fail-silent: a failure at one level does not cancel payouts for remaining levels.
  • Admin debug: GET /api/admin/test-unilevel/{userId}/{amount}

7. Daily ROI Engine

Execution Rules

RuleDetail
Weekday OnlyMonday–Friday only. Sat/Sun returns an error.
Once Per DayChecks Settings.lastDailyRun. Duplicate runs return 400.
Weekend BypassAdmins can force-run with bypassWeekendCheck: true.

ROI Formula & 300% Cap

Daily = Deposit Γ— (Plan Rate / 100)
E.g.  $5,000 Γ— 0.015 = $75.00/day

Cap:  Max = $5,000 Γ— 3.0 = $15,000 total
      Pro-rated on final payout if cap exceeded

Trigger API

POST /api/admin/run-daily-roi
Body (demo): { "bypassWeekendCheck": true }
β†’ { "success": true, "usersPaid": 47, "totalDistributed": 12844.50 }

8. Admin Control Panel

Admin workspace restricted to role: "admin". Click any tile to navigate. All admin routes return 403 Forbidden to non-admin JWTs.

FieldDefaultLive Effect When Changed
Maintenance ModeOFFBlocks all user APIs with 503. Admins keep full access.
Allow New RegistrationsONOFF rejects all /api/auth/register requests immediately.
Withdrawal Fee6%Applied to all future withdrawal requests instantly.
Referral Commission Rate15%Applied to all future commission calculations.

9. Security & Auth

Security LayerImplementation
Password Hashingbcrypt with 12 salt rounds β€” passwords never stored in plain text.
Session ManagementHttpOnly JWT cookies β€” inaccessible to JavaScript (XSS-resistant).
Input ValidationZod schemas on all API routes β€” malformed data rejected before DB access.
Role EnforcementgetUserFromRequest() verifies JWT on every protected route; admin routes check role.
Anti-Double-SpendWithdrawal amount deducted from balance at submission time β€” concurrent duplicates blocked.
Maintenance GatemaintenanceMode checked at API entry β€” 503 returned before any DB query.

10. Simulation & Demo

MLM Chain Seeder

User A (Top Β· REF_A)
  └── User B (Referred by A)
        └── User C (Referred by B)
              └── User D (Referred by C)
                    └── User E (Referred by D)
                          └── User F (Referred by E)

Run: node scripts/seed-mlm.js
All passwords: Password@123

Full Demo in Under 2 Minutes

  1. 1
    Run: node scripts/seed-mlm.js
  2. 2
    Log in as User F β€” userf@test.com / Password@123
  3. 3
    Go to /dashboard/deposit β†’ Manual Mode β†’ any amount + mock TX hash β†’ Submit.
  4. 4
    Log out. Log in as admin.
  5. 5
    Go to /admin/deposits β†’ approve the deposit.
  6. 6
    Check User E–A in /admin/users β€” each received commission.
  7. 7
    Click "Run Daily ROI" on /admin (bypass weekends if needed).
  8. 8
    Return to /dashboard as User F β€” daily profit credited.

11. API Reference

Authentication Routes

MethodEndpointDescription
POST/api/auth/registerRegister new account (checks newRegistrations setting)
POST/api/auth/loginAuthenticate and receive JWT session cookie
GET/api/auth/meReturn current authenticated user profile
POST/api/auth/verifyVerify email with 6-digit OTP code
POST/api/auth/resendResend OTP verification email

User Routes

MethodEndpointDescription
GET/api/dashboard/statsUser metrics, investments, recent transactions
POST/api/depositSubmit deposit (instant sandbox or pending manual)
GET/POST/api/withdrawalsHistory / submit withdrawal with fee calculation
GET/api/earningsROI and commission earnings history
GET/api/plansAll active arbitrage plans
GET/api/referralsReferral network and commission ledger
GET/api/investmentsInvestment portfolio

Admin Routes

MethodEndpointDescription
GET/api/admin/statsPlatform-wide metrics and pending counts
GET/POST/api/admin/depositsList / approve / reject manual deposits
GET/POST/api/admin/withdrawalsList / approve / reject withdrawals
GET/api/admin/usersList all registered users
GET/api/admin/transactionsPlatform-wide transaction ledger
GET/POST/api/admin/settingsRetrieve / update platform settings
POST/api/admin/run-daily-roiTrigger daily ROI distribution
GET/api/admin/test-unilevel/:userId/:amountTest MLM commission for a user
GET/api/admin/downline/:userIdGet full downline tree for a user

12. Developer Tooling

Commands

yarn install          # Install dependencies
yarn dev              # Dev server β†’ localhost:3000
node scripts/seed-mlm.js  # Seed MLM demo chain
yarn build            # Verify 43 routes compile

Environment Variables

DATABASE_URL=mongodb+srv://...
JWT_SECRET=your-secret-key
NEXTAUTH_URL=http://localhost:3000
FilePurpose
prisma/schema.prismaAll 9 database model definitions
server/services/commission.service.ts16-level Unilevel MLM engine
server/services/earnings.service.tsDaily ROI distribution engine
app/api/deposit/route.tsDeposit handler (sandbox + manual)
app/api/admin/deposits/route.tsApproval trigger + MLM commission cascade
app/api/admin/settings/route.tsPersistent platform settings API
app/api/withdrawals/route.tsWithdrawal + dynamic fee calculation
components/translation-provider.tsx7-language translation context
scripts/seed-mlm.jsMLM demo chain seeder

VEXTA

VEXTA CONFIDENTIAL Β· May 2026

All Milestones Verified & Deployed