Small and mid-size livestock farms have no purpose-built software for herd records, expense tracking, and investor reporting — generic tools don’t fit the domain, and the original single-tenant app (FarmHub) needed a real multi-tenant rearchitecture to scale beyond one farm.
Shared-database multi-tenancy with PostgreSQL Row-Level Security as a defense-in-depth backstop over existing app-level farm_id filters — production runs as a least-privilege, non-superuser Postgres role so RLS is actually enforced, not just declared. Global account identity with a tenant-picker for multi-farm users, plan entitlements resolved as named features rather than hardcoded tier checks, and revocable server-side refresh tokens with rotation and reuse detection in place of long-lived JWTs. The marketplace sits on its own database with real-time messaging over SignalR, where the hub only fans out — every send stays one authenticated write path.
Live in production. RLS-enforced tenant isolation, Google/Microsoft SSO, three subscription tiers with billing enforcement and branded PDF invoicing, herd performance analytics (mortality, average daily gain, conception and kidding rate), a marketplace with buyer/seller chat, and an automated reminder engine for vaccinations due and monthly summaries — with releases verified end to end against production, not just in CI.