Ana içeriğe geç
Versiyon: 1.1.0

Agrinet Engine Quickstart

Get the Agrinet Engine running quickly for local demos, QA sessions, or onboarding new operators. This guide highlights system dependencies, install steps, and core capabilities available across the marketplace, communications, and federation layers.

System Requirements

ComponentVersionNotes
Node.js≥ 20.0Required by backend services and the Docusaurus docs site.
npm≥ 9Ships with Node 20.
DynamoDB LocalOptionalEnables offline testing of persistence flows.
Redis / BullMQ storeOptionalNeeded when exercising background workers.
Twilio accountOptionalRequired for SMS integrations.

Install the documentation site dependencies with:

npm install

Key runtime packages and versions are tracked in package.json:

PackageVersion
@docusaurus/core3.9.2
@docusaurus/preset-classic3.9.2
react / react-dom19.0.0
leaflet1.9.4
react-leaflet5.0.0

Environment Variables

Create a .env file in the backend project with the following baseline keys:

PORT=5000
JWT_SECRET="super-secret"
API_KEY="da2-example"
AWS_REGION="us-east-1"
AWS_ACCESS_KEY_ID="local"
AWS_SECRET_ACCESS_KEY="local"
DYNAMODB_ENDPOINT="http://localhost:8000"
STRIPE_KEY="sk_test_..."
TWILIO_ACCOUNT_SID="AC..."
TWILIO_AUTH_TOKEN="..."
TWILIO_SMS_NUMBER="+15551234567"
NEXT_PUBLIC_BACKEND_URL="http://localhost:5000"

Load the environment and start the services:

# backend
npm install
npm run dev

# frontend
cd frontend
npm install
npm run dev

For docs and SDK previews:

npm run start

Core User Flows

  1. Register a user with POST /userRegistration to obtain profile and role metadata.
  2. Create inventory through /products and /listings endpoints or the marketplace UI.
  3. Initiate contracts with /contracts and track milestones via progress pings.
  4. Chat in real time using /conversations, /messages, and SSE streams at /stream/:conversationId.
  5. Queue SMS updates through /sms/inbound webhooks and /sms/queue for outbound delivery.
  6. Handle payments with /deposit, /payouts, and optional Stripe integration.
  7. Sync nodes using the federation tools in /federation/* and /trends APIs.

User & Key Management APIs

POST /userRegistration
{
"email": "farmer@example.org",
"password": "s3cure",
"role": "producer",
"profile": {
"name": "Amina Odhiambo",
"phone": "+255700123456"
}
}
POST /api/auth/login
{
"email": "farmer@example.org",
"password": "s3cure"
}
POST /api/keys/issue
{
"userId": "user_prod7",
"scopes": ["sse:stream", "market:read"],
"expiresIn": 86400
}

The key management service supports McEliese key generation and OAuth2 token exchange. Use /api/keys/revoke to deactivate compromised keys and /api/auth/refresh to rotate JWTs without forcing logouts.

Tooling Overview

CapabilityHighlightsKey Endpoints
MarketplaceProducts, listings, contracts/products, /listings, /contracts
User managementRegistration, roles, keys/userRegistration, /api/auth/login, /api/keys
AuthenticationMcEliese keys, OAuth2/JWT, SSE API keys/api/auth/*, /api/keys
Chat & SSEConversations, responders, streaming updates/conversations, /messages, /stream/:conversationId, /events
SMSTwilio webhook intake, queueing, local language replies/sms/inbound, /sms/status, /sms/queue
PaymentsNTARI deposits, payouts, Stripe off-ramps/deposit, /payouts, /admin/payouts/run
ReputationLBTAS scoring, audits/submitRating, /transactions/:id
NotificationsPings, progress, SSE/transactions/:id/pings, /notifications
FederationNode registry, sync jobs, analytics/federation/*, /trends
Geo toolsGeo-filtered search, distance calculations/listings?geoLat_=...&geoLong_=...
Square-foot planningPlant spacing calculator & companion planting guidebackend/utils/squareFootGardening
File uploadsReceipts, listing media/uploads, /messages/:id/files
CLI & scriptsHardcoded URL audits, registry syncscripts/list-hardcoded-urls.sh, server/registry-server.js
TestingNode test suite, Docker Compose for DynamoDBnpm test, docker compose up dynamodb

Use this quickstart to bootstrap lab environments before diving into the detailed feature guides that follow.