Skip to content

Back Office (Merchant Management)

1. Document Control

PropertyValue
Package@nx-app/bo
Version0.0.0
TypeWeb Application (SPA)
RuntimeBrowser / Bun (dev)
DeploymentDocker / Nginx

2. Scope & Objectives

2.1. Scope

The Back Office (bo) is the merchant management interface for the BANA platform. It provides business owners, operators, and system administrators with tools to manage merchants, products, categories, inventory, invoices, finances, and employee operations through a web browser.

2.2. Objectives

  • Merchant Management: Full lifecycle management of merchants, organizers, and vendor relationships.
  • Comprehensive Operations: Products, categories, inventory, purchase orders, sale orders, invoices, and finance management.
  • Role-Based Access: Permission-controlled screens for different user roles.
  • Data Visualization: Reports for revenue, orders, and product performance.
  • Responsive Design: Desktop, tablet, and mobile browser support.

3. Technology Stack

3.1. Core Framework

TechnologyVersionPurpose
React^19.2.1UI Component Library
React DOM^19.2.1DOM Rendering
React Router^7.9.4Client-side Routing
TypeScript~5.9.3Type Safety
Vite^7.1.7Build Tool & Dev Server

3.2. State Management

TechnologyVersionPurpose
Redux Toolkit^2.9.1Global State Management
React Redux^9.2.0React-Redux Bindings
TanStack Query^5.90.5Server State & Caching
TanStack Table^8.21.3Data Table Management
ra-core^5.13.2Admin Framework Core

3.3. UI Components

TechnologyVersionPurpose
@nx-app/admin-ui-kitworkspace:*Shared UI Component Library
Radix UI^1.4.3Accessible Primitives
Tailwind CSS^4.1.16Utility-first Styling
Lucide React^0.552.0Icon Library
next-themes^0.4.6Theme Switching

3.4. Forms & Validation

TechnologyVersionPurpose
React Hook Form^7.66.0Form State Management
@hookform/resolvers^5.2.2Schema Validation Bridge
react-phone-number-input^3.4.14Phone Input
react-number-format^5.4.4Numeric Formatting
react-day-picker^9.13.2Date Picker

3.5. Utilities

TechnologyVersionPurpose
@dnd-kitVariousDrag-and-Drop (sortable)
xlsx^0.18.5Excel Import/Export
papaparse^5.5.3CSV Parsing
compressorjs^1.2.1Image Compression
dayjs^1.11.18Date Formatting
sonner^2.0.7Toast Notifications

4. Architecture

4.1. Application Bootstrap

The BO app extends AdminUiKitApplication via RaApplication:

typescript
class RaApplication extends AdminUiKitApplication {
  // Initializes 18+ API services:
  // Auth, Merchant, Product, Category, User, Employee,
  // SaleChannel, SaleOrder, Invoice, Inventory, Finance,
  // Payment, Transaction, Role, Device, Report, etc.
}

ApplicationContext wraps the app with:

  • CoreApplicationContext — Admin framework context
  • Redux Provider — Global state
  • ThemeProvider — Dark/light mode
  • TooltipProvider — Global tooltips

4.2. Configuration

ConfigSourceDefault
API Base URLVITE_BASE_URLhttp://localhost:3000/api
OAuth URLVITE_NX_OAUTH_BASE_URL
App Namepackage.json@nx-app/bo

4.3. Data Layer

  • DefaultRestDataProvider for all API communication
  • DefaultAuthService for JWT authentication
  • TanStack Query for server state caching and invalidation
  • Redux for UI state (sidebar, filters, preferences)

5. Screen Modules

The BO app contains 29 screen modules, each providing list/create/read/update/delete views:

5.1. Core Business

ModulePathDescription
merchant/merchantsMerchant profile management
organizer/organizersOrganizer (parent entity) management
vendor/vendorsSupplier/vendor management
settings/settingsApp-wide settings

5.2. Catalog

ModulePathDescription
product/productsProduct CRUD and catalog
category/categoriesCategory hierarchy
category-template/category-templatesReusable category templates
sale-channel/sale-channelsMulti-channel configuration

