BukaWarung — Multi-Tenant Retail SaaS, Touch POS, Accounting & Online Storefront Platform

BukaWarung is a full-stack, multi-tenant retail SaaS platform engineered for Indonesian MSMEs (UMKM), unifying Touch POS, multi-outlet inventory, cash/P&L accounting, procurement, HR/payroll, customer loyalty, and a public e-commerce storefront in one system.
Built with Next.js 15 (App Router), React 19, Tailwind CSS v4, and Supabase (PostgreSQL 17.6), the platform evolved across 69 commits into 20 App Router pages, 6 API Route Handlers, 55 modular UI components, 9 domain-isolated React contexts, and 22 stateless service modules.
Key Engineering Highlights:
• Multi-Tenant Security & RBAC: Enforced strict business_id isolation via PostgreSQL Row Level Security across 34 public tables plus 8 isolated private-schema tables, paired with 38 granular RBAC permissions across 11 modules and branch-level cashier scoping.
• Atomic Database Operations: Authored 36 SQL migrations and 76 PostgreSQL functions/RPCs (including FOR UPDATE stock locking, idempotency keys, and immutable invoice snapshots). Revoked direct client writes on financial and stock-transfer tables to prevent PostgREST tampering.
• Cryptographic QRIS & Storefront Hardening: Integrated dynamic QRIS payments (Midtrans & Xendit) using server-only secret retrieval, SHA-512/callback-token verification with crypto.timingSafeEqual, and fail-closed production guards. Protected public checkout with a 32 KB streaming byte limiter, HMAC-SHA256 rate-limit keys, and server-side price recalculation.
• Performance & Reliability: Refactored a monolithic context into 9 domain contexts, built O(N) single-pass ledger aggregations (<20 ms on 5,000 transactions), an O(1) SKU/barcode search index, keyset cursor pagination, CSV formula-injection sanitization, and React error boundaries.
• Verification & CI/CD: Automated dual-gate GitHub Actions CI running ESLint 9, 73 Node.js test cases (14 suites), Next.js builds, and 10 pgTAP database suites (153 assertions).
