How phakin-smt/tiramisu-pos works
Promttak-POS is a multi-store point-of-sale system: staff authenticate, select a store, browse a catalog, build a discounted cart, take cash or PromptPay payment, and record sales that affect stock and reporting. The primary interface is a React PWA; a legacy Vanilla JS interface shares the Flask API. The React app also supports offline sales and later synchronization. The graph preserves the documented inventory, order, reporting, analytics, and product-management branches. Some subsystem links rely on README descriptions because their implementation files were not sampled.
Main entry points: client.ts HTTP client · SellPage.tsx Sell screen · server.py Flask API · offlineOrders.ts Offline orders
Components 20
React POS
- App entry
frontend/src/app/App.tsx - PIN and session
frontend/src/features/auth/AuthContext.tsx - Store selection
frontend/src/features/stores/StoreContext.tsx
Sales operations
- Sell screen
frontend/src/features/sell/SellPage.tsx - Catalog loading
frontend/src/features/sell/useProducts.ts - Checkout
frontend/src/features/sell/useCheckout.ts - Order history
frontend/src/features/orders/OrdersPage.tsx - Stock control
frontend/src/features/stock/StockPage.tsx - Sales reports
frontend/src/features/reports/ReportsPage.tsx - Sales analytics
frontend/src/features/analytics/AnalyticsPage.tsx - Product admin
frontend/src/features/products-admin/ProductsAdminPage.tsx
Offline capability
- Offline orders
frontend/src/offline/offlineOrders.ts - IndexedDB
frontend/src/offline/database.ts - Order sync
frontend/src/offline/syncOfflineOrders.ts
Flask services
- HTTP client
frontend/src/api/client.ts - Legacy interface
vanilla/app.js - Flask API
backend/server.py - PromptPay QR
backend/promptpay_qr.py
Persistent state
- SQL database
backend/database.py
Other components
- Cashier
Connections 20
- Cashier → App entry: uses
- App entry → PIN and session: provides context
frontend/src/app/App.tsx - PIN and session → Store selection: gates access
frontend/src/app/router.tsx - Store selection → Sell screen: routes to
frontend/src/app/router.tsx - Sell screen → Catalog loading: loads products
frontend/src/features/sell/useProducts.ts - Sell screen → Checkout: submits sale
- Checkout → HTTP client: sends checkout
frontend/src/features/sell/useCheckout.ts - HTTP client → Flask API: requests API
- Flask API → SQL database: reads and writes
backend/server.py - Flask API → PromptPay QR: generates QR
backend/server.py - Sell screen → Offline orders: queues offline
- Offline orders → IndexedDB: stores orders
frontend/src/offline/offlineOrders.ts - Order sync → Offline orders: reads queue
frontend/src/offline/offlineOrders.ts - Order sync → HTTP client: uploads orders
- Order history → HTTP client: loads orders
- Stock control → HTTP client: loads stock
- Sales reports → HTTP client: loads reports
- Sales analytics → HTTP client: loads analytics
- Product admin → HTTP client: manages products
- Legacy interface → Flask API: calls shared API