Case Study · Field Operations

Field Clock

A clock-in app for drilling crews and a planning panel for the office, kept in sync with the company's ERP.

Android app · Web panel · ERP sync·~40 technicians + 5 planners·2026
Office panel — planning view for the day

Context

The client, a water borehole company in central Portugal, drills boreholes and installs and repairs pumps for farms, factories, municipalities and homes. Each job goes out with a crew: one lead technician and one to three assistants, often at the same site for a whole week.

Work orders already lived in PHC, the company's ERP. The gap was the day itself.

BEFORE

  • —Arrival and departure times reached the office on paper or by phone, with no proof of where anyone was
  • —Planning stayed in the ERP and never reached the crews' phones
  • —Hours per job, needed for billing and payroll, were typed in by hand at the end of the week

Technician app: five taps shape the day

The phone shows today's jobs in order and one large button for the next step. Each tap records a GPS-checked time: at the yard for clocking in and out, and within 500 m of the site on arrival.

IN

Clock in. At the yard, GPS is checked against a 300 m radius before the day can start.

GO

Leave for the site. The first job comes from the office plan, with site, address and client phone.

HERE

Arrive. The lead confirms who is with them, so the whole crew's hours land on the right job.

END

Next job. Ending a job moves the crew straight on to the next one in the day's order.

OFF

Clock out. Back at the yard, breaks are subtracted and the balance is worked out against planned hours.

Sign in with name and PIN
Sign in with name and PIN
Clock in
Clock in
I have arrived
I have arrived
End job
End job
Day finished
Day finished

Crews share devices, so sign-in is a name and a six-digit PIN set by the office. The app works in Portuguese and English.

Office panel: a day at a glance

The panel opens on today's plan. Problems come first: jobs nobody is assigned to, which crews would never see, and technicians with nothing to do. Each job opens in place to change the crew and the order of each person's day.

Planning — alerts in two plain tables, because the planners asked for lists they can scan rather than tags.
Planning — alerts in two plain tables, because the planners asked for lists they can scan rather than tags.
One job per day, created as a week. Only technicians free for the whole period are offered.
One job per day, created as a week. Only technicians free for the whole period are offered.
Work orders from PHC listed next to the ones created in the panel that are still on their way to the ERP.
Work orders from PHC listed next to the ones created in the panel that are still on their way to the ERP.

Every entry can be traced

Clock entries are never deleted. The office can void an entry with a reason, or add a missing one, and each change shows who made it. Entries far from the site, sent late, or with poor GPS accuracy are flagged for a second look.

A technician's day, entry by entry. An arrival 640 m from the site, against a 500 m limit, is flagged and shown on the map.
A technician's day, entry by entry. An arrival 640 m from the site, against a 500 m limit, is flagged and shown on the map.
Hours summary — worked time, breaks and balance per day, week and month. Exports to Excel for payroll.
Hours summary — worked time, breaks and balance per day, week and month. Exports to Excel for payroll.
Job site on the map. The circle is the accepted arrival radius; when the ERP has no coordinates, the first technician to arrive sets them.
Job site on the map. The circle is the accepted arrival radius; when the ERP has no coordinates, the first technician to arrive sets them.

The ERP stays the source of truth

A small agent on the office server runs every ten minutes. It brings technicians, clients, work orders and jobs from PHC, and writes back what the app produces: new work orders, the crew on each job, and hours per technician. It never deletes anything in the ERP.

FIELD

Technician app

Offline-first clock-ins with GPS, crew and notes.

React · Capacitor · Android

CLOUD

Supabase

Postgres with row-level security as the real access control.

Postgres · RLS · Edge Functions

OFFICE

Planning panel

Planning, work orders, entries, hours and settings.

React · TanStack · Cloudflare

OFFICE SERVER

Sync agent

Reads and writes PHC with parameterised SQL, and backs up the day to Excel.

Node · TypeScript · SQL Server

WRITING INTO AN ERP

Before each write, the agent reserves the record's ERP key in the app database. If a run fails halfway, the next run finds that key and finishes the same record instead of creating a duplicate. Site coordinates typed by hand over the years get a common mistake fixed (positive longitudes in mainland Portugal); anything ambiguous is skipped.

Decisions that shaped the build

01

Entries are voided, never deleted

Hours feed payroll. Every correction keeps the original entry, the reason and the person who made it.

02

The database enforces access

Technicians only see their own jobs and can only write their own entries. The rules live in Postgres, so a bug in an app can't widen them.

03

One job per day

A week at one site becomes five jobs, so the ERP gets hours per day and per job without anyone splitting them later.

04

The ERP owns its records

Anything that comes from PHC is read-only in the panel. The office changes it in PHC, and the next sync brings the change.

05

Offline before online

Boreholes are rarely in good coverage. Clock-ins are stored on the phone and sent later, with the phone's clock checked against the server.

06

A demo mode with fictional data

These screens come from a built-in demo, so the product can be shown without exposing a single real client.

GPS rules the office can tune — yard position and both accepted radii in one settings page.
GPS rules the office can tune — yard position and both accepted radii in one settings page.

Specified first, tested throughout

The work started from a written spec and moved through four plans: the database and security rules, the technician app, the office panel, and the ERP agent. Each plan was built task by task with Claude Code, with a review after every task. Writes to the ERP were tested against a copy of the company database before anything touched production.

199

App and panel tests

101

Database and security tests

65

Sync agent tests

4

Plans, spec to ERP sync

TypeScript · React · TanStack Router & Query · Tailwind · Capacitor · Supabase · PostgreSQL · Node.js · SQL Server · Leaflet · Vitest · Cloudflare Workers

Screens show the demo mode. All people, clients, addresses and times are fictional.