01
Overview
Farm2Fork connects farmers directly with buyers, with transporters handling delivery. It is organised as five repositories in a GitHub organisation — web, backend, mobile, blockchain and AI — and I am the lead developer across all of them.
02
System map
- 01
Web
Next.js · TypeScript
- 02
Backend
NestJS · MongoDB · Redis
- 03
Mobile
Flutter · Google Maps · FCM
- 04
Blockchain
Hyperledger Fabric · Go chaincode
- 05
AI
FastAPI · EfficientNet-B0
03
How it is built
- 01
Backend
A NestJS API on MongoDB and Redis with Firebase authentication, Swagger documentation, Docker Compose to run the whole stack locally, and end-to-end tests covering the payment and shipment flows.
- 02
Web
A Next.js app with separate routes for buyers, farmers and transporters, Firebase sign-in (including Google) and credentialed, HTTP-only backend sessions protected by a CSRF header.
- 03
Mobile
A Flutter app with Google Maps for farm pins, the checkout drop-off pin and transporter maps; transporters share location only while online with the app open, and Firebase Cloud Messaging delivers push notifications.
- 04
Blockchain
A Hyperledger Fabric network with Go chaincode that records payments (Stripe, JazzCash, Safepay) and supply-chain events such as listed, assigned, picked up, in transit and delivered. Writes are validated and idempotent, and the ledger can be queried by ledger key, reference or product.
- 05
AI
A FastAPI inference service that suggests an A–D quality grade from a photo of wheat, rice, mango or maize (EfficientNet-B0) for the farmer to confirm, plus a rule-based price-range estimate in PKR per unit.
04
Engineering notes
The AI grade is a suggestion the farmer confirms, not a certified assessment, and the price estimate is rule-based until a trained model is available — the documentation says so explicitly, and so does this page. A benchmark script measures ledger write throughput at different concurrency levels.
05
Beyond the code
The project also includes market research, competitor analysis and SWOT analysis to design a go-to-market strategy, with proposed pricing, positioning and promotional plans aimed at market penetration and customer acquisition.
06
Stack
- NestJS
- MongoDB
- Redis
- Next.js
- TypeScript
- Flutter
- Firebase Auth
- Hyperledger Fabric
- Go chaincode
- FastAPI
- Docker