Technical & operational architecture

How Farmso is built and run: web + mobile clients, the Cloudflare Workers backend, D1/R2 storage, Solana anchoring, passwordless auth, offline sync and multi-environment operations.

Updated 2026-07-12 · 8 min

Farmso is a modern, edge-native platform. The clients are thin and fast; the logic and data live on Cloudflare’s global network; and trust-critical records can be anchored on a public blockchain. This page explains the technical design and how the platform is operated.

System overview

Clients

Web app
React + TanStack · Cloudflare Pages
Mobile app
Expo / React Native · offline-first · EAS

Edge API

Farmso API — Cloudflare Workers + Hono + Drizzle
Passwordless JWT auth · per-organisation isolation · plan-based feature gating

Data & services

D1
SQLite at the edge
R2
Documents · photos · exports
Solana
pet_did on-chain anchoring
AWS SES
One-time login codes · email
Stripe
Billing · metered AI usage
Queues & Cron
Anchoring · scans · billing jobs

The pieces

Web app

React + TanStack Router/Query, built with rsbuild/Vite, deployed to Cloudflare Pages. The back-office: dashboards, compliance, invoicing, analytics.

Mobile app

Expo / React Native (offline-first), delivered via EAS to iOS and Android. Camera + Bluetooth EID + NFC capture, with a local outbox that syncs.

Backend (cf-back)

Cloudflare Workers + Hono + Drizzle ORM. A single API for web and mobile, with per-request organisation isolation and plan-based feature gating.

Database — D1

Cloudflare D1 (SQLite at the edge). Versioned migrations; separate dev, staging and prod databases.

Files — R2

Cloudflare R2 object storage for documents, inspection photos, labels and exports.

On-chain — Solana

The deployed pet_did Anchor program anchors a hash of each animal’s record; Farmso manages the keys so users never touch wallets.

Authentication & tenancy

Sign-in is passwordless: AWS SES emails a one-time code, and on success the backend issues its own signed JWT (no third-party identity provider). Every request carries the token plus the active organisation, and the API scopes all data to that organisation — one tenant can never see another’s records. Feature access is gated by the organisation’s subscription plan, checked on the server, so the same rule applies whether a request comes from the web or the mobile app.

Offline-first sync

The mobile app is built for places with no signal. Reads are served from an on-device cache; writes (registering an animal, recording a treatment, a scan, an inspection) are placed in a local outbox and returned as “queued”. When connectivity returns, the outbox flushes automatically — scans replay as one idempotent batch so nothing is duplicated, and any conflicts are surfaced rather than silently dropped. You can watch and manage this in the app’s Pending Changes screen.

Operations

Farmso runs three isolated environments — development, staging and production — each with its own database, storage bucket and API host (production is api.farmso.org). Code flows through pull requests into staging and then to the main branch. Background work (blockchain anchoring, nightly anomaly scans, monthly AI-usage billing, certification expiry) runs on Cloudflare Queues and scheduled cron triggers. Billing and metered AI usage are handled through Stripe.

Security posture: signed JWTs, strict per-organisation data isolation, server-side plan enforcement, encrypted transport (HTTPS) everywhere, and optional public-blockchain tamper-evidence for the records that matter most.