Saqi

An irrigation planner for a farm near Al Ain, UAE: every evening it says how much water each block needs tonight, and shows why, in English or Arabic.

Today screen: tonight's plan for Saturday 14 November, 272.9 m³ with 62 m³ saved against a fixed schedule. A map of the farm's seven blocks shows water running to D-1 and F-1 and D-3 hatched for a quiet sensor, above a night schedule with D-1 from 22:00 to 00:49 and F-1 from 00:49 to 05:00.
Today · live forecast
Block D-1, Khalas palms: Irrigate 84.3 m³, 700 litres per tree, 22:00 to 00:49 GST, confidence High. The Why list reads: soil water now 68%, ET₀ tomorrow 4.3 mm, 68% to 62.4% by tomorrow, below the 65% threshold, refill to 90% with 19.9 mm into the soil and 23.4 mm through the pipes.
Block D-1 · Why
Field screen in Arabic, laid out right to left: Rahim's 4 tasks for Saturday 14 November, such as recording the level of tank T-1 at 06:00 and clearing the bubblers in row 4 of D-1, each with a large Mark done button.
Field · Arabic
Role
Solo project: design and engineering
Year
2026
Stack
React 19 · Vite · TanStack Query · GSAP · react-i18next · zod · Hono · Open-Meteo · Vitest · Playwright and axe · GitHub Actions · Vercel
Live
saqi.spindyzel.com ↗

The problem

A fixed irrigation schedule gives each block the same water every night, whether the soil is still wet or the day was hot. In the desert that wastes water, and the farm has a monthly allocation to stay inside.

Saqi plans each night from the soil and the weather instead, and shows its working. The farm, Farm 07 near Al Ain, is fictional and its soil sensors are simulated, and the app says so on screen. The weather is real: the forecast and ET₀, the water the air pulls out of soil and plants in a day, come live from Open-Meteo.

What it does

  • Tonight on one screen. Today shows the farm's seven blocks on a map: four date-palm blocks, two greenhouses and a fodder field. It says how much water runs tonight, when each block runs, and how much that saves against the fixed schedule.
  • Every number has a reason. A block's page lists why it gets its water: soil water now, tomorrow's ET₀, where the soil will be by tomorrow, the threshold it falls below and how much it takes to refill.
  • A phone screen for the field crew. Field lists each worker's tasks for the day with large Mark done buttons. Without signal, a done task waits on the phone and is sent when the connection returns.
  • English and Arabic. Arabic mirrors the whole layout from right to left. Numbers stay in Western digits, so a figure reads the same in both languages.
  • It admits what it does not know. A sensor that has been quiet for more than 3 hours is marked on the map and drops its block's decision to low confidence. When Open-Meteo does not answer, the app shows the last forecast it has and marks it out of date.

Decisions

The engine is a pure function

planDay in the @saqi/engine package takes the farm, the latest readings, the forecast, the budget and the current time, and returns tonight's plan. It reads no clock, network or database, so the same input always gives the same plan. It runs four steps in order: soil water per block, a decision per block, the monthly budget, then the night schedule. Many of its 56 tests are tables of inputs and expected results.

The reasons are the maths

The screenshot of D-1 above is the engine's own working. Its soil holds 72 mm of water the palms can use. Tomorrow the palms use 4.1 mm, which takes the soil from 68% to 62.4%, under the 65% threshold. So the engine refills it to 90%: 19.9 mm into the soil, 23.4 mm through bubblers that are 85% efficient, over the 30% of 1.2 ha they wet. That is 84.3 m³, or 700 litres for each of the 120 trees.

Each step leaves the engine as a code with its numbers, such as REFILL_TO_TARGET with the target, net and gross millimetres. The app turns the codes into sentences in the reader's language, so the engine has no text to translate.

Fodder is cut first

The budget step projects the month's water at the average ET₀ of the week ahead. If the farm would go over its allocation, fodder blocks that need water get 70% of it. If it would still go over, the palms get 85%. The greenhouses are never cut.

The pump and the night set the schedule

Runs go into the night window, 22:00 to 05:00, highest priority first and then the driest block first. Each run starts at the earliest time the 60 m³/h pump can carry it for its whole length. A run that cannot finish before 05:00 is shortened, and its decision says by how much. In the screenshot, F-1 needs 45 m³/h, so it cannot run beside D-1's 30. It waits for D-1 and stops at 05:00.

One contract, checked at both ends

zod schemas in a shared package describe every request and response. The web app parses every API answer with the same schema it was written against. Outside production, the API checks its own answers too, so a broken contract fails a test before it breaks a screen. Every error has one shape with five codes.

A task update carries the time of the copy it was based on. If someone changed the task since, the API answers 409, and the phone drops its queued change and takes the server's version.

Right to left from the start

The layout uses CSS logical properties, such as start and end instead of left and right, so Arabic mirrors without a second stylesheet. Time axes and animations follow the reading direction, and the farm map keeps its real geometry. A test fails when an Arabic string is missing, uses different placeholders from the English one, or was left in English.

Shipping

Every push to the public repository runs a design check, lint, type checks, 363 unit and API tests and a build. Then 27 Playwright tests run inside the same Docker image that drew the visual baselines, so screenshots compare on the same browser and fonts. They include axe accessibility scans of five pages in English and Arabic, a keyboard-only journey, the offline Field journey, and visual snapshots of Today and Field in both languages.

The tests run against the in-memory API with a frozen clock and recorded weather, so the pipeline needs no secrets. Vercel builds the web app and the API from main.

Limits

  • There is no database yet. The data layer has one interface and a contract suite written for every implementation, but only the in-memory version exists. The Postgres version is a stub that throws, and its run of the suite is skipped. Production keeps its data in memory, so a task marked done lives in one server instance and can reset when Vercel starts a new one.
  • The agronomy is not field-tested. The soil, crop and threshold values were set for this demo, not measured on a real farm.
  • The Arabic was written with machine help and has not been reviewed by a native speaker.
  • Today is slow on a phone. Lighthouse's mobile test gives it 60 to 65 for performance, because the screen paints nothing until its code loads, and the plan panel shifts as the page fills in.