Skip to content

Client Ecosystem Overview

1. Document Control

PropertyValue
StatusActive
Version1.0.0
Last Updated2025-01-20
MaintainerFrontend Team

2. Scope & Objectives

2.1. Scope

The Client Ecosystem encompasses all user-facing applications in the BANA solution, including the Point-of-Sale (POS) terminal, the Back Office management dashboard, and the shared libraries that support them.

2.2. Strategic Objectives

ObjectiveDescriptionMetric
ConsistencyMaintain unified UX/UI across platforms using shared design systemSingle component library
PerformanceSub-100ms response times for critical POS interactionsCart operations < 100ms
MaintainabilityMaximize code reuse via shared core libraries80%+ shared utilities
Offline ResilienceCore POS functionality without internet (Local-First)100% offline cart operations

3. Application Portfolio

3.1. Applications Overview

📱
Applications
User-facing deliverables
🌐
client
Back Office Web App
🖥️
sale-main
Tauri Backend (Rust)
🎨
sale-renderer
POS UI (React)
▼ Imports
📦
Shared Libraries
Internal packages
🧩
admin-ui-kit
36 UI Components
🔧
core
Utilities & Locales

3.2. Application Details

ApplicationPackageTypeFilesPortPrimary User
Back Office@nx-app/clientWeb SPA637 TS/TSX3001Managers / Owners
POS Terminal@nx-app/sale-mainDesktop (Rust)46 RustN/ACashiers
POS UI@nx-app/sale-rendererWeb SPA (Tauri)337 TS/TSX3002Cashiers
UI Kit@nx-app/admin-ui-kitLibrary44 TS/TSXN/ADevelopers
Core@nx-app/coreLibrary11 TSN/ADevelopers

3.3. Deliverables

ApplicationDeploymentArtifact
Back OfficeDocker / NginxStatic bundle (dist/)
POS TerminalNative Installer.msi (Win), .dmg (Mac), .deb (Linux)
POS UIEmbedded in TauriStatic bundle (WebView)

4. Technology Stack

4.1. Core Technologies

LayerTechnologyVersionPurpose
RuntimeBun1.3.2+JavaScript/TypeScript runtime
FrameworkReact19.2.xUI framework
Build ToolVite7.xDevelopment & bundling
StylingTailwind CSS4.1.xUtility-first CSS
DesktopTauri2.9.1Native desktop framework
Backend (Tauri)RustStablePOS native layer

4.2. State Management

ScopeLibraryVersionUse Case
Server StateTanStack Query5.90.5API data fetching & caching
Global UI StateRedux Toolkit2.9.xCart, user preferences, navigation
Form StateReact Hook Form7.66.0Form validation with Zod
Admin Frameworkreact-admin5.13.xCRUD operations, data provider

4.3. UI Components

LibraryVersionPurpose
Radix UILatestAccessible primitives
shadcn/uiLatestPre-built components
Lucide Icons0.562.0Icon library
TanStack Table8.21.3Data tables
TanStack VirtualLatestVirtualized lists
Recharts2.15.4Charts (sale-renderer)

4.4. Tauri-Specific (sale-main)

LibraryPurpose
sea-ormSQLite ORM
reqwestHTTP client
tokioAsync runtime
serdeJSON serialization
tracingStructured logging

5. Folder Structure

5.1. Common Application Structure

apps/{app-name}/
├── src/
│   ├── application/          # DI container, providers, API services
│   ├── components/           # React components
│   │   ├── core/             # Custom components
│   │   └── shadcn/           # shadcn UI components
│   ├── constants/            # Routes, endpoints, configurations
│   ├── helpers/              # Utility functions
│   ├── hooks/                # Custom React hooks
│   ├── interfaces/           # TypeScript interfaces
│   ├── layout/               # Layout components
│   ├── libs/                 # Library configurations
│   ├── redux/                # State management
│   ├── screens/              # Page components
│   ├── App.tsx               # Root component
│   ├── main.tsx              # Entry point
│   └── index.css             # Global styles
├── public/                   # Static assets
├── index.html                # HTML entry
├── package.json
├── tsconfig.json
├── vite.config.ts
└── tailwind.config.ts

5.2. Application-Specific Structure

Back Office (client)

