Case study · In progress · Nov 2026 · Google Play closed testing← All work

AYN — maintenance management for multi-site operations

Multi-tenant maintenance management (CMMS) with an offline-first field app, an SLA clock with escalation, and tenant isolation enforced by the database.

  • NestJS
  • Drizzle ORM
  • PostgreSQL
  • React
  • Expo (React Native)
  • TypeScript

Specified, directed and verified by me; built by AI coding-agent teams under written governance · Own account · Riyadh

What it is

AYN is maintenance management for companies that run many sites: sites, buildings, fleets. Supervisors raise and route tickets on the web, technicians work them on an Android app that keeps going without signal, and every ticket carries an SLA clock that escalates on its own. The whole system is multi-tenant: many companies on one deployment, each one unable to see the others.

How it works

A NestJS API with Drizzle ORM on PostgreSQL, a React web app and an Expo (React Native) mobile app share one typed contracts package, in Arabic and English with right-to-left layouts. Tenant isolation is a database property: forced row-level security on the tables that hold tenant data. The integration suite runs on a real PostgreSQL; backups run every six hours and were restored in a drill; a fresh server is deployed in just over a minute; and app updates reach installed phones over the air.

The system was specified and directed by me and built by teams of AI coding agents under written rules. AYN is the first system built with REBIRTH, a method for re-engineering older software with agents.

Verify it yourself

Live demo — on request
Silent walkthrough of one fault: the station reports it from a phone, it is assigned, a technician works it offline and syncs, an escalation fires, and the asset owner approves it; then the architecture. Demo data.

Short clips

  • Technician app
  • Web operations
  • Reports
  • Admin and settings
  • 58 / 76tables carry tenant data under forced PostgreSQL row-level security; the rest are globalSource: apps/api/src/db/schema.ts; apps/api/migrations/*rls*.sql
  • ≈ 4.5 minintegration suite on a real PostgreSQL, down from 15–24 minutesSource: NOW.md (2026-11-18)
  • 77 / 77tables matched in a real restore drill; backups run every six hoursSource: docs/guides/production.md; NOW.md
  • 77 sto deploy to an empty serverSource: NOW.md
  • ≈ 1.5 minfor an over-the-air update to reach installed phones, without a store releaseSource: .github/workflows/mobile-build.yml
  • PassedGoogle Play review; the Android app is live on closed testingSource: NOW.md (Google Play)

I will walk you through the code and the decision log on a call.Ask for a walkthrough

Three decisions

01

Tenant isolation enforced by the database, not the code

What I chose

Forced row-level security on every table that holds tenant data; the API sets the tenant for the connection and PostgreSQL refuses the rest.

Why

A missed filter in one query is the classic multi-tenant leak. With the policy in the database, the mistake has to be in the policy, which is one place to review. The cost: every test runs against a real PostgreSQL.

02

The field app works without signal

What I chose

The technician's actions go into an on-device outbox and sync when the network is back, with a cursor on both sides.

Why

Maintenance happens in basements, rooftops and remote sites. An app that needs signal to close a ticket gets closed on paper instead.

03

An SLA clock with a three-step escalation ladder

What I chose

Every ticket carries a clock; two warnings at set shares of the SLA, then overdue, each escalating to the next person.

Why

A late ticket that nobody noticed is worse than a late ticket. The ladder makes "who should have acted" a fact, not an argument.

Architecture

Web app · Reactsupervisors · tickets · SLATechnician app · Expooffline outbox → syncover-the-air updatesAPI · NestJSshared typed contractsSLA clock · escalation ladderper tenantPOSTGRESQLRow-level security · forced58 of 76 tables hold tenant dataTenant A · Tenant B · …each unable to see the othersBackups every 6 hrestore drill matched 77 of 77Fresh server in 77 sintegration suite ≈ 4.5 min

Web app (React) and technician app (Expo, with an outbox) → API (NestJS, shared typed contracts) → PostgreSQL with row-level security per tenant; SLA clock and escalation on the API; over-the-air updates to installed phones.

Method — Written specification, numbered decisions, agents with bounded scope, bounded review rounds, live verification before each release.

What I would change

  • There is no read-only role yet, so the demo is on request; a public demo tenant that resets itself would let anyone try it.
  • Closed testing is not a public release yet; the open track is the next milestone.