Grain Calculator — grain accounting with no signal at the elevator
My own agritech app: from a grain price calculator to warehouse accounting that works offline and syncs across devices.
Context
My own product: from a calculator to warehouse accounting. Flutter, Node.js (Cloud Run), Firebase, published to Google Play and the App Store.
The problem
At the elevator and in the field the signal drops. Accounting that needs the internet stops exactly when the truck is on the scale. At the same time the data is needed on several devices — a phone and a tablet — and must not drift apart.
The solution
- Offline-first. All records live in a local database on the device (Drift/SQLite) and work without a network; changes go into a queue.
- Cursor-based sync. A device asks only for what changed after its saved cursor; changes go in batches of up to 100, an oversized batch is split in half, and a rate limit triggers a pause per Retry-After.
- Conflicts without silent loss. On a simultaneous edit the server keeps one version, and the losing state is stored in a log and can be restored.
- Instant updates. A WebSocket "organization changed" signal wakes the other devices; polling remains as a fallback.
- Derived data is not synced. The movement journal is rebuilt from the posted document, and the settlement weight is computed with the same formula as the calculator.
- Scale verified. A 50,000-delivery-note dataset (ten seasons): the list is paged, and reports read only visible rows.
The result
- Verified on real devices (Android + iPhone): changes arrive in both directions within seconds; after being offline, about 7 s after the network returns.
- No duplicate for the author of the change; deletions arrive too.
- On Google Play and the App Store, 18 interface languages, tutorials on a demo warehouse.
- Phone, tablet, iPad: on a wide screen the list and the document sit side by side.
Technologies
Flutter · Dart · Drift (SQLite) · Node.js · WebSocket · Firebase · Cloud Run · RevenueCat
Need sync that survives a lost connection?
Tell me about your task — I will reply within a day with an outline of the approach.
Discuss your project Grain Calculator on the site