Skip to content
Back to the list

lbs.com.vn · app nội bộ

LBS · Internal shipment tracking

28 Rust state machines running in the browser through WebAssembly

LBS Global Logistics (lbs.com.vn) handles international shipping and supply chain work, and its operations team tracked shipments in Excel and email. Rate sheets, customer credit limits and bill-of-lading records are exactly what they did not want to push to a third-party server. That constraint decided the architecture: the app runs inside the staff member's browser and no server holds the data.

Installed software, no public demo.

  • Rust
  • wasm-bindgen
  • calamine
  • Lit
  • AG Grid

§ 01Product

src/abstractions/states — 28 máy trạng thái thuần Rust
# Biểu cước, hạn mức tín dụng, dữ liệu B/L là dữ liệu nhạy cảm
#   → toàn bộ parse / validate / transition chạy TRONG TRÌNH DUYỆT
#   → sản phẩm giao đi chỉ là file tĩnh, không tính toán phía server

Shipment:  Open → Quoted → Booked → InTransit
                → Arrived → Delivered → Invoiced → Closed
           ↘ Cancelled

  Closed, Cancelled = trạng thái hút (không còn chuyển tiếp)
  test: transitions_closed_empty, transitions_cancelled_empty

AirRate:   Draft → Published → Expired

transition(s, e):
  nếu (s, e) ∉ bảng chuyển:
    Err(GuardError::InvalidTransition { from: s, event: e })   # chặn, không sửa ngầm

# 28 FSM: AirShipment, Allocation, ArrivalNotice, AwbDoc, Billing,
#         CarrierBooking, …

§ 02Highlights

  • All parsing, validation and state transitions run in the browser through WebAssembly
  • 28 pure Rust state machines for shipments, rates, documents, allocation and billing
  • Invalid transitions are stopped with a contextual error rather than silently corrected
  • Excel read client-side with calamine, no file is uploaded anywhere
  • Excel-style grid with virtual scrolling for more than 10,000 rows
  • A.D.D V3 architecture with hard layer rules: Boundary and Core depend on nothing

§ 03Screens

LBS · Internal shipment tracking — 01