Emiliano Loza Leer en español
Case study · Ranch Picking

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.
Packing station under a shade tunnel: two workers stacking trays of raspberries on a table and pallets
A delivery point in the field. Trays come in from the tunnels, get counted, and leave on pallets.
The field

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?

A freshly picked raspberry held between two fingers in front of the plant
The problem

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.

A handwritten harvest tally sheet: raspberry station, crew leader's name, date, one row per picker with tunnels and variety, tally marks per hour, and a total per picker
A crew leader's sheet from before the app. One row per picker, a tick per tray, hour by hour, totals by hand. The ranch kept a second sheet of its own.
Before
Crew leader's notebook
Count A
Before
Ranch representative's sheet
Count B ≠ A
After
One scan at the delivery point
One count

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.

What I built

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.

The supervisor's four screens
Scan screen of the field app pointing at a worker's QR credential. Names and ranch name blurred.
1. Scan the worker's QR credential, printed from the admin panel.
Register delivery screen: worker, number of boxes, crop and optional tunnels. Name blurred.
2. Type the trays, pick the crop. That record is the count.
Roll call screen of the field app: 100 of 591 harvest workers marked, 0 of 48 plant workers. Names blurred.
3. Roll call, one tap per worker, harvest and plant crews apart.
Sync screen of the field app: empty queue, last sync today, 639 workers and 5 crops in the local catalog
4. Sync when there is signal. The queue says what is still on the phone.
The other end of the scan

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.

Admin panel modal showing a worker credential with photo placeholder, role, crew leader and QR code, next to a large scannable QR and the worker ID. Names, logos and ranch name blurred.
The credential as the panel shows it before download. Names, logos and ranch name blurred.
The owner's morning

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.

Admin panel dashboard: boxes today, attendance, payroll due, loans balance, headcount, a seven-day production bar chart, and today's boxes by crew and by crop
Shown with demo data. Ranch name blurred.
Pallets of sealed raspberry boxes stacked under a shade tunnel, ready to leave the ranch
Where every scanned tray ends up: sealed, palletized, and paid for by the crew that picked it.
Decisions that mattered

Five choices I would make again

  1. 01
    Offline-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.

  2. 02
    One 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.

  3. 03
    Payroll 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.

  4. 04
    Idempotent 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.

  5. 05
    Identity 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.

In numbers

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
Ranch Picking listing on the App Store
Published on the App Store under my own developer account.
Stack, for the curious

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.