src/
├── screens/                  # 23 screen modules
│   ├── product/              # Product management
│   ├── category/             # Category management
│   ├── merchant/             # Merchant management
│   ├── organizer/            # Organization management
│   ├── customer/             # Customer management
│   ├── user/                 # User management
│   ├── employee/             # Employee management
│   ├── role/                 # Role management
│   ├── device/               # Device management
│   ├── sale-channel/         # Sales channel config
│   ├── terminal/             # Terminal management
│   ├── order/                # Order management
│   ├── invoice/              # Invoice management
│   ├── transaction/          # Transaction history
│   ├── report/               # Reporting dashboards
│   │   ├── revenue/
│   │   └── orders/
│   ├── settings/             # System settings
│   ├── sign-in/
│   ├── sign-up/
│   └── home/                 # Dashboard
├── application/
│   └── services/             # 20+ API services
└── redux/
    └── slices/               # 5 Redux slices
        ├── route/
        ├── temporary/
        ├── common/
        ├── product/
        └── listView/

POS UI (sale-renderer)

src/
├── screens/                  # 8 screen modules
│   ├── sale/                 # Main POS screen
│   ├── home/                 # Dashboard
│   ├── settings/             # Settings
│   ├── customer/             # Customer display
│   ├── errors/               # Error pages
│   ├── sign-in/
│   └── term-of-use/
├── hooks/
│   └── screens/
│       └── sale/             # Sale-specific hooks
│           ├── useCart.ts
│           ├── useProductVariant.ts
│           └── usePayment.ts
├── socket/                   # WebSocket integration
│   ├── connection-manager.ts
│   └── subscription-manager.ts
└── redux/
    └── slices/               # 8 Redux slices
        ├── cart/             # Shopping cart
        ├── order/            # Order state
        ├── payment/          # Payment processing
        ├── product/          # Product catalog
        ├── sale/             # Sale operations
        ├── userProfile/
        ├── common/
        └── temporary/

Tauri Backend (sale-main)

src-tauri/
├── src/
│   ├── application/          # App initialization
│   │   ├── application.rs
│   │   ├── context.rs
│   │   └── logger.rs
│   ├── pubs/                 # IPC commands (17 modules)
│   │   ├── login_pub.rs
│   │   ├── user_pub.rs
│   │   ├── merchant_pub.rs
│   │   ├── product_pub.rs
│   │   ├── category_pub.rs
│   │   ├── cart_pub.rs
│   │   ├── order_pub.rs
│   │   ├── payment_pub.rs
│   │   ├── payment_attempt.rs
│   │   ├── asset_pub.rs
│   │   ├── role_pub.rs
│   │   ├── permission_pub.rs
│   │   ├── sale_channel_pub.rs
│   │   ├── organizer_pub.rs
│   │   └── product_variant_pub.rs
│   ├── services/             # Business logic (12 modules)
│   │   ├── auth_service.rs
│   │   ├── user_service.rs
│   │   ├── cart_service.rs
│   │   ├── cart_item_service.rs
│   │   ├── order_service.rs
│   │   ├── payment_service.rs
│   │   ├── api_network_service.rs
│   │   └── base_service.rs
│   ├── datasource/           # SQLite database
│   ├── entities/             # Database schemas
│   ├── helpers/              # Utilities
│   ├── main.rs
│   └── lib.rs
├── migration/                # DB migrations
├── capabilities/             # Tauri permissions
└── tauri.conf.json           # Tauri config

6. API Services

6.1. Back Office Services (20+)

ServicePurposeKey Methods
AuthApiAuthenticationsignIn, signOut, refresh
OAuth2ApiOAuth integrationauthorize, callback
UserApiUser managementCRUD, profile
EmployeeApiEmployee managementCRUD, assign roles
RoleApiRole managementCRUD, permissions
ProductApiProduct catalogCRUD, aggregate
CategoryApiCategoriesCRUD, tree
VariantApiProduct variantsCRUD
MerchantApiMerchantsCRUD
OrganizerApiOrganizationsCRUD
OrderApiOrdersCRUD, status
InvoiceApiInvoicesCRUD, generate
TransactionApiTransactionslist, details
DeviceApiDevicesCRUD, activate
SaleChannelApiSales channelsCRUD, assign
BucketApiFile storageupload, download
MetaLinkApiMetadata linksCRUD
UserConfigurationApiUser settingsCRUD
StaticAssetsApiStatic filesserve
ReportApiReportsrevenue, orders

6.2. POS Services (15)

