Building IrriCalc: The Professional Irrigation Calculator App

March 24, 2026 (3mo ago)

When irrigation professionals are out in the field, they need to perform complex hydraulic calculations quickly and accurately. Getting the friction loss wrong means sprinkler heads won't pop up or pipes might burst.

To solve this, I built IrriCalc — an offline-first iOS and Android app that puts professional-grade irrigation math right in your pocket.

The Tech Stack

I chose a robust, cross-platform mobile stack:

  • Framework: React Native with Expo SDK 52
  • Routing: Expo Router (file-based navigation)
  • State Management: Zustand + AsyncStorage
  • Monetization: RevenueCat for a $4.99 one-time "Pro" unlock
  • Styling: Sora and DM Mono fonts
  • Build System: bun + EAS Build

Architecture Decisions

1. Hardcore Hydraulics: The 452 PSI Form

The industry standard for calculating pressure loss in pipes is the Hazen-Williams formula. Most online calculators use the 0.2083 constants form, which outputs "feet-of-head". I explicitly built IrriCalc around the 452 constants form, which outputs PSI directly — saving an error-prone conversion step.

// src/calc/hydraulics.ts
/**
 * Hazen-Williams friction loss in PSI per 100 feet.
 * CRITICAL: Uses the 452 form that outputs PSI directly.
 * hf = 452 × Q^1.852 / (C^1.852 × d^4.87)
 */
export function frictionLossPer100(
  gpm: number,
  innerDiameterIn: number,
  cValue: number
): number {
  if (innerDiameterIn <= 0 || cValue <= 0 || gpm <= 0) return 0;
  return (
    (452 * Math.pow(gpm, 1.852)) /
    (Math.pow(cValue, 1.852) * Math.pow(innerDiameterIn, 4.87))
  );
}

2. Engineering Judgment via UI Traffic Lights

Numbers alone can be hard to interpret rapidly. I implemented a strict visual status system for calculating all pipe sizes concurrently. The system evaluates the velocity (feet per second) of water through the pipe:

// src/calc/hydraulics.ts
const status: PipeStatus = v > 7 ? 'fail' : v > 5 ? 'warn' : 'safe';
  • Green (Safe): < 5 ft/s
  • Amber (Warn): 5 - 7 ft/s
  • Red (Fail): > 7 ft/s (Danger of water hammer and pipe degradation)

This gives professionals immediate visual feedback if their design parameters are pushing the physical limits of the PVC or Poly pipes.

3. Immediate Updates (No "Calculate" Button)

Instead of a traditional "Enter numbers -> Press Calculate -> Show Result" flow, the app feels alive. Every input is tethered to a Zustand store (useCalculatorStore).

I created a custom hook, useHydraulics, that automatically derives the values (pressure loss, velocity, residual pressure) instantly bypassing the need for manual recalculation. Because there is no WatermelonDB or complex SQL persistence layer, reading from and saving to AsyncStorage is incredibly fast and avoids concurrency issues.

What I Learned

1. Typography matters for numerical tools. Using a monospace font (DM Mono) for all numbers (coupled with Sora for UI text) makes scanning data much easier. Aligning decimal points is built-in, preventing the UI from jittering when numbers change rapidly as users slide inputs.

2. RevenueCat makes one-time purchases trivial. Handling the discrepancies between Apple's App Store and Google Play billing is notorious. RevenueCat abstracted this completely, making the implementation of the $4.99 Pro unlock completely painless.

Try It

IrriCalc is the fastest way to size pipes and analyze pressure on the job site. Look for it on the App Store and Google Play!