How r14bz/pos-flow works
SEMAR is a multi-store retail POS: staff sign in, select a store, manage inventory, ring up sales, and review dashboards/reports. The React client supports demo data or Supabase-backed sessions and tenant data; database RPCs enforce atomic checkout and stock changes. Separate Edge Functions handle employee/admin tasks, QRIS setup and payment confirmation, scheduled reports, and low-stock push delivery. The README documents more UI capabilities than the sampled excerpts expose; those are represented at the app boundary, and unsampled internal links are omitted. Evidence is limited to the supplied excerpts, source index, and README.
Main entry points: App.jsx POS and dashboard · 202610100001_init_pos.sql Tenant database and RPCs · create-qris-payment/index.ts Dynamic QRIS creation · notify-low-stock/index.ts Low-stock notifications
Components 25
POS Client
- POS and dashboard
src/App.jsx - Demo data
src/lib/demoData.js - Supabase client
src/lib/supabase.js
Store Data
- Supabase Auth and API
- Tenant database and RPCs
supabase/migrations/202610100001_init_pos.sql
Access Management
- Employee invitations
supabase/functions/invite-employee/index.ts - Employee management
supabase/functions/manage-employee/index.ts - Platform administration
supabase/functions/admin-accounts/index.ts
QRIS Payments
- QRIS settings
supabase/functions/save-qris-settings/index.ts - Credential encryption
supabase/functions/_shared/qris-crypto.ts - Dynamic QRIS creation
supabase/functions/create-qris-payment/index.ts - Static QRIS sales
supabase/functions/create-static-qris-sale/index.ts - Manual QRIS confirmation
supabase/functions/confirm-static-qris-payment/index.ts - QRIS cancellation
supabase/functions/cancel-qris-payment/index.ts - QRIS expiry
supabase/functions/expire-static-qris-sales/index.ts - Midtrans gateway
- Payment webhook
supabase/functions/midtrans-webhook/index.ts
Reports and Alerts
- Daily report
supabase/functions/daily-report/index.ts - Low-stock notifications
supabase/functions/notify-low-stock/index.ts - Web push delivery
supabase/functions/_shared/push.ts - FCM delivery
supabase/functions/_shared/fcm.ts - Cron report endpoint
api/cron/daily-report.js
Other components
- Store staff
- Scheduled trigger
- Push services
Connections 36
- Store staff → POS and dashboard: uses POS
README.md - POS and dashboard → Demo data: loads demo
src/App.jsx - POS and dashboard → Supabase client: queries
src/App.jsx - Supabase client → Supabase Auth and API: auth and data API
src/lib/supabase.js - Supabase Auth and API → Tenant database and RPCs: reads and writes
README.md - POS and dashboard → Tenant database and RPCs: manages store data
README.md - POS and dashboard → Employee invitations: invites employees
README.md - POS and dashboard → Employee management: manages roles
README.md - POS and dashboard → Platform administration: administers platform
README.md - POS and dashboard → QRIS settings: saves QRIS settings
README.md - QRIS settings → Credential encryption: encrypts key
supabase/functions/save-qris-settings/index.ts - POS and dashboard → Dynamic QRIS creation: requests payment
README.md - Dynamic QRIS creation → Credential encryption: decrypts key
supabase/functions/create-qris-payment/index.ts - Dynamic QRIS creation → Tenant database and RPCs: creates pending sale
supabase/functions/create-qris-payment/index.ts - Dynamic QRIS creation → Midtrans gateway: creates charge
supabase/functions/create-qris-payment/index.ts - Midtrans gateway → Payment webhook: posts status
README.md - Payment webhook → Credential encryption: decrypts key
supabase/functions/midtrans-webhook/index.ts - Payment webhook → Tenant database and RPCs: finalizes payment
supabase/functions/midtrans-webhook/index.ts - POS and dashboard → Static QRIS sales: creates static sale
README.md - Static QRIS sales → Tenant database and RPCs: reserves sale
README.md - POS and dashboard → Manual QRIS confirmation: confirms payment
README.md - Manual QRIS confirmation → Tenant database and RPCs: finalizes sale
README.md - POS and dashboard → QRIS cancellation: cancels payment
README.md - QRIS cancellation → Tenant database and RPCs: updates sale
README.md - Scheduled trigger → QRIS expiry: runs expiry
README.md - QRIS expiry → Tenant database and RPCs: releases stock
README.md - Scheduled trigger → Cron report endpoint: triggers report
README.md - Cron report endpoint → Daily report: invokes function
README.md - Daily report → Web push delivery: sends push
supabase/functions/daily-report/index.ts - Daily report → Tenant database and RPCs: reads report data
README.md - POS and dashboard → Low-stock notifications: requests alert
README.md - Low-stock notifications → Web push delivery: delivers web push
supabase/functions/notify-low-stock/index.ts - Low-stock notifications → FCM delivery: sends FCM
supabase/functions/notify-low-stock/index.ts - Web push delivery → Push services: sends notification
supabase/functions/_shared/push.ts - FCM delivery → Push services: sends notification
supabase/functions/_shared/fcm.ts - Low-stock notifications → Tenant database and RPCs: reads stock and tokens
supabase/functions/notify-low-stock/index.ts