1. Home
  2. Work
  3. Racing Operations Platform with Per-Horse Profit and Loss

Case study

Racing Operations Platform with Per-Horse Profit and Loss

One reconciled, trustworthy number on top of four systems that could not see each other: accounting, horse billing, payroll and racing results. Web dashboard, natural-language assistant and native mobile apps, live since June 2026.

The problem

The client trains racehorses across three sites, with roughly 340 horses on the books, around 280 billed each month, 2,300 individual owners and more than a million dollars in monthly billing. Their data lived in four systems: Xero for accounting, a stable-management product for horse movements and per-horse billing, an HR platform for staff hours and leave, and public racing results. Each system was fine on its own. None of them could answer the question the owners actually cared about: which horses, and which barns, make money?

The brief had one defining idea, which the client called "the glue": a single distilled, visible, trustworthy number on top of all their systems, with no holes, that none of those systems could produce alone. Every figure had to trace back to its source and reconcile to a zero residual, and the client should never have to change how they used their existing tools.

What we built

We extended an approved demo into a production platform in days rather than starting over. The demo's hardcoded financials, SQLite store and open access were replaced by a secured FastAPI application on a managed PostgreSQL database, with per-user logins, and the live cutover happened on day two. From there the platform grew by extension.

  • Per-site and per-horse P&L ledgerRevenue accrued per horse from billing; costs from Xero's profit and loss by location. Direct pass-through costs (vet, farrier, transport) are exact. Barn overheads (feed, wages, rent) are allocated by the days each horse was present, with a built-in check that allocated totals equal the cost pools.
  • Reconciliations that tie outXero P&L by location ties to Xero's own total to the dollar. Monthly net ties to the billing system's dashboard to the cent. Billed versus banked revenue is shown as named work-in-progress, not hidden. Prizemoney and sale proceeds are kept out of revenue as clearing items.
  • Labour measuresDollars from Xero, splits from the HR platform. Only 43 percent of wages were tagged to a location; the rest are allocated by headcount and hours per barn and clearly labelled as an estimate. Horses per 100 staff-hours and revenue per staff-hour are reported.
  • Location, occupancy and forecastOccupancy rings per barn, multi-year trend, seven-day movement flow between barns, unmatched-horse lists, and a forecast of time until barns reach 90 percent capacity built on five years of movement history.
  • Profitability and riskBilling-leakage monitor (horses on site but not billed), per-barn margin, horses below cost and owner concentration.
  • "Ask the Stable"A natural-language assistant that writes read-only SQL against the reconciled data and can pull racing records. Allow-listed tables, a five-second read-only transaction, owner names blocked, available only to roles that can see financials, and rate-limited.

Also delivered: a twelve-month Xero history backfill, sales tracking, a leave calendar, user administration, manual and CSV data entry with downloadable templates, and data-freshness banners on every screen.

Integrations without APIs

Xero was the easy one: a read-only custom connection reconciled daily by a cron job. The stable-management and HR products offered no API on the client's plans, so the platform ingests their scheduled CSV exports. A Raspberry Pi running a headless browser automated the downloads; when the vendor reported load on their system we switched it off the same day, redesigned it as a daily "light pull" of changes only at a randomised time, and re-enabled it with their knowledge. An email-ingestion path through a Cloudflare Email Worker was built as an alternative.

Daily location files are merged into the platform's own history, which is never deleted, and an anomaly guard stops a broken file from wiping data. The client's racing results are enriched from our own racing database, while the billing system remains the authoritative list of horses.

Mobile apps

The client treats the phone app as the main product. We built a native iOS app in SwiftUI with five tabs (dashboard, horses, location, racing, schedule) and the Ask assistant on every screen, and a matching Android app in Flutter with biometric lock, encrypted cache, screenshots blocked and cloud backup disabled. Screens are server-driven, so new metrics ship from the backend without an app release. The Android build is distributed as a signed APK through a private release repository.

Security and hardening

Login gates the whole application. Roles are superadmin, owner, manager and staff, and staff never receive financial data on web or API. Web sessions last twelve hours, device tokens thirty days, and tokens are versioned and revoked on password reset. Logins are rate-limited per account and per IP, and audited. Stored credentials are encrypted, the database is not publicly reachable, uploaded CSVs are parsed in memory and never kept, and production refuses to start if security settings are missing. Owner privacy is structural: shares are shown, names are not, even in the app.

An independent review in July 2026 raised three critical, several high and nine medium findings, including an injection path in the assistant, a labour-rate unit error and silent data holes. All are closed. Every collector has a dead-man's switch and a freshness endpoint watched by an uptime monitor.

Outcome

The business has, for the first time, a per-horse and per-barn profit and loss it can take to its owners, reconciled to its accounts. Billing leakage is visible the week it happens rather than at year end. Executives check occupancy, margin and a horse's racing record from their phone. The whole platform runs on a small managed database and web service for a modest monthly hosting bill, and the client owns the code.

Commercial model: no setup fee, a monthly fee for the build phase stepping down to a lower monthly fee for support. See how we work.

Have something you need built?

Tell us the problem, the systems you already use and what a good outcome looks like. You will get a plain-language reply within one business day, usually with a first sketch of how we would build it.