Counting every tray once.
Harvest tracking, attendance and payroll for a berry ranch in Mexico. A field app that works with no signal, an admin panel that runs weekly payroll, and one rule that ended the arguments: one scan per tray, at the delivery point.
- My role
- Everything: domain, data model, API, mobile app, web panel, infrastructure.
- Platforms
- iOS and Android app, web admin panel.
- Status
- In production. Published on the App Store.
- Scale
- 639 workers and 5 crops in the catalog.
Where the work actually happens
Berries grow under long shade tunnels. Crews of pickers, each led by a crew leader, fill trays and carry them to a delivery point. On a busy day several delivery points run at once, hundreds of workers pass through them, and the phone in the supervisor's hand has no signal most of the time.
The ranch pays the crew leader for the whole crew, weekly, at a price per tray that depends on the crop plus a bonus per crew. The crew leader then pays their people. Every number in that chain starts with one question: how many trays did this worker deliver today?
Two counts that never matched
Before the app, trays were counted twice, on paper: once by the crew leader, once by a ranch representative. The two tallies rarely agreed. Every week, before payroll could be run, someone had to sit down and argue the difference. Payroll itself lived in a spreadsheet that only one person understood.
The fix was partly a process change and partly software. The ranch would control a single point of registration. Each worker gets a QR code. The supervisor at the delivery point scans it and types the number of trays. That record is the count. There is no second one.
A field app, an admin panel, and the sync between them
The field app
Built for a supervisor standing in the sun with gloves on. Scan a QR, type trays, pick the crop, done. Roll call for the harvest crews and the plant crews with a single tap per worker. Everything is stored on the phone first and pushed whenever there is a connection, with a visible queue so nobody wonders whether the morning's entries made it.
The admin panel
Where the ranch sets up a season: crops and their prices, crews and their bonus, workers and their printable QR credentials. Then the weekly payroll, computed per crew from the synced entries, with loans and sanctions applied, attendance alongside, and an export for the accountant. Reports for the owner, and an audit log of who changed what.
The sync
Every entry gets its ID on the phone, not on the server. The phone pushes batches; the server inserts what it has not seen and ignores what it has. A batch can arrive twice, or after the app crashed halfway, and the count is still right. Catalogs flow the other way so a device can start the day fully offline.
A worker's identity is a printed card, not an account.
Pickers do not have logins, and many do not carry a phone. The admin panel generates a credential per worker: photo, role, crew leader, season, and a QR that carries nothing but an opaque ID. It gets printed, laminated and clipped on. If one is lost, a new one is issued. The card is what the supervisor scans in step one.
Everything the phones captured, summed up before the coffee is cold.
Boxes today and this week, who showed up, what the week's payroll comes to for harvest and plant crews, loans outstanding, headcount changes. Then production over the last seven days, and today's boxes by crew and by crop. Every number here is a sum over the entries the supervisors scanned in the field.
Five choices I would make again
- 01Offline-first, not offline-tolerant.
The phone is the source of truth until it syncs. The app never blocks on the network, and the sync queue is visible to the supervisor.
- 02One delivery point, one scan.
The software only works because the process changed with it. Convincing the ranch to control a single point of registration mattered more than any feature.
- 03Payroll per crew, because that is how the ranch pays.
The system models the real money flow, ranch to crew leader to worker, instead of forcing a per-worker payroll the ranch would have to translate back.
- 04Idempotent sync with client-generated IDs.
Retries and duplicate batches are the normal case in the field, not an edge case. The server inserts on conflict do nothing.
- 05Identity on paper, not in an app.
A printed QR credential per worker means zero onboarding for hundreds of pickers, and the QR carries only an opaque ID. Lose the card, get a new one.
Running today
- 639
- workers in the catalog
- 5
- crops with their own prices
- 591 + 48
- harvest and plant workers on one day's roll call
- 3
- apps: iOS, Android and web, on one API
What it runs on
Expo and React Native with WatermelonDB for the offline store. React and Vite for the admin panel. Node, Express and Drizzle ORM over PostgreSQL for the API. Shared TypeScript types across all three in a Turborepo monorepo. The stack is the least interesting part; the sync rules and the payroll model are what make it work.