5.3. Sales & Orders

ModulePathDescription
sale-order/sale-ordersSale order management
purchase-order/purchase-ordersPurchase order lifecycle
invoice/invoicesInvoice generation and tracking
transaction/transactionsPayment transaction records

5.4. Inventory & Stock

ModulePathDescription
inventory/inventoryInventory management
inventory-tracking/inventory-trackingStock movement tracking
importation/importationsStock import operations

5.5. Finance

ModulePathDescription
finance/financeFinancial transactions, categories, wallets

5.6. People

ModulePathDescription
customer/customersCustomer database
user/usersUser accounts
user-employee/employeesEmployee management
role/rolesRole & permission management

5.7. Hardware & Reports

ModulePathDescription
terminal/terminalsPOS terminal management
devices/devicesDevice registration
report/reportsRevenue, order, and product reports

5.8. Authentication

ModulePathDescription
sign-in/sign-inLogin screen
sign-up/sign-upRegistration screen
home/Dashboard home

6. Layout System

6.1. Main Layout

Authenticated layout with collapsible sidebar navigation (29 menu items), header with user profile, and content area.

6.2. Form Layout

BaseFormLayout provides standardized form pages with:

  • Filter bar — TextField, Status dropdown filters
  • Action buttons — Save, Cancel, custom actions
  • RouteContextProvider — Screen-level routing context

6.3. No-Auth Layout

Minimal layout for sign-in/sign-up screens without sidebar navigation.

7. Custom Hooks

7.1. API Hooks

HookPurpose
useGetDataFetch data with TanStack Query
useInfiniteGetDataInfinite scroll data fetching
useMutationDataCreate/Update/Delete mutations
useRefreshForce data refresh
useVirtualAutocompleteVirtualized autocomplete (single)
useVirtualAutocompleteArrayVirtualized autocomplete (multi)

7.2. State Hooks

HookPurpose
useAppDispatchTyped Redux dispatch
useAppSelectorTyped Redux selector
useUserPreferencesUser settings persistence
useUserProfileCurrent user profile data
useLogoutLogout flow
useWarnUnsavedChangesUnsaved changes warning

7.3. Table Hooks

HookPurpose
useDataTableControllerTable state + data fetching
useDataTableStateTable column/filter state
useBaseTableAutosaveAuto-save inline edits

8. Build & Deployment

8.1. Vite Configuration

  • Code splitting: Manual chunk for infra bundle
  • Chunk size warning: 600KB limit
  • PWA: Auto-update strategy, no manifest
  • Dev server: Port 3000, strict port, HMR enabled

8.2. Docker Build

Multi-stage build:

dockerfile
# Stage 1: Dependencies (bun:1-alpine)
# Stage 2: Build (bun run build:production)
# Stage 3: Production (nginx:1.27-alpine)

8.3. Nginx Configuration

FeatureSetting
CompressionGzip enabled (text, JS, CSS, JSON, SVG)
Security HeadersX-Frame-Options, X-Content-Type-Options, X-XSS-Protection
Asset Caching1 year (immutable)
Service Worker1 hour cache
SPA RoutingCatch-all redirect to index.html
Hidden FilesDenied (except .well-known)

8.4. Scripts

ScriptCommandPurpose
devvite --mode devDevelopment server
buildsh ./scripts/build.shProduction build
build:developsh ./scripts/rebuild.sh developmentDevelopment build
build:productionsh ./scripts/rebuild.sh productionProduction build
previewvite preview --port 4173Preview production build
lintsh ./scripts/lint.shESLint + Prettier

9. Differences from Client App

AspectClient (@nx-app/client)BO (@nx-app/bo)
PurposeAdmin dashboard (all platform management)Merchant-focused management
ScopeFull platform administrationMerchant operations
Modules29 screens29 screens (merchant-oriented)
Additional ToolsExcel import/export, CSV parsing, image compression, drag-and-drop

Proprietary and Confidential. Unauthorized copying, distribution, or use of this software is strictly prohibited.