/ Case study — POS
POS System
A register that keeps selling when the network drops and reconciles cleanly when it returns.
★ Favorit
Katalog
Order #1042
No items yet
SubtotalRp0
PB1 10%Rp0
TotalRp0
The actual register, rebuilt in code — watch the network drop mid-sale. It keeps selling.
abaj-pos · desktopFIG.00 — Overview- Rust core — crash recovery · IPC · logging
- Offline-first — sell through outages, reconcile on sync
- ESC-POS receipts (LAN) · device management
/ What it does
Ring up any sale in seconds — even with no internet
A point-of-sale that never freezes. The cashier keeps serving customers whether the wifi is up or down, and every sale syncs back automatically the moment the connection returns.
Add items
Tap products or scan — the total updates instantly.
Never stops selling
A dropped connection can’t hold up the queue — the register just keeps working.
Fast at the counter
A few taps to ring up, take payment, and print — no waiting.
Nothing slips through
Every sale is saved and reconciled, so the books always match the till.
Problem
A retail counter can’t stop selling because the internet did. Cloud-only POS software fails exactly when it matters — at the register, mid-transaction, with a customer waiting.
Approach
Treat the register as an offline-first edge client of the commerce backend. It owns its own local state, prints locally, and syncs when it can.
- Tauri desktop shell: a Rust core for native hardware access with a React UI.
- Rust handles the unglamorous, critical parts — crash recovery, IPC to the web layer, and structured logging — so a lost frame or a killed process doesn’t lose a sale.
- A tokenized design system as the single source of truth for POS typography and color — mirrored in TypeScript and lockstep-tested so the register never drifts.
- ESC-POS receipt rendering over LAN, with device management and a sync API.
Offline-first is a posture, not a feature: every flow assumes the network is optional.
Architecture
Register (Tauri: Rust core + React UI, local store)
├─ sell offline ─────► local transactions
├─ Rust core ────────► crash recovery · IPC · logging · printer
├─ print ────────────► ESC-POS (LAN)
└─ sync (online) ────► Commerce Backend (SSOT)
device mgmt · price rules · reconcile
Key decisions & trade-offs
- Offline-first is a posture, not a feature. Every flow assumes the network is optional; sync is reconciliation, not the source of truth.
- Design tokens as SSOT. POS type and color live as CSS variables mirrored in TS and lockstep-tested — no drifting inline values on the shop floor.
- Hardening is honest. LAN/ESC-POS is pilot-ready; USB/Bluetooth/Serial transports and signed updates are tracked as explicit blockers, not hand-waved as done.
Result
A register that keeps trading through outages and reconciles cleanly — with a Rust core for the parts that must not fail and a design system rigorous enough to trust in production.
Masalah
Meja kasir tidak boleh berhenti jualan cuma karena internetnya mati. Software POS yang cloud-only justru gagal tepat saat paling dibutuhkan — di kasir, di tengah transaksi, dengan pelanggan menunggu.
Pendekatan
Perlakukan kasir sebagai klien edge yang offline-first dari backend commerce. Ia memiliki state lokalnya sendiri, mencetak secara lokal, dan menyinkron saat bisa.
- Shell desktop Tauri: inti Rust untuk akses hardware native dengan UI React.
- Rust menangani bagian yang tidak glamor tapi kritis — pemulihan dari crash, IPC ke lapisan web, dan logging terstruktur — jadi frame yang hilang atau proses yang terbunuh tidak menghilangkan transaksi.
- Sistem desain ber-token sebagai satu-satunya sumber kebenaran untuk tipografi dan warna POS — dicerminkan di TypeScript dan diuji secara lockstep agar kasir tidak pernah melenceng.
- Perenderan struk ESC-POS lewat LAN, dengan manajemen perangkat dan sebuah sync API.
Offline-first itu sikap, bukan fitur: tiap alur menganggap jaringan itu opsional.
Arsitektur
Register (Tauri: Rust core + React UI, local store)
├─ sell offline ─────► local transactions
├─ Rust core ────────► crash recovery · IPC · logging · printer
├─ print ────────────► ESC-POS (LAN)
└─ sync (online) ────► Commerce Backend (SSOT)
device mgmt · price rules · reconcile
Keputusan kunci & trade-off
- Offline-first itu sikap, bukan fitur. Tiap alur menganggap jaringan opsional; sync adalah rekonsiliasi, bukan sumber kebenaran.
- Design token sebagai SSOT. Tipe dan warna POS hidup sebagai variabel CSS yang dicerminkan di TS dan diuji lockstep — tanpa nilai inline yang melenceng di lantai toko.
- Pengerasan yang jujur. LAN/ESC-POS siap-pilot; transport USB/Bluetooth/Serial dan update bertanda-tangan dilacak sebagai penghambat eksplisit, bukan dianggap selesai begitu saja.
Hasil
Kasir yang tetap berdagang menembus gangguan dan rekonsiliasi dengan rapi — dengan inti Rust untuk bagian yang tidak boleh gagal dan sistem desain yang cukup ketat untuk dipercaya di produksi.
/ How it’s done
Offline-first — live
Flip the network off and keep selling. Every sale writes locally first; sync reconciles to the backend when the connection returns — nothing lost.
Offline-first is a posture, not a feature. Every sale writes locally first, so the counter never stops for a dropped network. Sync is reconciliation — not the source of truth — so nothing is lost when the connection returns.
A Rust core for what must not fail
The Tauri shell is Rust: crash recovery, IPC to the web layer, and structured logging live in native code, so a killed process or a lost frame never loses a sale.
Shell Tauri-nya adalah Rust: pemulihan dari crash, IPC ke lapisan web, dan logging terstruktur hidup di kode native, jadi proses yang terbunuh atau frame yang hilang tidak pernah menghilangkan transaksi.
Offline-first is a posture
Every flow assumes the network is optional. Sales are local writes first; the register never waits on a round-trip to take money.
Tiap alur menganggap jaringan itu opsional. Transaksi ditulis lokal dulu; kasir tidak pernah menunggu bolak-balik jaringan untuk menerima uang.
Sync is reconciliation, not truth
When the connection returns, local transactions reconcile against the backend SSOT — device management, price rules, and conflict handling included. Nothing queued is lost.
Saat koneksi balik, transaksi lokal direkonsiliasi terhadap SSOT backend — termasuk manajemen perangkat, aturan harga, dan penanganan konflik. Tidak ada yang antre yang hilang.
Hardening, honestly
LAN + ESC-POS receipts are pilot-ready; USB / Bluetooth / Serial transports and signed updates are tracked as explicit blockers, not hand-waved as done.
Struk LAN + ESC-POS siap-pilot; transport USB / Bluetooth / Serial dan update bertanda-tangan dilacak sebagai penghambat eksplisit, bukan dianggap selesai begitu saja.