Skip to content

🚀 AgriTrust connects farmers, buyers, and drivers through blockchain-verified transactions—transparent payments, real-time delivery tracking, and immutable supply-chain records powered by Ethereum.

Notifications You must be signed in to change notification settings

dianaangan/AgriTrust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AgriTrust 🌾

Blockchain-driven agricultural supply-chain platform connecting rural farmers, buyers, and delivery drivers.

Node.js Expo MongoDB Stripe Ethereum License

AgriTrust empowers rural farmers by connecting them directly to buyers and drivers through transparent, blockchain-verified transactions—enabling secure payments, real-time delivery tracking, and complete supply-chain visibility from farm to customer.

Overview

AgriTrust is a full-stack platform with a Node.js backend and three Expo mobile apps (Buyer, Driver, Farmer). It enables seamless product ordering, delivery tracking, and blockchain-anchored transaction auditability for rural farming communities.

Key capabilities:

  • Buyers browse products, checkout, and track deliveries
  • Drivers manage assignments, deliveries, and proof-of-delivery
  • Farmers manage inventory, accept orders, and process payouts
  • Blockchain anchoring for critical transaction events (Sepolia testnet)
  • Payment integration via Stripe and Nodemailer notifications

Tech Stack

  • Backend: Node.js + Express
  • Mobile: Expo / React Native
  • Database: MongoDB
  • Cache & Messaging: Upstash Redis
  • Payments: Stripe
  • Blockchain: Ethereum (Sepolia) with smart contract integration
  • File Storage: Cloudinary + Multer

Quick Start

Prerequisites

  • Node.js 16+ and npm
  • Expo CLI: npm install -g expo-cli

Install & Run

# Clone and navigate
git clone <repo-url> AgriTrust
cd AgriTrust

# Backend
cd backend
npm install
npm run dev

# Mobile apps (each in new terminal)
cd ../buyer-mobile && npm install && expo start
cd ../driver-mobile && npm install && expo start
cd ../farmer-mobile && npm install && expo start

Notes:

  • Backend defaults to PORT=5001 and binds to 0.0.0.0
  • Apps read API URL from constants/config.js
  • Backend scripts: npm run dev (nodemon), npm start (production)

Project Structure

backend/
  ├── src/
  │   ├── controllers/     # HTTP handlers
  │   ├── services/        # Business logic & blockchain helpers
  │   ├── models/          # Mongoose schemas
  │   ├── routes/          # API endpoints
  │   ├── middleware/      # Auth, rate-limit, validation
  │   ├── config/          # Configuration
  │   └── utils/           # Utilities
  └── scripts/
      └── viewBlockchainData.js  # Blockchain inspection tool

buyer-mobile/
  ├── app/                 # Screens & navigation
  ├── components/          # UI components & toasts
  ├── contexts/            # App state (CartContext, RegistrationContext)
  └── utils/constants/     # API wrappers, color scheme, config

driver-mobile/
  ├── app/                 # Screens & navigation
  ├── components/          # UI components
  ├── contexts/            # Driver registration state
  └── utils/constants/     # API, config, navigation guards

farmer-mobile/
  ├── app/                 # Screens & navigation
  ├── components/          # UI components
  ├── contexts/            # State management
  └── utils/constants/     # Helpers & config

API Routes (Backend)

  • /api/products — Product listings
  • /api/orders — Order lifecycle & checkout
  • /api/transactions — Transaction records & blockchain status
  • /api/delivery-jobs — Delivery assignments
  • /api/driver-delivery-records — Delivery proof & history
  • /api/notifications — Notifications & alerts
  • (Auth, rate-limiting, file uploads handled by middleware)

Blockchain Integration

Key transactions (order acceptance, processing, ready-for-delivery) are anchored to Sepolia smart contract.

Inspect on-chain data:

# View transaction by MongoDB ID
node scripts/viewBlockchainData.js <transactionId>

# View by transaction hash
node scripts/viewBlockchainData.js --txHash 0x...

# View contract address
node scripts/viewBlockchainData.js --contract

Configuration

Backend (.env)

PORT=5001
NODE_ENV=development
JWT_SECRET=your_jwt_secret_here
MONGODB_URI=mongodb://localhost:27017/agritrust
LEDGER_CONTRACT_ADDRESS=0xYOUR_CONTRACT_ADDRESS

Mobile Apps

Configure API endpoints in constants/config.js for each app.

Architecture Patterns

  • Backend: Layered (controller → service → model)
  • Mobile: Component + Context pattern for state management
  • Data flow: Services handle business logic; screens render and navigate

Contributing

  1. Branch: git checkout -b feature/your-change
  2. Test locally and follow existing code style
  3. Submit PR with clear description

License

Private repository. Contact the project owner for licensing details.

👤 Author & Collaborators

Author: Diana Angan
GitHub: @dianaangan

Collaborators:

🙏 Acknowledgments

  • Built with modern Node.js and React Native best practices.
  • Inspired by clean, modular architectures for scalable mobile and backend systems.
  • Blockchain integration powered by Ethereum smart contracts for immutable transaction records.
  • Thanks to everyone who provided feedback on UX, delivery workflows, and notification behavior.

⭐ If AgriTrust helps you streamline agricultural supply chains, consider starring the repository!

About

🚀 AgriTrust connects farmers, buyers, and drivers through blockchain-verified transactions—transparent payments, real-time delivery tracking, and immutable supply-chain records powered by Ethereum.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •