Vexlora Admin Panel is the core platform operations, governance, and marketplace management system for the Vexlora multi-vendor e-commerce platform. Built on Next.js App Router, React 19, TypeScript, and Tailwind CSS v4, this application gives platform administrators and super administrators control over merchant onboarding and KYC approvals, catalog moderation, platform-wide orders, deals curation, fraud risk detection, vendor payout settlements, and enterprise RBAC permissions.
flowchart TD
subgraph AdminClient ["Admin Browser / Client Layer"]
AdminUI[Admin Dashboard UI]
AdminGuard[Next.js Middleware Token & Route Guard]
AdminStore[Zustand Admin Store: SuperAdmin & RBAC Matrix]
QueryCache[TanStack Query Server-State Cache]
end
subgraph GovernanceModules ["Marketplace Governance Modules"]
VendorKYC[Vendor Onboarding & KYC Document Verification]
ProductMod[Catalog Moderation & Category Hierarchy]
DealsCampaigns[Today's Hot Deals & Flash Sales Approval]
OrderDisputes[Platform Orders & Multi-Vendor Fulfillment]
FraudRisk[Buyer & Seller Fraud Risk Monitoring]
PayoutSettlement[Merchant Payout Approval & Bank Transfers]
RBACSettings[Granular Staff Roles & Platform Settings]
end
subgraph SecureGateway ["Secure Transport & Interceptor Layer"]
AxiosClient[Axios Client with Dynamic Bearer Headers]
AdminCookie[Strict Cookie: vexlora_admin_token]
end
subgraph PlatformBackend ["Vexlora Marketplace API (Port 5000)"]
AdminAnalyticsAPI[Platform Analytics & KPI API]
AdminVendorsAPI[Vendor Governance & KYC API]
AdminCatalogAPI[Product Moderation & Taxonomy API]
AdminFraudAPI[Fraud Detection & Risk Scoring API]
AdminPayoutAPI[Financial Settlement & Payout API]
AdminRBACAPI[RBAC Roles & Permission Scopes API]
end
AdminUI --> AdminGuard
AdminGuard --> GovernanceModules
GovernanceModules --> AdminStore & QueryCache
AdminStore & QueryCache --> AxiosClient
AxiosClient --> AdminCookie
AdminCookie --> AdminAnalyticsAPI & AdminVendorsAPI & AdminCatalogAPI & AdminFraudAPI & AdminPayoutAPI & AdminRBACAPI
- Gross Marketplace Value (GMV): Real-time tracking of platform-wide sales volume, collected platform commissions, total orders, and active merchant counts.
- Order Status Breakdown: Visual distribution of order volumes across lifecycle stages (
PENDING,PROCESSING,SHIPPED,DELIVERED,CANCELLED). - Recent System Activity: Live log of new vendor applications, large-value orders, and critical platform alerts.
- Vendor Application Review Queue: Review incoming seller registrations with store details, business contact, and bank settlement accounts.
- KYC Document Verification: In-app preview and audit of merchant legal documentation (trade licenses, tax certificates/TIN, business registration).
- Approval & Rejection Lifecycle: Single-click approval granting instant vendor portal access, or rejection with structured feedback notes.
- Merchant Lifecycle Management: Suspend, reactivate, or audit existing vendor accounts.
- Global Product Catalog: Filterable platform product inventory with multi-vendor attribution, category sorting, and price/stock filters.
- Moderation Pipeline: Review pending vendor product submissions, approve compliant listings, or reject substandard products.
- Category & Taxonomy Builder (
/categories): Create and manage hierarchical categories and subcategories with custom slugs, SVG iconography, and display sort orders.
- "Today's Hot Deals" Curation (
/deals): Review vendor flash sale proposals, verify discount thresholds, and publish curated deals to the customer website homepage. - Global Platform Coupons (
/coupons): Create and administer sitewide promotional vouchers with discount caps, minimum cart thresholds, start/expiration dates, and usage limits.
- Global Order Stream: Comprehensive ledger of all marketplace transactions across all registered vendors.
- Multi-Vendor Breakdown: Inspect multi-store split shipments within single customer orders with direct tracking and status inspection.
- User Directory: Searchable list of registered customers, sellers, and administrators with registration dates, verified statuses, and roles.
- Account Enforcement: Update user account statuses (
ACTIVE,SUSPENDED,BANNED) to protect platform integrity.
- Buyer & Seller Fraud Risk Profiles: Track suspicious buyer accounts, excessive refund velocity, and high-risk sellers.
- Risk Score Assessment: Dynamic risk scoring visualizing dispute rates, suspicious IP/session trends, and chargeback signals.
- Audit Actions: Manual risk profile overrides, blacklisting, and account lockouts.
- Withdrawal Request Queue: Review merchant withdrawal requests against available account balances and bank records.
- Settlement Execution: Approve payouts with banking reference numbers, or reject requests with audit feedback.
- Disbursement History: Complete transaction log of all historical platform disbursements.
- Role Hierarchy: Strict separation between
SUPER_ADMIN,ADMIN, and custom staff roles. - Granular Permission Matrix: Create custom roles with tailored permission strings (e.g.,
vendors:approve,products:moderate,payouts:process,fraud:audit).
- Marketplace Commission Configuration: Adjust baseline commission rates across platform categories.
- Platform Security: Configure session expiry thresholds and global operational parameters.
[ Step 1: Merchant Applies ]
Prospective vendor registers via `/vendor-apply` and submits KYC legal documents.
β
[ Step 2: Admin Queue Inspection ]
Admin navigates to `/vendors` β Filter by status: `PENDING`.
β
[ Step 3: KYC & Document Review ]
Admin inspects trade license, tax ID documents, bank details, and store branding.
β
[ Step 4: Decision Execution ]
βββ [ Approve ]: Status updated to `APPROVED` β Merchant receives dashboard access.
βββ [ Reject ]: Status updated to `REJECTED` with administrative reason logged.
β
[ Step 5: Ongoing Governance ]
Monitor merchant fraud scores, handle customer escalations, or suspend on policy violations.
[ Admin Navigation ]
β
Next.js Middleware Interceptor
Cookie: `vexlora_admin_token` present?
βββ No βββ> Redirect to `/login`
βββ Yes ββ> Allow Route Access
β
Zustand Store Check
Fetch `/users/me`
β
Role in ['ADMIN', 'SUPER_ADMIN']?
βββ No βββ> Purge Tokens & Cookies
β Display "Access Denied"
βββ Yes ββ> Hydrate Profile & Permissions
β
Evaluate Resource Permission
`hasPermission('vendors:approve')`
βββ Denied ββ> Disable Action / Hide Button
βββ Granted β> Allow Operation
- Token Isolation: Uses
vexlora_admin_tokencookie and local storage key, completely isolated from customer and merchant tokens. - Strict Admin Role Verification: Any non-admin token is immediately rejected and purged from browser storage.
- Super Admin Wildcards: Users with the
SUPER_ADMINrole or*permission bypass individual capability checks.
- Domain hooks (
useAdminVendors,useAdminProducts,useAdminOrders,useAdminPayouts,useAdminFraud) manage background data fetching, window refetching, and targeted query invalidation.
- Standardized table layouts with dynamic column sorting, pagination controls, facet filters, and row action modals.
- Integrated Sonner toast feedback for all administrative actions (vendor approval, product moderation, role assignment, payout settlement).
- Built-in skeleton screens and error boundaries prevent layout shifts during network fetches.
| Feature / Flow | Test Scenario | Expected Result | Status |
|---|---|---|---|
| Admin Login | Login with valid administrator credentials | vexlora_admin_token stored, store hydrated, redirects to / |
Verified (Manual E2E) |
| Role Restriction | Login with Customer or Vendor account | Denied with "Access denied. Admin role required" error | Verified (Manual E2E) |
| Unauthenticated Route Guard | Direct browser access to /vendors without token |
Next.js Middleware intercepts; redirects immediately to /login |
Verified (Manual E2E) |
| Vendor KYC Approval | Admin reviews pending vendor and clicks "Approve" | Status updates to APPROVED; vendor unlocked in platform |
Verified (Manual E2E) |
| Vendor Rejection | Admin rejects application with reason note | Status updates to REJECTED; reason recorded in audit log |
Verified (Manual E2E) |
| Product Moderation | Admin approves pending product submission | Product status set to ACTIVE; appears on customer website |
Verified (Manual E2E) |
| Category Creation | Create parent category with slug and icon | Category saved and reflects in platform taxonomy tree | Verified (Manual E2E) |
| Deal Curation | Admin approves vendor deal for "Hot Deals" | Deal published to public deals carousel on customer website | Verified (Manual E2E) |
| Coupon Generation | Create platform-wide voucher with min spend | Voucher created and available for customer checkout | Verified (Manual E2E) |
| Payout Approval | Approve pending vendor withdrawal request | Payout marked PROCESSED; transaction reference recorded |
Verified (Manual E2E) |
| Fraud Risk Override | Flag suspicious seller profile in /fraud |
Risk level updated; vendor flagged for enhanced monitoring | Verified (Manual E2E) |
| RBAC Permission Gate | Admin without payouts:approve opens payouts |
Action buttons disabled or hidden based on hasPermission |
Verified (Manual E2E) |
| Admin Logout | Click logout from user profile dropdown | Purges cookies and localStorage; redirects to /login |
Verified (Manual E2E) |
| TypeScript Integrity | Run pnpm typecheck |
0 diagnostic compiler errors across all admin pages | Verified (Automated) |
| ESLint Compliance | Run pnpm lint |
0 linter violations across all TSX components | Verified (Automated) |
| Technology | Purpose | Implementation Path |
|---|---|---|
| Next.js 16.3.5 | App Router, Server Middleware & Port 3002 Routing | src/app/, src/middleware.ts |
| React 19.2.8 | Component Architecture & Server Components | Core dependency |
| TypeScript 5.x | Static Type Safety & Shared Types | src/types/ |
| Tailwind CSS v4 | Clean Governance Dashboard Styling | src/app/globals.css |
| TanStack Query v5 | Server-State Caching, Polling & Invalidation | src/hooks/ |
| Zustand v5 | Admin Session & RBAC Permissions Store | src/stores/useAdminStore.ts |
| React Hook Form | Form State Management | Settings & Category forms |
| Zod v4 | Runtime Schema Validation | Form validation schemas |
| Axios | HTTP Client with Dynamic Authorization Headers | src/lib/api-client.ts |
| Lucide React | Dashboard & Governance Iconography | Shared across navigation & tables |
| Sonner | Interactive Notification Toasts | Root layout provider |
vexlora-admin/
βββ src/
β βββ app/
β β βββ (auth)/ # Admin authentication routes
β β β βββ login/ # Administrator sign-in
β β βββ (dashboard)/ # Protected governance dashboard routes
β β β βββ categories/ # Category & taxonomy hierarchy management
β β β βββ coupons/ # Platform-wide promotional coupon campaigns
β β β βββ deals/ # Deals curation & Flash Sale approvals
β β β βββ fraud/ # Buyer & seller fraud risk monitoring
β β β βββ notifications/ # Platform alert notifications
β β β βββ orders/ # Platform-wide order oversight
β β β βββ payouts/ # Vendor payout request settlement
β β β βββ products/ # Catalog moderation & product status
β β β βββ profile/ # Administrator profile management
β β β βββ roles/ # Enterprise RBAC role & permission manager
β β β βββ settings/ # Platform commission & security settings
β β β βββ users/ # Customer & user account management
β β β βββ vendors/ # Vendor application KYC review & approvals
β β β βββ layout.tsx # Dashboard layout shell with sidebar & header
β β β βββ page.tsx # Executive GMV & platform analytics overview
β β βββ layout.tsx # Root layout & TanStack Query provider
β β βββ globals.css # Governance theme styling tokens
β βββ components/ # Reusable data tables, modals, badges, inputs
β βββ hooks/ # Domain hooks (useAdminVendors, useAdminFraud, useAdminPayouts)
β βββ lib/ # API client & shared utilities
β βββ middleware.ts # Next.js route guard for admin token
β βββ stores/ # Zustand admin state (useAdminStore)
β βββ types/ # TypeScript definitions (auth, vendors, fraud, orders)
βββ package.json
βββ tsconfig.json
- KYC Document Verification Pipeline: Built an administrative audit interface allowing document inspection (trade licenses, tax certificates, bank info) before granting seller access.
- Dynamic Fraud & Risk Dashboard: Visualized buyer and seller risk scoring, dispute frequencies, and abnormal transaction behaviors with one-click administrative lockouts.
- Hierarchical RBAC Permission Matrix: Granular authorization engine allowing Super Admins to define custom staff roles with fine-grained functional scopes (e.g.
vendors:approve,payouts:process). - Platform Deal Curation Engine: Workflow for moderating vendor-submitted discount campaigns and promoting them directly to the public marketplace homepage.
- Strict Multi-Tenant Session Isolation: Independent cookie and storage token management preventing cross-tenant privilege escalation across the marketplace ecosystem.
- Node.js:
v20.xor higher - pnpm:
v10.xor higher - Backend API: Running instance of
e-commerce-backendon port5000
pnpm installCreate a .env.local file in the root directory:
NEXT_PUBLIC_API_URL=http://localhost:5000/api/v1
NEXT_PUBLIC_AUTH_URL=http://localhost:5000/api/v1/authpnpm devThe Admin Panel runs on http://localhost:3002.
# Typecheck
pnpm typecheck
# Lint
pnpm lint
# Production Build
pnpm build