Robbie Ardiansyah
← All work

Rebuilding a POS while it takes payments

Omni POS is used by shops every day. Over several years I've been moving it from MVP to MVVM, from XML to Jetpack Compose, and from Realm to Room, and none of it has required stopping the app.

Product
Omni POS
Architecture
MVP → MVVM + Repository
UI
XML → Jetpack Compose
Storage
Realm → Room

01The constraint

A point of sale can't have a migration weekend. Merchants open in the morning and expect the till to work. The app is offline-first: it calculates transactions on the device, keeps them locally, and syncs later. Until a sale syncs, the local database is the only place it exists.

So each migration had to happen incrementally, alongside feature work.

02The approach

The rule was the same for all three migrations. New work goes on the new stack, and legacy code is converted behind it. No big-bang rewrite, and no release that depends on a migration being finished.

MVP → MVVM + Repository

Logic moved out of presenters into view models backed by repositories, with dependencies injected through Hilt. It's also what makes the other two possible. A Compose screen needs state it can observe, and storage can only be swapped safely when callers go through a repository rather than straight to Realm. Along the way I resolved a circular dependency between the order and printer repositories.

XML → Jetpack Compose: partial is fine

A screen doesn't have to be all Compose or all XML. The migration goes component by component, inside the existing structure:

  • Compose inside existing fragments. A fragment can return a ComposeView and keep its place in the navigation graph, its arguments and its lifecycle. The item picker works this way: the fragment stayed, and its content became composable screens backed by a view model.
  • Pieces, not pages. Self-contained parts move first. The QRIS payment dialog was rebuilt in Compose with a view model, then the scattered payment dialogs were consolidated into one Compose and MVVM implementation on a shared base dialog frame.
  • State before UI. Screens like the order list are getting a view model that exposes StateFlow before their views change at all. That makes the later switch to Compose a rendering change rather than a logic change.

The result is a codebase where XML and Compose sit side by side, sometimes on the same screen.

In 2026 I took the same approach to the Burger King Indonesia app: a Compose theme carrying the brand's colours and typography first, then the ordering home screen rewritten in Compose on dedicated UI models, while the rest of the app stayed on views. Underneath, its cart and order handling moved screen by screen from the app's own Realm models onto a shared ordering library.

Realm → Room: double write, then switch reads

Moving storage is riskier than moving UI, because a mistake loses data instead of drawing a wrong pixel. The pattern is a double write, done one data area at a time:

1 · add Room model→ 2 · write both→ 3 · move reads→ 4 · drop Realm
  1. Add the Room model alongside the Realm one: entities, cross-references, DAOs. Nothing reads it yet.
  2. Write to both. Sync writes the server response into Room as well as Realm, and local changes such as a price edit or a new product write to both stores. Room fills up with real production data while Realm is still the source of truth.
  3. Move reads one screen at a time. Once Room's copy can be trusted, each screen switches its reads: first the item picker, then the modify-item dialog, barcode scanning, subtotal pricing and free-item promotions. Each switch is a small change of its own.
  4. Remove the Realm side once nothing reads it.

The current pass started with catalogue data (product groups and variants), which sync can always restore from the server, not with orders, which may exist only on the device.

The variant pass finished in October 2026. Once no screen read the Realm variant, writes went Room-only in stages: the link from order items first, then quantity, price and stock edits, then sync and product creation. The last step deleted the Realm Variant model with a Realm schema migration that existing installations run on update.

Some data turned out not to need a database at all. Purchase orders, vouchers and rewards became in-memory models, which cut database overhead and took them out of the migration entirely.

03Measured along the way

~15s → ~4s
Inventory sync on 15,000+ records, about 75% faster, from bulk writes in place of per-object saves and a single consolidated cleanup.
19% / 22% / 23%
Faster overall render, view inflation and resume on the new-order screen, benchmarked across repeated lifecycle runs.
26 → 14 min
CI build time after upgrading to setup-gradle v4 with proper caching.

04Result

Three migrations shipped one piece at a time in an app that kept processing live transactions throughout.

It isn't finished. Product variants are fully on Room as of October 2026, and orders, which may exist only on the device, are still on Realm.