Matthew Kong

Case studies/BambooHR, 2020 to 2021

Onboarding tasks and distributed time tracking

Idempotent task scheduling and offline-safe clock events, with location data treated as restricted context rather than an analytics field.

Close-up of code declaring a color palette
  1. Admin setup
  2. Template scheduler
  3. Task notifications
  4. Mobile clock event
  5. Dedupe API
  6. Time-entry DB
  7. Timesheet aggregation
  8. Manager approval

Why this work, at that time

In 2020 and 2021 BambooHR expanded remote-worker onboarding and geolocation time tracking as the customer base passed 25,000 companies and roughly 2 million users.

The problem

Remote hires needed scheduled onboarding tasks and reliable clock entries despite offline mobile retries. Location data had to be visible only where authorized and retained appropriately.

The team and my part

Seven engineers: three backend, two web, one mobile integration, one senior lead, with PM, a designer, QA and a privacy reviewer shared. I led backend scheduling and assisted a junior developer through the release.

Data and index design

onboarding_template(id, tenant, task_type, offset_days); onboarding_task(id, employee, due_date, state); clock_event(tenant, employee, device_event_id, utc_at, source, location_precision); timesheet(tenant, employee, period, state).

API and event contract

POST /onboarding/templates; PATCH /tasks/{id}; POST /time-clock/entries {device_event_id, utc_time, site_id}; GET /timesheets?period. Event onboarding.task_due v1.

Core logic

Expand templates into immutable assignments when a hire starts. Validate clock timestamps, store UTC plus the employee's time zone, and dedupe on tenant, employee and device_event_id. Rebuild timesheets from immutable clock events with explicit correction records.

Implementation sequence

  1. Map onboarding triggers and shift boundaries with product and support.
  2. Build the scheduler with retries and idempotent task generation.
  3. Define the clock-event contract used by mobile and web clients; enforce server-side scope and retention.
  4. Add aggregation jobs, a reconciliation report and a support-safe correction API.
  5. Roll out to pilot tenants; watch duplicate clock events, missed reminders and report latency.

Environments and release

Local PHP, MySQL and React with a fake mobile event sender; staging with randomized offline replay; production job processing with alerting on scheduler lag.

Failure drill

An offline device replays twelve events out of order. Dedupe keys and event-time ordering keep one logical shift while preserving every legitimate punch.

Scale and targets

Modeled scale

  • About 820 tenants and 115K users in the rollout
  • 28K clock events per day, 0.32 writes per second average
  • Roughly 70 writes per second around shift start

Acceptance targets

  • Zero duplicate logical punches
  • Task generation lag p95 under five minutes
  • Clock ingest p95 under 400 ms

Scale figures are the sizing model behind the design. Targets are acceptance criteria, not measured results.

The trade-off I would defend

Employee location is restricted context, not an analytics attribute. Aggregate minimally and honor retention.