Skip to content
Edson Francisco
  • Offline-first field systems
  • AgriTech & traceability

FAMS – Farmer & Agent Management System

Laravel platform for agribusinesses to manage farmers, field purchases, stock and processing — with an API for the offline field app.

Period
2021–2026
Status
In production
Role
Co-founder and technology & product manager; largest contributor to the Laravel backend, the mobile API and CI/CD
Partners
GIZ, NIRAS, COMO Consult

Problem

Agribusinesses working with thousands of smallholders managed registrations, weighings, input credit and payments on paper and in Excel. Field staff work in areas without coverage, and funders asked for reports nobody could produce on time.

Solution

A central Laravel web system with core modules and per-company plugins: farmers, agents, purchases, stock, processing, M-Pesa payments and traceability. The same backend exposes the API the team's Android app uses to work offline and sync. Edson is the largest author of the API, migrations, views, tests and deploy workflows.

Context: a system born in a GIZ programme

In 2020 GIZ decided to build farmer-management software for the partner companies of its ProEcon, ProMove and GIAE programmes, after assessing around 20 companies. FAMS officially launched at the end of February 2021.

The problem was the same everywhere: farmer registries, weighings, input credit and payments on paper or in Excel, handled by field staff in areas without coverage, and reports that were hard to consolidate for funders.

An agricultural extension guide published by NIRAS for GIZ describes FAMS as a platform developed by the Mozambican NGO Empoderando, with GIZ support, for companies to record and analyse data on farmer training, input sales and produce purchases. In the Kulima ndi Malonda pilot (2022–23), Luteari used FAMS to collect baseline data and technicians' notes after each training session.

Edson has worked on the backend since May 2021 and has been the product's technical lead ever since: code, review of the team's contributions, architecture decisions and deployment.

Architecture: Laravel backend and an API for the field app

FAMS has two parts. The Laravel web backend is the central system used in offices and factories. The Android app, built with Ionic, Angular and Capacitor, is used by field staff. The mobile app and an Electron desktop wrapper were written by teammates; Edson's part is the server and the API they consume.

The app stores everything locally and sends it when the network returns: farmers, surveys, trainings, purchases, stock and payments. On the server, the v1 API uses Sanctum tokens, rate-limits login and OTP, and records each device's last sync. Edson wrote most of the commits in routes/api.php and in the API controllers.

The data model grew to 220 migrations and 88 models, with 18 PDF and Excel exports (purchase ledger, traceability, credit) and auditing on 83 models.

Plugins: from input credit to honey traceability

Every client has a different value chain, so the core (farmers, agents, fields, surveys) is shared and the rest are plugins: Stock, Purchases, Inputs, Factory, ePayment with bulk M-Pesa B2C, SMS and visits. Terminology also changes per client, through layered translation files.

The newest plugin is honey traceability: filling records, honey formats, comb and finished-product stock, a purchase ledger and a signed PDF production report. Edson built it in 2026.

Release engineering: changelog, CI/CD and tests

Every version is recorded in changelog.json, in Portuguese and English: 99 web releases, from v10 (April 2021) to v114 (September 2026), and 14 mobile releases. The same file feeds the public changelog page on the website.

The GitHub Actions workflows are almost all Edson's: main goes to the test server, production to client servers, with maintenance mode and automatic migrations. The repository has 61 PHPUnit test files, and Edson is the largest author in the tests folder.

From one server per client to multi-tenant SaaS

Until 2026 each client had its own installation, which made small cooperatives and companies expensive to serve. FAMS Mahala puts many companies in one database, separated by company_id, with a free plan and a path to paid plans.

The multi-tenant base (an Eloquent global scope) was written by a colleague. Edson took the deploy branch to production: per-company Spatie roles, replacing Company::first() with the authenticated user's company in controllers and exports, plan limits with tests, and self-service company sign-up.

What's next (proposal): an offline-first PWA

The current mobile app runs on Angular 11 and Ionic 5, which are hard to maintain. Edson wrote an architecture proposal for a Next.js PWA with IndexedDB, cursor-based pull and outbox push sync, idempotent events and version-based conflict detection.

It is only a proposal: three design documents and a monorepo skeleton, with no application code. The MVP scope is farmers, agents and field purchases.

