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:State management
The frontend uses a layered state architecture:| Layer | Technology | Purpose |
|---|---|---|
| Global app state | XState machines | Session lifecycle, sync status, UI mode |
| Order/table state | React reducer (usePOS) | Active orders, table assignments |
| Persistence | Dexie (IndexedDB) | Offline-first data storage |
| Server state | API client (odooApi.ts) | Bootstrap, order sync, payments |
XState machines
sessionMachine— Login → active session → logout lifecycleorderMachine— Order state transitions (idle → editing → checkout → paid → finalized)syncMachine— Transport connectivity (online/offline/reconnecting/hubOffline)uiMachine— UI mode management
POS reducer
The centralusePOS reducer manages orders and tables. When adding fields to action payloads, update all three places:
- The
POSActiontype union - The
POSContextValueinterface - The
useCallbackwrapper
Domain layer
Business logic lives insrc/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 insrc/ui/ is built on Radix UI primitives with Tailwind v4 styling.
Internationalization
Translations usenext-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.