AgroShield is a trustless crop treatment marketplace connecting farmers with local agronomists. It features AI-powered crop diagnosis, and an escrow system built on the Stellar Testnet (using Trustless Work) to ensure funds are only released when treatment is confirmed delivered.
- AI Crop Diagnosis: Farmers upload photos of sick crops. Our AI instantly identifies the disease and recommends treatments.
- Vendor Marketplace: Agronomists and pesticide vendors bid on cases locally.
- Trustless Escrow: Built on the Stellar Testnet. Payments are held in a smart contract and released only upon successful treatment confirmation.
- Dispute Resolution: Built-in flow to mediate issues without unfair losses.
- Role-based Dashboards: Separate views and flows for Farmers and Vendors.
Follow these instructions to clone, set up, and run AgroShield on your local machine.
Ensure you have the following installed:
- Node.js (v18+)
- npm or yarn
- PostgreSQL database (Local or Cloud, e.g., Supabase/Neon)
- Freighter Wallet Extension (For Stellar Testnet transactions in the browser)
- Ollama (Local AI instance, optional but recommended for testing diagnosis)
git clone https://github.com/shogun444/Agroshield.git
cd Agroshieldnpm installCopy the provided example or create a new .env file in the root directory:
# Database
DATABASE_URL="postgresql://user:password@localhost:5432/agroshield?schema=public"
# Authentication (Generate a random string for this)
JWT_SECRET="your-super-secret-jwt-key"
# AI Diagnosis (Ollama - Local)
OLLAMA_BASE_URL="http://localhost:11434"
OLLAMA_MODEL="gemma4:31b-cloud"
# AI Diagnosis (Gemini - Cloud Fallback)
GEMINI_API_KEY="your-gemini-api-key"
# Stellar Network Config
NEXT_PUBLIC_STELLAR_NETWORK="testnet"AgroShield uses Prisma ORM. First, push the schema to your database to create the necessary tables, then generate the client.
# Push the schema to your database
npx prisma db push
# Generate the Prisma Client
npx prisma generatenpm run devOpen http://localhost:3000 with your browser to see the result.
AgroShield uses real on-chain transactions on the Stellar Testnet for demo purposes. To test the complete flow:
- Install the Freighter wallet extension in your browser.
- In Freighter settings, switch your network to Testnet.
- Create an account and fund it using the Stellar Laboratory Testnet Faucet.
- You will need Testnet USDC and a small amount of XLM (for gas/fees) to accept bids and sign transactions.
- In the app, when you accept a bid as a farmer, Freighter will pop up to sign the escrow creation transaction.
app/— Next.js App Router (Pages, API routes, Layouts)api/— Backend logic (Auth, Cases, Disputes, Escrow, AI)farmer/&vendor/— Role-specific dashboards
components/— Reusable React components (UI elements, Layout, Vendor cards)lib/— Utility functions (Prisma client, Gemini/Ollama wrappers, WalletKit integration)prisma/— Prisma schema (schema.prisma) and migrations
AgroShield uses a premium, warm, minimal editorial aesthetic:
- Fonts:
Manropefor headings (bold, punchy),Interfor body copy. - Colors: Off-white/Beige backgrounds (
#F5F0EB,#f8f5f2), crisp dark grays (#171717), and distinct functional accents (Emerald Green for success/trust, Red for high-risk warnings). - Animations: Powered by
motion/reactfor smooth section reveals and accordion transitions.
npm run dev: Starts the local development server.npm run build: Creates an optimized production build.npx tsx scripts/cleanup-escrows.ts: Cleans up mock/demo escrows from the database to reset your testing state.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request