How abdallahsaadelbasuoiny/cashier works
This repository is an offline-first, multi-branch POS and business-management system. Cashiers create sales at a terminal, which can persist transactions locally and synchronize them to Laravel for idempotent checkout and inventory updates; administrators also manage products and business operations. The README documents offline checkout, device authorization, inventory integrity, and session reconciliation. Several frontend pages and sync components are represented from the tree and README rather than inspected source, so those links are documented or left unverified.
Main entry points: CheckoutService.php Checkout service · SyncController.php Sync API · POSPage.tsx POS screen · sync-engine.js Sync engine
Components 24
POS terminal
- POS screen
frontend/src/pages/POSPage.tsx - Cart logic
backend/resources/js/pos/cart.js
Offline synchronization
- Offline storage
backend/resources/js/offline/db.js - Sync engine
backend/resources/js/sync/sync-engine.js - PWA worker
backend/public/service-worker.js - Sync API
backend/app/Http/Controllers/Api/V1/SyncController.php - Push processing
backend/app/Services/Sync/SyncPushService.php - Pull processing
backend/app/Services/Sync/SyncPullService.php
Sales and inventory
- Sale endpoint
backend/app/Http/Controllers/Api/V1/SaleController.php - Checkout service
backend/app/Services/POS/CheckoutService.php - Inventory ledger
backend/app/Services/Inventory/InventoryLedgerService.php - Sales records
backend/app/Models/Sale.php - Inventory records
backend/app/Models/InventoryBalance.php - Session endpoint
backend/app/Http/Controllers/Api/V1/CashierSessionController.php - Cashier sessions
backend/app/Models/CashierSession.php
Business management
- Product API
backend/app/Http/Controllers/Api/V1/ProductController.php - Product catalog
backend/app/Models/Product.php - Management screens
frontend/src/pages/ProductsPage.tsx - Business operations
frontend/src/pages/CustomersPage.tsx
Identity and devices
- Sign-in state
frontend/src/hooks/useAuth.tsx - Authentication API
backend/app/Http/Controllers/Api/V1/AuthController.php - Device management
backend/app/Http/Controllers/Api/V1/DeviceController.php - Device authorization
backend/app/Http/Middleware/VerifyDeviceAuthorization.php
Other components
- Cashier
Connections 22
- Cashier → POS screen: uses
README.md - POS screen → Cart logic: manages cart
README.md - POS screen → Offline storage: stores transactions
README.md - Sync engine → Offline storage: reads queued work
README.md - Sync engine → Sync API: pushes batches
README.md - PWA worker → Sync engine: supports reconnect
- Sync API → Push processing: dispatches push
backend/app/Http/Controllers/Api/V1/SyncController.php - Sync API → Pull processing: dispatches pull
backend/app/Http/Controllers/Api/V1/SyncController.php - Push processing → Checkout service: processes sales
backend/app/Services/Sync/SyncPushService.php - Sale endpoint → Checkout service: calls checkout
backend/app/Http/Controllers/Api/V1/SaleController.php - Checkout service → Inventory ledger: records movement
backend/app/Services/POS/CheckoutService.php - Checkout service → Sales records: creates sale
backend/app/Services/POS/CheckoutService.php - Inventory ledger → Inventory records: updates balance
backend/app/Services/Inventory/InventoryLedgerService.php - Checkout service → Cashier sessions: checks session
backend/app/Services/POS/CheckoutService.php - Session endpoint → Cashier sessions: opens and closes
backend/app/Http/Controllers/Api/V1/CashierSessionController.php - Session endpoint → Sales records: reconciles sales
backend/app/Http/Controllers/Api/V1/CashierSessionController.php - Product API → Product catalog: manages products
backend/app/Http/Controllers/Api/V1/ProductController.php - Management screens → Product API: manages catalog
- Business operations → Product API: uses management API
- Sign-in state → Authentication API: authenticates
frontend/src/hooks/useAuth.tsx - Device management → Device authorization: device security
backend/routes/api.php - Sync API → Device authorization: is protected by
backend/routes/api.php