Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.laportenard.com/llms.txt

Use this file to discover all available pages before exploring further.

Development workflow

Start the dev server and make changes — Next.js hot-reloads automatically:
cd nu_pos_react
npm run dev
For desktop testing, use the Tauri dev window:
npm run desktop:dev

State management

The frontend uses a layered state architecture:
LayerTechnologyPurpose
Global app stateXState machinesSession lifecycle, sync status, UI mode
Order/table stateReact reducer (usePOS)Active orders, table assignments
PersistenceDexie (IndexedDB)Offline-first data storage
Server stateAPI client (odooApi.ts)Bootstrap, order sync, payments

XState machines

  • sessionMachine — Login → active session → logout lifecycle
  • orderMachine — Order state transitions (idle → editing → checkout → paid → finalized)
  • syncMachine — Transport connectivity (online/offline/reconnecting/hubOffline)
  • uiMachine — UI mode management

POS reducer

The central usePOS reducer manages orders and tables. When adding fields to action payloads, update all three places:
  1. The POSAction type union
  2. The POSContextValue interface
  3. The useCallback wrapper
Missing any of these causes silent type errors or runtime bugs.

Domain layer

Business logic lives in src/domain/ as pure functions and types, separate from React. Each domain module exports:
  • Models — TypeScript types and interfaces
  • Computations — Pure functions for calculations (totals, taxes, validation)
  • Parsers — Functions to transform API responses into domain models

UI components

The shared component library in src/ui/ is built on Radix UI primitives with Tailwind v4 styling.

Internationalization

Translations use next-intl with locale files at src/i18n/locales/{en,es}.json. Wrap user-facing strings with the t() function and add entries to both locale files.