ServicePurpose
AuthApiAuthentication
UserApiUser profile
AssetApiFile access
MerchantApiMerchant data
OrganizerApiOrganization data
SaleChannelApiSales channels
CategoryApiCategories
ProductApiProduct catalog
ProductVariantApiVariants
CartApiCart management
CartItemApiCart items
OrderApiOrder creation
PaymentApiPayment processing
PaymentAttemptApiPayment attempts

7. State Management

7.1. Redux Slices

Back Office

SliceStateActions
routeCurrent route, historynavigate, goBack
temporaryModals, loading statessetModal, setLoading
commonGlobal app statesetLanguage, setTheme
productProduct editing statesetProduct, clearProduct
listViewTable configurationssetFilters, setSort

POS

SliceStateActions
cartCart items, totalsaddItem, removeItem, clearCart
orderCurrent ordercreateOrder, updateStatus
paymentPayment stateinitiatePayment, confirmPayment
productProduct catalogloadProducts, searchProducts
saleSale sessionopenSession, closeSession
userProfileCurrent usersetUser, clearUser
commonGlobal statesetMerchant, setSaleChannel
temporaryUI statesetLoading, setModal

7.2. State Flow

8. Routing Configuration

8.1. Back Office Routes

PathScreenAuth Required
/Home (Dashboard)Yes
/product/*Product managementYes
/category/*Category managementYes
/merchant/*Merchant managementYes
/organizer/*Organization managementYes
/customer/*Customer managementYes
/user/*User managementYes
/employee/*Employee managementYes
/role/*Role managementYes
/device/*Device managementYes
/order/*Order managementYes
/invoice/*Invoice managementYes
/transaction/*Transaction historyYes
/report/*ReportsYes
/settings/*SettingsYes
/sign-inLoginNo
/sign-upRegistrationNo

8.2. POS Routes

PathScreenAuth Required
/saleMain POSYes
/settingsGeneral settingsYes
/account-settingAccount settingsYes
/store-settingStore settingsYes
/customerCustomer displayNo
/term-of-useTerms of useNo
/error/*Error pagesNo

9. Real-Time Communication

9.1. WebSocket (POS)

🔌
Socket.IO Integration
Real-time event handling
📡SocketConnectionManagerConnection lifecycle
📬SocketSubscriptionManagerEvent subscriptions
📦OrderSocketServiceOrder event handling

9.2. Event Types

EventSourceDescription
order:createdServerNew order created
order:updatedServerOrder status changed
payment:confirmedPayment GatewayPayment successful
payment:failedPayment GatewayPayment failed

10. Tauri IPC Communication

10.1. Command Pattern

10.2. IPC Commands (17 modules)

ModuleCommands
login_pubsign_in, sign_out, verify_token
user_pubget_user, update_user
merchant_publist_merchants, get_merchant
product_publist_products, get_product, search
category_publist_categories, get_tree
cart_pubget_cart, create_cart, clear_cart
order_pubcreate_order, get_order, list_orders
payment_pubinitiate_payment, confirm_payment
asset_pubupload_file, get_file

10.3. Data Persistence

StoreTechnologyPurpose
Local DBSQLite + SeaORMOffline data
CacheIn-memorySession data
KeychainOS Secure StorageAuth tokens

11. Build & Deployment

11.1. Build Configuration

AppBuild ToolOutputCommand
clientVite 7dist/bun run build
sale-rendererVite 7dist/bun run build
sale-mainCargo/TauriNative binarybun run tauri build
admin-ui-kittscdist/bun run build

11.2. Vite Optimizations

typescript
// Common Vite configuration
{
  build: {
    minify: 'terser',
    rollupOptions: {
      output: {
        manualChunks: {
          react: ['react', 'react-dom'],
          admin: ['react-admin', 'ra-core'],
          infra: ['@minimaltech/ra-core-infra'],
          lodash: ['lodash'],
        }
      }
    }
  }
}

11.3. Deployment Topology

12. Code Quality

12.1. Linting & Formatting

ToolConfigPurpose
ESLintStrict React rulesCode quality
PrettierPre-commit hooksCode formatting
TypeScriptStrict modeType safety

12.2. Type Safety Requirements

  • TypeScript "strict" mode enabled
  • No explicit any types allowed
  • All API responses typed with Zod schemas
  • Generated types for API contracts

13. Next Steps

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