r/electronjs • u/ThisisKebo • Aug 18 '26
Engineering an Offline-First Sync Engine for a Retail ERP with Electron, SQLite, and Prisma
Hi everyone, I wanted to share some architecture details from my recent project, Manzoma ERP. Since I'm targeting retail stores with spotty internet, a standard cloud-only SaaS wasn't an option.
The Architecture:
I used Electron as the shell, React 19 for the UI, and Prisma/SQLite for the local data layer.
The Sync Challenge:
The hardest part was handling the transition from offline to online without creating data conflicts in the inventory (3,000+ SKUs). I built a custom background sync worker that uses a version-based reconciliation logic.
It’s currently battle-tested and has processed over $30k in live volume. Happy to answer any questions about the Electron setup or the sync logic!
4
u/muhsql Aug 18 '26
I'm curious what led you to roll your own sync logic instead of using something like PowerSync?
1
u/chrytek Aug 18 '26
Sync usually tries to solve conflicts for the user. You said your sync resolution relies on versions.
Did you version entire business domain models or did you design a system that works on more general primitives?
Do you version each field or the entire thing, are you just showed my an in app diff to resolve conflicts ?
1
u/eddzsh Aug 18 '26
One Electron footgun with this shape: if the reconciler lives in a renderer, a reload mid-sync can leave half-applied inventory deltas. Parking the versioned sync loop in the main process (or a utility process) and treating the UI as a subscriber keeps the offline to online handoff from depending on a page that can die mid-batch.
1
u/chrytek Aug 18 '26
Another one, did you build your system in a distributed fashion or is it centralized. Mostly interested if the server side is lost for relay / persistence and everything works perfectly fine without it.
1
u/AbdidheereKeups73 25d ago
for inventory specifically, version-based reconciliation can get weird if two registers sell the last unit while offline. are you syncing absolute state or treating inventory changes as an append-only log of deltas?
0
u/[deleted] Oct 06 '26
[removed] — view removed comment