Module 5
Sustainability Programs
Purpose#
Defines, delivers, and evidences sustainability interventions across the farmer base. Program data contributes to EUDR compliance evidence packages — demonstrating that the organisation is actively supporting farmers in maintaining sustainable practices.
Program hierarchy#
Program Type (template — seeded per org at setup)
└── Program (instance of a type, with dates, geography, and farmers)
└── Activity (a specific event: training session, distribution, audit)
├── Attendance (list of farmers who attended)
├── Input Distribution (inputs given to farmers)
└── Evidence (photos, documents uploaded to R2)System program types#
Seven program types are seeded per organisation at setup. Custom types can be added.
| Type | Description |
|---|---|
| GAP | Good Agricultural Practices — training and practice adoption. |
| CLMRS | Child Labour Monitoring and Remediation System. |
| VSLA | Village Savings and Loan Associations. |
| Certification | Fairtrade, Rainforest Alliance, Organic — preparation and maintenance. |
| Agroforestry | Tree planting and shade management programs. |
| Water & Sanitation | WASH programs for farming communities. |
| Gender & Youth | Inclusion and capacity-building programs. |
Activities#
| Activity type | Key fields |
|---|---|
| Training session | Date, location, facilitator, topic, attendance list, photos. |
| Input distribution | Date, input type, quantities per farmer, distribution point. |
| Field audit | Date, auditor, checklist scores, findings, photos. |
| Community meeting | Date, agenda, attendance, minutes (file upload). |
| Custom | Configurable per program type. |
Evidence files#
Photos and documents are uploaded to Cloudflare R2 via presigned URLs. The API generates a presigned upload URL on request; the client uploads directly to R2 and sends back the file key. This keeps evidence files out of the API payload and allows large files.
Coverage metrics#
The coverage API aggregates program participation across the geographic hierarchy: % of farmers enrolled in a given program type, by community → district → region → org. Displayed on the Sustainability Programs dashboard view.
Packages#
| Package | Type | Key exports |
|---|---|---|
@repo/feature-sustainability-programs | Backend | Services: program-type, program, activity, attendance, input-distribution, coverage, evidence (presigned URL) |
@repo/feature-sustainability-programs-web | Frontend | Program CRUD, activity forms, attendance recording, input distribution, coverage chart |
API routes#
| Route | Notes |
|---|---|
| /api/program-types | CRUD for program type templates. |
| /api/programs | CRUD for program instances. |
| /api/activities | CRUD for activities under a program. |
| /api/attendance | Bulk attendance recording. |
| /api/input-distributions | Record input distributions. |
| /api/coverage | Aggregate coverage statistics. |
| /api/evidence | Generate presigned R2 upload/download URLs. |