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
| Layer | Technology | Purpose |
|---|---|---|
| Frontend | Next.js 16.2 (App Router) | Server + client rendering, routing, 43-route generation |
| Language | TypeScript | Type-safe across all frontend and backend code |
| Styling | TailwindCSS + custom CSS tokens | Glassmorphic dark-mode-first premium responsive UI |
| Database | MongoDB Atlas | Cloud-hosted scalable NoSQL document database |
| ORM | Prisma | Type-safe schema definitions, migrations, and queries |
| Auth | JSON Web Tokens (JWT) | Stateless, cookie-based session management |
| Validation | Zod | Runtime input validation on all API routes |
| Translations | Custom React Context | 7 languages: EN Β· ES Β· VI Β· TH Β· PT Β· KO Β· FR |
yarn build.3. Completed Milestones
Setup, Auth & Foundation
Days 1β3 Β· 20% of Project
- 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.
Core Business Logic & Deposits
Days 4β7 Β· 40% of Project
- 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.
Withdrawals & Admin Panel
Days 8β11 Β· 25% of Project
- 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.
History, Testing & Delivery
Days 12β14 Β· 15% of Project
- 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
| Field | Type | Description |
|---|---|---|
| String (Unique) | Login email address | |
| referralCode | String (Unique) | Auto-generated code for referral sharing |
| uplineId | ObjectId? | Direct sponsor in the MLM chain |
| role | "user" | "admin" | Access level for the account |
| balance | Float | Spendable wallet balance |
| activeDeposit | Float | Total currently locked in contracts |
| planRate | Float | Daily ROI % of subscribed plan |
| totalEarned | Float | Cumulative lifetime ROI received |
| totalCommission | Float | Cumulative lifetime MLM bonuses |
Settings β Global Platform State
| Field | Default | Live Effect When Changed |
|---|---|---|
| maintenanceMode | false | Blocks all user API access (503). Admins unaffected. |
| newRegistrations | true | OFF closes registration endpoint immediately. |
| referralRate | 15.0% | Applies to all future commission calculations. |
| withdrawalFee | 6.0% | Deducted from all future withdrawal requests. |
| tradingFee | 2.0% | Deducted from plan subscriptions. |
Transaction β Financial Ledger Types
| type | When Created | Key Fields |
|---|---|---|
deposit | On approved blockchain deposit | amount, status, metadata (TX hash, network) |
withdrawal | On withdrawal submission | amount (negative), reference (withdrawal ID) |
daily_roi | On each ROI distribution run | amount, description "Daily arbitrage profit" |
commission | On each unilevel payout | amount, 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.
/dashboardOverview
Six metric cards (Invested, Earned, Commissions, Balance, Active Investments, Referrals), active contracts list, recent transaction feed, and sandbox simulation controls.
Home/dashboard/depositDeposit
Sandbox Instant Credit (immediate) and Manual Blockchain Request (TX hash β pending β admin approval β MLM commissions triggered).
2 Flows/dashboard/arbitrageArbitrage Plans
Browse and subscribe to yield plans. Each card shows daily ROI %, minimum deposit, duration, and Invest Now button.
/dashboard/portfolioPortfolio
All active and completed contracts with start/end dates, deposited amount, earnings to date, progress bar, and status badge.
/dashboard/withdrawWithdraw
Submit withdrawal: amount (min $5), destination wallet, network. Gross/fee/net breakdown shown. Balance locked immediately.
/dashboard/referralsReferrals
Unique referral code and copy-ready URL, direct referrals table with earnings per recruit, paginated commission history.
/dashboard/earningsEarnings History
Chronological log of all ROI payouts and commission credits with type, amount, date, and level depth indicator.
/dashboard/settingsSettings
Update profile, change password, switch theme, select language (7 options), toggle 2FA, notifications, and manage account.
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
| Level | Relationship | Rate |
|---|---|---|
| Level 1 | Direct Sponsor | 8.00% |
| Level 2 | Sponsor's Sponsor | 4.00% |
| Level 3 | 3rd upline | 2.00% |
| Level 4 | 4th upline | 1.00% |
| Level 5 | 5th upline | 1.00% |
| Levels 6β10 | Extended network | 0.50% each |
| Levels 11β16 | Deep network | 0.25% each |
$10,000 Deposit β Worked Example
| Recipient | Level | Earned |
|---|---|---|
| User E | L1 Β· 8% | $800.00 |
| User D | L2 Β· 4% | $400.00 |
| User C | L3 Β· 2% | $200.00 |
| User B | L4 Β· 1% | $100.00 |
| User A | L5 Β· 1% | $100.00 |
- 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
| Rule | Detail |
|---|---|
| Weekday Only | MondayβFriday only. Sat/Sun returns an error. |
| Once Per Day | Checks Settings.lastDailyRun. Duplicate runs return 400. |
| Weekend Bypass | Admins 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 exceededTrigger 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.
/adminAdmin Dashboard
Real-time platform metrics: total users, deposit volume, pending deposits and withdrawals. Snapshot tables with direct action links.
Command Center/admin/depositsDeposit Approvals
Filter by status. View TX hash (copy + block explorer). Approve β credits user + triggers 16-level MLM cascade. Reject β marks failed.
Approval Queue/admin/withdrawalsWithdrawal Approvals
Review queued withdrawal requests. Each row shows user, amount, wallet, network, and fee. Approve to execute, reject to deny.
/admin/usersUser Management
Full member list with balance, active deposit, total earned, status. Toggle activation (Active β Inactive) to lock or restore access.
/admin/analyticsAnalytics
Visual charts tracking registration trends, deposit volume, commission distribution, and withdrawal patterns over time.
/admin/transactionsTransactions
Platform-wide ledger of every financial event. Filter by type (deposit, withdrawal, daily_roi, commission) and date range.
/admin/settingsPlatform Settings
Toggle Maintenance Mode, new registrations, and configure referral rate, trading fee, and withdrawal fee. Changes apply instantly.
Live Controls| Field | Default | Live Effect When Changed |
|---|---|---|
| Maintenance Mode | OFF | Blocks all user APIs with 503. Admins keep full access. |
| Allow New Registrations | ON | OFF rejects all /api/auth/register requests immediately. |
| Withdrawal Fee | 6% | Applied to all future withdrawal requests instantly. |
| Referral Commission Rate | 15% | Applied to all future commission calculations. |
9. Security & Auth
| Security Layer | Implementation |
|---|---|
| Password Hashing | bcrypt with 12 salt rounds β passwords never stored in plain text. |
| Session Management | HttpOnly JWT cookies β inaccessible to JavaScript (XSS-resistant). |
| Input Validation | Zod schemas on all API routes β malformed data rejected before DB access. |
| Role Enforcement | getUserFromRequest() verifies JWT on every protected route; admin routes check role. |
| Anti-Double-Spend | Withdrawal amount deducted from balance at submission time β concurrent duplicates blocked. |
| Maintenance Gate | maintenanceMode 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@123Full Demo in Under 2 Minutes
- 1Run:
node scripts/seed-mlm.js - 2Log in as User F β
userf@test.com/Password@123 - 3Go to /dashboard/deposit β Manual Mode β any amount + mock TX hash β Submit.
- 4Log out. Log in as admin.
- 5Go to /admin/deposits β approve the deposit.
- 6Check User EβA in /admin/users β each received commission.
- 7Click "Run Daily ROI" on /admin (bypass weekends if needed).
- 8Return to /dashboard as User F β daily profit credited.
11. API Reference
Authentication Routes
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/auth/register | Register new account (checks newRegistrations setting) |
| POST | /api/auth/login | Authenticate and receive JWT session cookie |
| GET | /api/auth/me | Return current authenticated user profile |
| POST | /api/auth/verify | Verify email with 6-digit OTP code |
| POST | /api/auth/resend | Resend OTP verification email |
User Routes
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/dashboard/stats | User metrics, investments, recent transactions |
| POST | /api/deposit | Submit deposit (instant sandbox or pending manual) |
| GET/POST | /api/withdrawals | History / submit withdrawal with fee calculation |
| GET | /api/earnings | ROI and commission earnings history |
| GET | /api/plans | All active arbitrage plans |
| GET | /api/referrals | Referral network and commission ledger |
| GET | /api/investments | Investment portfolio |
Admin Routes
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/admin/stats | Platform-wide metrics and pending counts |
| GET/POST | /api/admin/deposits | List / approve / reject manual deposits |
| GET/POST | /api/admin/withdrawals | List / approve / reject withdrawals |
| GET | /api/admin/users | List all registered users |
| GET | /api/admin/transactions | Platform-wide transaction ledger |
| GET/POST | /api/admin/settings | Retrieve / update platform settings |
| POST | /api/admin/run-daily-roi | Trigger daily ROI distribution |
| GET | /api/admin/test-unilevel/:userId/:amount | Test MLM commission for a user |
| GET | /api/admin/downline/:userId | Get 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
| File | Purpose |
|---|---|
| prisma/schema.prisma | All 9 database model definitions |
| server/services/commission.service.ts | 16-level Unilevel MLM engine |
| server/services/earnings.service.ts | Daily ROI distribution engine |
| app/api/deposit/route.ts | Deposit handler (sandbox + manual) |
| app/api/admin/deposits/route.ts | Approval trigger + MLM commission cascade |
| app/api/admin/settings/route.ts | Persistent platform settings API |
| app/api/withdrawals/route.ts | Withdrawal + dynamic fee calculation |
| components/translation-provider.tsx | 7-language translation context |
| scripts/seed-mlm.js | MLM demo chain seeder |
VEXTA
VEXTA CONFIDENTIAL Β· May 2026
All Milestones Verified & Deployed