Technical decisions

  1. 01

    Shared core + plugins switched on per company

    Stock, Purchases, Inputs, Factory, ePayment, SMS and honey traceability live in separate plugin controllers, with Spatie permissions per plugin. Each client enables only what it uses, with no per-client code branches.

  2. 02

    Sanctum-based v1 API that records the last sync

    The field app authenticates agents and members with Sanctum tokens, with rate limits on login and OTP. A middleware stores each device's last sync, so the office can see who is behind.

  3. 03

    Auditing on all operational data

    83 models implement Auditable (owen-it/laravel-auditing). For purchases and farmer credit you need to know who changed what, and when.

  4. 04

    Branch-based deploys with GitHub Actions

    main deploys to the test server and production to client servers, via a script that runs artisan down, composer --no-dev, migrate --force and up. The same code serves several client deployments.

  5. 05

    Error alerts in Microsoft Teams

    Instead of running an observability stack, production errors go to a Teams channel through a Composer package Edson maintains (laravel-teams-logging).

Images

01 / 07 — FAMS — direct data input in the field: onboarding new farmers, recording purchases and inputs, verified at headquarters

Videos

  • What FAMS is: vision and benefits, presented by Edson Famanda, system manager (Portuguese) · 0:39
  • What FAMS is: vision and benefits, presented by Edson Famanda, system manager · 0:40
  • FAMS presentation video: field, headquarters, SMS, maps and reports · 2:01
  • Edson presents FAMS · 0:58

Technologies

  • Laravel
  • PHP
  • MySQL
  • Bootstrap
  • JavaScript
  • GitHub Actions
  • M-Pesa
  • Ionic
  • Angular
  • Capacitor

Verifiable results

farmers digitised, 50.5% of them women
55 422
in income paid to farmers (MZN 97.6 million)
US$ 1 526 984
total purchase value recorded in FAMS
US$ 1 775 361
inputs distributed and tracked, in 343 distributions to 321 farmers
10 126
of cultivated land recorded
26 199 ha
value chains (copra, cotton, maize, soy, honey, livestock…) across 7 provinces
9 · 7
versions in the product changelog (v10 → v114)
99
PHPUnit test files
61
database migrations
220
documented mobile app versions (v50 → v103)
14
FAMS named as the farmer registration and monitoring tool in the Kulima ndi Malonda guide
KnM
niras.com (opens in a new tab)

What I learned

Keeping a product alive for more than five years takes boring discipline: a changelog for every version, automatic branch deploys, and tests for the business rules that hurt most, such as seasonal credit.

SDGs

  • SDG 2 · Zero Hungerprimary

    Georeferenced registration and follow-up of smallholders, production monitoring, tracked input distribution and on-site trainings (targets 2.3 and 2.4).

  • SDG 8 · Decent Work and Economic Growthprimary

    Digitised operations in cooperatives and agribusinesses, with accurate and transparent weights and payments, less fraud and lower administrative costs (8.2, 8.3, 8.10).

  • SDG 9 · Industry, Innovation and Infrastructureprimary

    Web and mobile apps that work offline, linking farmers, collection points, warehouses and factories, plus an API for integration with other systems (9.3, 9.4, 9.c).

  • SDG 12 · Responsible Consumption and Productionprimary

    Stock, movements and traceability from farmer to factory, with auditable data for certifications and to cut losses along the chain (12.3, 12.6).

  • SDG 1 · No Povertycomplementary

    Farmer income and financial records kept in the system, with a history of purchases, input credit and payments.

  • SDG 5 · Gender Equalitycomplementary

    Gender-disaggregated data where the client collects it; in the FAMS impact dashboard, about half of the farmers digitised are women.

  • SDG 10 · Reduced Inequalitiescomplementary

    Inclusion of previously informal farmers and offline operation in areas without coverage, with planned sync once the connection returns.

  • SDG 16 · Peace, Justice and Strong Institutionscomplementary

    Auditable weighings, purchases and payments, with per-company users, roles and permissions and a full history for accountability.

  • SDG 13 · Climate Actioncomplementary

    An enabling contribution only — field data collection and SMS communication. FAMS has no climate features of its own yet.