Agrocylo is an Agro-DeFi platform. The aim is to make life easier for farmers (especially homegrown/urban), enabling exchange of agro-goods and services using an escrow system. It eliminates middlemen, allows peer-to-peer trade between farmers and consumers, and gives both parties access to Blockchain, Native DeFi, and Digital services.
Each purchase is secured using an escrow mechanism: funds are locked when a customer places an order and are released only after the buyer confirms receipt of goods. This guarantees protection for both parties while maintaining full user custody.
Configuration: docs/deployment/environment.md is the authoritative environment-variable reference for all four apps and the contract set, including secret-management and key-rotation procedures. Drift between each app's .env.example and its code is caught by scripts/check-env-drift.js in CI.
-
On-chain escrow settlement - Funds are locked in an escrow smart contract until buyers confirm receipt of goods.
-
Non-custodial payments - Users retain full control of funds at all times.
-
Peer-to-peer Farmer-Consumer Marketplace - Farmers sell directly to consumers without middlemen, retaining price control and increasing income.
-
Token-based payment - Supports stablecoin and token payments (USDC and XLM)
-
Buyer-confirmed settlement - Funds are never released to farmer/seller until the buyer confirms receipt of goods.
-
Unlimited parallel transactions - Unlimited concurrent trades can be carried out at a time, and each transaction is tracked by ID, time, status, amount, and associated addresses.
-
Order indexing by role - Buyers can view all their purchases and order statuses. Farmers can track incoming orders and pending payments.
-
Real-time updates and notifications - On-chain events are indexed and transmitted off-chain to deliver real-time order updates and notifications.
- Wider market reach and ease of payment - Small scale farmers face limited market access and fragmented payment systems.
- Post-harvest loss reduction - Farmers incure losses due to lack of storage facilities and limited market access
- Higher farmer profit and lower consumer cost - enabled by peer-to-peer interaction between farmer and consumer (Absence of middleman).
- Digital transformation of agriculture - price discovery tools, demand/supply aggregation tools to aid data-driven production.
a. Primary users * Farmers/Producers * Consumers/buyers
b. Secondary stakeholders * Platform operators: analytics, monitoring and support. * NGO’s, cooperatives or government programs promoting farmer inclusion
Escrow creation
Order lifecycle management
Dispute handling
Farmer dashboards
Consumer checkout & order tracking
Wallet integration
Event indexing
Notifications (email, push, in-app)
Analytics and reporting
Frontend (Web / Mobile)
↓ Smart Contracts (Escrow)
↓ Stellar Network
↓ Off-Chain Indexers & Notification Services
┌─────────────────┐ │ FRONTEND │ │ (Web/Mobile) │ └────────┬────────┘ │ ├ │ └---------─┐ │ ┌────▼───────────┐ │Smart Contracts │ │ (Soroban Rust) │----------─┐ └────┬───────────┘ | │ ┌────▼───────────┐ │ Backend | │ │ └────────────────┘
Network: Stellar Testnet
Smart Contracts: Rust (Soroban)
Frontend: Next.js (React)
Wallets: Freighter
Indexing: Custom event indexer / Subgraph-style service
Notifications: In-app (DB-persisted, delivered via REST API)
Enable swift, fair, and transparent trade
Found a vulnerability? Please report it privately — see SECURITY.md for scope, response SLAs, and how to reach us. Do not open a public issue for security findings.
Contributions are welcome! Whether you're fixing bugs, adding features, improving docs, or writing tests, your help is valued.
See CONTRIBUTING.md for:
- Local setup instructions per app (Rust contracts, Node.js backend, Next.js frontend)
- Pre-PR expectations (test requirements, Rust-specific checks like
cargo check, etc.) - Merge & review practices (especially important for Rust contracts holding real funds)
- Stellar Wave bounty workflow for external contributors
Quick start:
- Fork the repository
- Clone your fork:
git clone https://github.com/YOUR_USERNAME/Agrocylo-Global.git - Create a feature branch:
git checkout -b fix/issue-number - Follow the setup in CONTRIBUTING.md
- Open a PR referencing the issue(s) it closes
# Client unit tests (vitest + jsdom)
cd client && npm test
# Server unit tests (vitest + node)
cd server && npm run test:coverage
# Contract tests (Rust soroban-sdk)
cargo test --workspace
# Or test individual crates:
cargo test -p escrow
cargo test -p weather-insurance
cargo test -p registry
cargo test -p production-escrow-v2
cargo test -p investment-basket
cargo test -p governance# Run Playwright E2E tests
cd client && npm run test:e2e
# Run E2E tests with interactive UI
cd client && npm run test:e2e:uiE2E tests mock Freighter wallet and use NEXT_PUBLIC_DEMO_MODE=true for deterministic responses. See .github/workflows/e2e.yml for CI configuration.
The repository includes Docker Compose orchestration for containerized development and deployment. Note: This repo contains multiple app pairings (legacy server/client and current agro-production/server/agro-production/client), and the compose setup currently covers only the legacy pair.
Root docker-compose.yml (legacy server/client)
- Orchestrates PostgreSQL, Redis, and the backend service from
./server - Exposes backend on port 5000
- Recommended for: Contributors working on the legacy server/client apps
- Usage:
docker-compose up
agro-production/server/docker-compose.redis.yml (Redis only for agro-production)
- Standalone Redis service with persistent storage (
appendonlymode) - Exposes Redis on port 6379
- Currently not linked to a full app compose file — this repo's primary dev workflow for agro-production apps uses
npm run dev(see "Running locally" below) - Usage (if needed for production/staging deployments):
cd agro-production/server && docker-compose -f docker-compose.redis.yml up
For local development of agro-production/server and agro-production/client, see "Running locally" below — the recommended approach is npm-based development, not Docker.
The backend server (/agro-production/server) exposes product endpoints for the marketplace.
Get all products
GET /api/v1/products
Get product by ID
GET /api/v1/products/:id
Running locally
-
Navigate to the server directory:
cd agro-production/server -
Install dependencies:
npm install
-
Start the development server:
npm run dev
The server runs on
http://localhost:3001by default.
Environment Variables
For local development, no specific environment variables are required for product endpoints. The server uses in-memory seed data.
For production, ensure the following are configured (see .env.example):
NODE_ENV: Set toproductionDATABASE_URL: Supabase PostgreSQL connection string (for production data)CORS_ORIGINS: Comma-separated list of allowed origins