Tagline: "Data-Driven Agriculture Insights"
A comprehensive agricultural platform combining real-time weather data, blockchain supply chain tracking, AI decision support, market analytics, and decentralized governance for farmers and agricultural stakeholders.
RANTAI AgroViz empowers farmers, cooperatives, governments, and agricultural buyers with:
- Data-driven decision making instead of intuition alone
- Transparent supply chain from farm to consumer
- Real-time weather intelligence with actionable alerts
- AI-powered recommendations for optimal farming practices
- Community governance through decentralized autonomous organization (DAO)
- Real-time Crop Monitoring: Track soil moisture, temperature, NPK nutrients
- Multi-crop Management: Rice, coffee, palm oil, corn, soybean, vegetables, fruits
- Harvest Analytics: Yield trends, quality metrics, price analysis
- Weather Integration: Live weather data with 7-day forecasts
- Live Weather API: Integration with WeatherAPI.com (1M free calls/month)
- 7-Day Forecasts: Temperature, rainfall, humidity, wind speed, UV index
- 6 Smart Alert Types:
- π₯ Extreme Heat Alert (>35Β°C)
- π§οΈ Heavy Rainfall Warning (>50mm/3 days)
- βοΈ Drought Alert (No rain 5+ days)
- π¨ Strong Wind Warning (>40 km/h)
- βοΈ Frost Warning (<5Β°C)
- βοΈ High UV Index (>8)
- Push Notifications: Real-time toast alerts for critical conditions
- Location Management: 8 quick-select regions + manual search
- Auto-refresh: Data updates every 10 minutes
- Product Registration: Register agricultural products on Ethereum Sepolia
- QR Code Generation: Traceability from farmer to consumer
- Smart Contract Integration:
- Contract:
0x2a6eA164FcAD56d88EB4e66307960B9230fD3208 - Network: Sepolia Testnet
- Contract:
- Ownership Transfer: Track product journey through supply chain
- OnchainKit Integration: Seamless wallet connection and transactions
- AI-Powered Recommendations: Analyze 6+ parameters
- Soil moisture, temperature, rainfall
- Crop age, soil pH, nutrient levels
- Smart Actions: harvest, irrigate, fertilize, plant, wait, pest_control
- Confidence Scoring: 0-100% confidence with reasoning
- Recommendation History: Track past suggestions and outcomes
- Real-time Analysis: Auto-update every 2 seconds
- 5 Commodity Tracking: Rice, Coffee, Palm Oil, Corn, Soybean
- Price Trends: 30-day historical data + 7-day predictions
- Technical Analysis:
- Volatility metrics
- Buy/Sell/Hold recommendations
- Support/resistance levels
- Market Sentiment: Bullish/Bearish indicators
- Price Alerts: (UI ready, backend pending)
- Proposal System: 4 categories
- Bulk purchases (collective buying power)
- Shared resources (equipment, storage)
- Community policies
- Strategic partnerships
- Democratic Voting: One farmer, one vote
- Treasury Management: Transparent fund allocation
- Member Reputation: Contribution-based ranking
- Active/Passed/Rejected Status: Full proposal lifecycle
- Real-time Database: Built on SpacetimeDB
- 8 Data Tables:
- Users, Crops, WeatherAlerts, MarketPrices
- Products, DAOProposals, DAOVotes, FuzzyRecommendations
- 14 Server Reducers: Complete CRUD operations
- Auto-generated Client Bindings: Type-safe TypeScript integration
- Cross-device Sync: Access data from anywhere
- Framework: Next.js 14 (App Router)
- Language: TypeScript (Strict Mode)
- Styling: Tailwind CSS + shadcn/ui components
- Charts: Recharts
- State Management: React Hooks + Context
- Theme: Dark/Light mode with Web3 cyberpunk aesthetic
- SDK: OnchainKit (Coinbase)
- Library: Wagmi + Viem
- Network: Ethereum Sepolia Testnet
- RPC: Infura (
https://sepolia.infura.io/v3/f8d248f838ec4f12b0f01efd2b238206)
- Primary: SpacetimeDB (Real-time database with compute layer)
- Connection: WebSocket-based real-time sync
- Server Module: Rust (auto-deployed)
- Client Bindings: Auto-generated TypeScript
- Weather: WeatherAPI.com
- Blockchain RPC: Infura
- Proxy: Custom Next.js API route (
/api/proxy)
- Node.js 18+ and npm
- Git
- (Optional) Ethereum wallet for blockchain features
# Clone the repository
git clone https://github.com/yourusername/rantai-agroviz.git
cd rantai-agroviz
# Install dependencies
npm install
# Run development server
npm run devOpen http://localhost:3000 in your browser.
The app uses hardcoded API endpoints for demo purposes. For production:
# WeatherAPI.com (get free key at https://weatherapi.com)
NEXT_PUBLIC_WEATHER_API_KEY=your_weather_api_key
# Infura (for Ethereum RPC)
NEXT_PUBLIC_INFURA_RPC=https://sepolia.infura.io/v3/YOUR_PROJECT_ID
# SpacetimeDB (auto-configured)
NEXT_PUBLIC_SPACETIME_MODULE=your_module_name-
WeatherAPI.com:
- Sign up at https://weatherapi.com
- Get free API key (1M calls/month)
- Currently hardcoded in
src/lib/weather-service.ts
-
Infura:
- Sign up at https://infura.io
- Create Ethereum project
- Use Sepolia testnet endpoint
-
SpacetimeDB:
- Automatically configured
- No additional setup needed
rantai-agroviz/
βββ src/
β βββ app/
β β βββ page.tsx # Main application entry
β β βββ layout.tsx # Root layout with theme provider
β β βββ api/
β β βββ proxy/route.ts # API proxy for external calls
β β βββ health/route.ts # Health check endpoint
β β βββ logger/route.ts # Logging endpoint
β β
β βββ components/
β β βββ FarmDashboard.tsx # Crop management & weather dashboard
β β βββ SupplyChainTracker.tsx # Blockchain supply chain
β β βββ FuzzyLogicAdvisor.tsx # AI decision support
β β βββ MarketAnalytics.tsx # Price intelligence
β β βββ AgroDAO.tsx # Governance system
β β βββ WeatherAlerts.tsx # Weather alert system
β β βββ LocationSelector.tsx # Location management
β β βββ ThemeProvider.tsx # Dark/light theme provider
β β βββ ui/ # shadcn/ui components
β β
β βββ lib/
β β βββ weather-service.ts # WeatherAPI integration
β β βββ fuzzy-logic.ts # Fuzzy logic algorithms
β β βββ utils.ts # Utility functions
β β
β βββ hooks/
β β βββ useSpacetimeDB.ts # SpacetimeDB client hook
β β
β βββ spacetime_module_bindings/ # Auto-generated SpacetimeDB types
β β
β βββ styles/
β βββ globals.css # Global styles + theme variables
β
βββ spacetime-server/
β βββ src/
β βββ lib.rs # SpacetimeDB Rust module
β
βββ public/
β βββ .well-known/
β β βββ farcaster.json # Farcaster mini-app config
β βββ ...
β
βββ package.json
βββ tsconfig.json
βββ tailwind.config.ts
βββ README.md
- Primary: Matrix Green (
#00ff41) - Accent: Cyber Cyan (
#00d9ff) - Background: Deep Black (
#0a0a0a) - Cards: Dark Gray (
#1a1a1a)
- Primary: Fresh Green (
#10b981) - Accent: Sky Blue (
#0ea5e9) - Background: Pure White (
#ffffff) - Cards: Light Gray (
#f9fafb)
- shadcn/ui: 40+ pre-built components
- Recharts: Interactive data visualizations
- Lucide Icons: Consistent iconography
- Framer Motion: Smooth animations
- Network: Ethereum Sepolia Testnet
- Address:
0x2a6eA164FcAD56d88EB4e66307960B9230fD3208 - Chain ID: 11155111
// Add new product
function addProduct(
string name,
string origin,
string ipfsHash
) external
// Transfer ownership
function transferProduct(
uint256 id,
address newOwner
) external
// View product details
function products(uint256 id) external view returns (
string name,
string origin,
string ipfsHash,
address owner
)ProductAdded(uint256 id, string name, string origin, address owner)OwnershipTransferred(uint256 id, address from, address to)
// User profile
#[table(name = user, public)]
pub struct User {
#[primary_key]
pub identity: Identity,
pub wallet_address: String,
pub farm_name: String,
pub location: String,
}
// Crop records
#[table(name = crop, public)]
pub struct Crop {
#[primary_key]
#[auto_inc]
pub id: u64,
pub owner: Identity,
pub crop_type: String,
pub area_hectares: f32,
pub planted_date: String,
pub soil_moisture: f32,
pub temperature: f32,
pub nitrogen: f32,
pub phosphorus: f32,
pub potassium: f32,
pub status: String,
}
// Weather alerts
#[table(name = weather_alert, public)]
pub struct WeatherAlert {
#[primary_key]
#[auto_inc]
pub id: u64,
pub owner: Identity,
pub alert_type: String,
pub severity: String,
pub message: String,
pub action_required: String,
pub timestamp: String,
pub dismissed: bool,
}
// ... 5 more tables (MarketPrice, Product, DAOProposal, DAOVote, FuzzyRecommendation)14 server-side functions for CRUD operations:
- User:
create_user,update_user_location - Crop:
add_crop,update_crop_metrics,harvest_crop,delete_crop - Weather:
save_weather_alert,dismiss_weather_alert - Market:
save_market_price - Supply Chain:
register_product - DAO:
create_dao_proposal,cast_dao_vote,update_proposal_status - AI:
save_fuzzy_recommendation
# Run type checking
npm run type-check
# Build for production
npm run build
# Lint code
npm run lint# Install Vercel CLI
npm i -g vercel
# Deploy
vercel --prod- Node.js 18+
- Build Command:
npm run build - Output Directory:
.next - Install Command:
npm install
- Farm dashboard with crop management
- Real weather API integration
- Smart weather alerts system
- Blockchain supply chain (UI)
- Fuzzy logic decision support
- Market analytics visualization
- DAO governance interface
- SpacetimeDB infrastructure
- Dark/light theme toggle
- Connect SpacetimeDB to all components
- Implement wallet-based authentication
- Real commodity price API
- IoT sensor integration (MQTT/LoRaWAN)
- Smart contract read/write operations
- Historical data analytics
- Computer vision disease detection
- Satellite imagery integration
- Predictive yield modeling
- Financial tools (lending, insurance)
- Mobile app (React Native)
- Offline mode with sync
- Multi-language support (ID, EN)
- User testing with real farmers
- Performance optimization
- Security audit
- Mainnet deployment
- Partnership with agricultural cooperatives
- Government pilot programs
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create feature branch (
git checkout -b feature/AmazingFeature) - Commit changes (
git commit -m 'Add some AmazingFeature') - Push to branch (
git push origin feature/AmazingFeature) - Open Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Created by: mrbrightsides
Powered by:
- OnchainKit - Coinbase Web3 SDK
- SpacetimeDB - Real-time database
- WeatherAPI.com - Weather data
- shadcn/ui - UI components
- Ohara - AI development platform
Website: rantai.elpeef.com
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: support@rantai.elpeef.com
Special thanks to:
- Indonesian farmers for inspiration
- Blockchain community for transparency vision
- Open-source contributors
- Agricultural technology researchers
- Climate scientists for weather algorithms
- Build Size: 468kB (optimized)
- First Load JS: 702kB
- Build Time: ~60 seconds
- Components: 50+
- API Integrations: 3 (Weather, Blockchain, Database)
- Supported Crops: 8 types
- Weather Alerts: 6 categories
- DAO Proposals: 4 types