# FarmLink — A Web-Based Direct Trade Platform for Smallholder Farmers
FarmLink connects smallholder farmers directly with buyers (retailers, restaurants,
wholesalers, and individual consumers), removing intermediary layers, improving price
transparency, and giving both sides a trustworthy, trackable trading channel.
```
farmlink-app/
├── backend/ Node.js + Express + PostgreSQL REST API
├── frontend/ React + Vite + Tailwind web application
├── docker-compose.yml Optional: spins up PostgreSQL for you
└── screenshots/ Screenshots of the running app (for Chapter 5 of the dissertation)
```
## What's new in this version
This build hardens the earlier prototype into something that could face real users.
Alongside the PostgreSQL migration, messaging, notifications, image uploads and farmer
verification, this round added:
1. **Security hardening** — helmet headers, layered rate limiting, per-account and per-IP
brute-force lockout, and a proper session model: short-lived (15 min) access tokens
plus rotating, revocable refresh tokens in an httpOnly cookie, with reuse detection.
2. **Pagination everywhere** — marketplace, farmer listings, orders, messages,
notifications and every admin list, with filter/sort applied across the whole result
set and stable ordering so rows never repeat or vanish between pages.
3. **Order resilience** — idempotency keys so a retry after a dropped connection cannot
double-order, row-level locking so two buyers cannot oversell the last of the stock,
and a reconciliation endpoint for recovering from an unknown outcome.
4. **Deployment** — Dockerfiles for both services, nginx reverse proxy, dev and
production Compose files, and a boot-time configuration guard that refuses to start
production with unsafe settings. See DEPLOYMENT.md.
5. **SMS notifications** alongside email, with a console fallback so the path is
exercisable without a provider account.
6. **Farmer analytics** — revenue over time, best-earning crops, demand …