A comprehensive agricultural platform that combines satellite data analysis, weather monitoring, and market intelligence to help farmers optimize soil health and maximize ROI through data-driven decision making.
- π°οΈ Satellite Data Analysis: Google Earth Engine integration for vegetation and soil health monitoring
- π¦οΈ Weather Intelligence: Real-time weather data with agricultural indices (GDD, drought risk, frost alerts)
- π Market Analysis: Crop price monitoring and market sentiment analysis
- π€ AI-Powered Insights: Intelligent soil health assessment and crop recommendations using Gemini & Claude
- π Comprehensive Dashboard: Interactive farm management with real-time analytics
- π Real-time Updates: Automated monitoring with alert systems
- πΊοΈ Dynamic Grid System: Auto-generates analysis zones based on farm size
- < 2 ha: 2Γ2 grid (4 zones) using Sentinel-2 (10m resolution)
- 2-10 ha: 3Γ3 grid (9 zones) using Sentinel-2 (10m resolution)
- 10-50 ha: 4Γ4 grid (16 zones) using Landsat (30m resolution)
- 50+ ha: 5Γ5 grid (25 zones) using Landsat (30m resolution)
- π― Zone-Level Recommendations: AI agents provide specific actions for each problem zone
- π₯ Interactive Health Map: Satellite imagery overlay with color-coded zones showing exactly WHERE problems are
- πΎ Database Storage: All soil health and ROI analyses are saved to Supabase
- π Analysis History: View and compare past analyses for trend tracking
- π Historical Insights: Click any past analysis to view full details
- π Trend Analysis: Track farm health improvements over time
Frontend:
- Next.js 14 (App Router)
- TypeScript
- Tailwind CSS
- React Components
Backend:
- FastAPI (Python)
- Supabase (Database & Auth)
- Google Earth Engine API
- OpenWeatherMap API
- Various commodity price APIs
AI & Analysis:
- Google Gemini API
- Anthropic Claude API
- Custom satellite data processing
- Agricultural algorithms
- Node.js 18+ and npm
- Python 3.11+
- Git
git clone https://github.com/yourusername/larmms.git
cd larmmsCopy the environment template and configure your API keys:
cp env.template .env
# Edit .env with your actual API keys (see API Setup section below)cd backend
pip install -r requirements.txt
uvicorn main:app --reload --host 0.0.0.0 --port 8000cd frontend
npm install
npm run dev# Run Supabase migrations
supabase db pushPurpose: Database, Authentication, Real-time subscriptions
Setup Steps:
- Go to supabase.com
- Create a new project
- Go to Settings β API
- Copy your Project URL and API keys
Environment Variables:
NEXT_PUBLIC_SUPABASE_URL=your_project_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_service_role_keyCost: Free tier (up to 50MB database, 100MB file storage)
Purpose: Satellite imagery analysis for soil and vegetation monitoring
Setup Steps:
- Go to Google Cloud Console
- Create a new project
- Enable Earth Engine API
- Set up authentication:
pip install earthengine-api earthengine authenticate
Environment Variables:
GOOGLE_CLOUD_PROJECT_ID=your_project_idCost: Free for research/non-commercial (25,000 API calls/day)
Purpose: Weather data and agricultural forecasting
Setup Steps:
- Go to OpenWeatherMap
- Sign up for free account
- Generate API key
Environment Variables:
OPENWEATHERMAP_API_KEY=your_api_keyCost: Free tier (1,000 calls/day), $40/month for 100k calls
4a. Alpha Vantage (RECOMMENDED)
- Website: alphavantage.co
- Cost: 25 requests/day FREE, then $49.99/month unlimited
- Perfect for development and light production use
- Variable:
ALPHA_VANTAGE_API_KEY
4b. Twelve Data (Best Free Tier)
- Website: twelvedata.com/pricing
- Cost: 800 requests/day FREE, excellent coverage
- Variable:
TWELVE_DATA_API_KEY
4c. Financial Modeling Prep
- Website: financialmodelingprep.com
- Cost: 250 requests/day FREE
- Variable:
FMP_API_KEY
4d. Commodities API (Paid Only)
- Website: commodities-api.com
- Cost: 7-day free trial only, then $49.99/month minimum
- Variable:
COMMODITIES_API_KEY
5a. Google Gemini
- Website: Google AI Studio
- Cost: Free tier (15 requests/minute), pay-per-use beyond
- Variable:
GOOGLE_GEMINI_API_KEY
5b. Anthropic Claude
- Website: console.anthropic.com
- Cost: Pay-per-use ($3/million input tokens)
- Variable:
ANTHROPIC_API_KEY
5c. OpenAI
- Website: platform.openai.com
- Cost: Pay-per-use ($0.50-$20/million tokens depending on model)
- Variable:
OPENAI_API_KEY
- Supabase: Free
- Google Earth Engine: Free (research use)
- OpenWeatherMap: Free (1k calls/day)
- All other APIs: Demo data fallbacks
- Total: $0/month
- Supabase Pro: $25/month
- OpenWeatherMap: $40/month (100k calls)
- Alpha Vantage: $49.99/month OR use free tier (25 calls/day)
- AI APIs: ~$10-50/month (depending on usage)
- Total: ~$75-165/month (or ~$75/month with free commodity API tier)
SoilGuard/
βββ frontend/ # Next.js frontend application
β βββ src/
β β βββ app/ # App router pages
β β β βββ dashboard/ # Farm management pages
β β βββ components/
β β β βββ Analysis/ # SoilHealthDisplay, ROIDisplay, AnalysisHistory, ZoneMapOverlay
β β β βββ Map/ # Interactive maps and location picker
β β β βββ FarmerDashboard/# Health gauges, action cards, zone alerts
β β βββ lib/ # API client, Supabase config, utilities
βββ backend/ # FastAPI backend application
β βββ routers/
β β βββ analysis.py # Soil health, ROI, zonal analysis endpoints + history
β β βββ farms.py # Farm CRUD operations
β β βββ auth.py # Authentication endpoints
β βββ services/
β β βββ satellite_service.py # Google Earth Engine integration
β β βββ spatial_grid.py # π Dynamic zone grid generation
β β βββ soil_health_agent.py # AI soil analysis with zone recommendations
β β βββ roi_agent.py # AI crop ROI analysis
β β βββ ai_config.py # Gemini + Claude configuration
β βββ utils/
β β βββ database.py # π Supabase client for persistence
β β βββ satellite_calculations.py
β βββ requirements.txt
βββ supabase/
β βββ migrations/
β βββ 001_initial_schema.sql # Users, farms tables
β βββ 002_analysis_tables.sql # π soil_health_analyses, roi_analyses tables
βββ backend/env.example # Backend environment template
βββ frontend/env.example # Frontend environment template
βββ README.md
curl http://localhost:8000/health
curl http://localhost:8000/api/v1/analysis/status- Open http://localhost:3000
- Register/Login
- Add a new farm with pin drop location
- View satellite analysis
The platform automatically processes:
- Satellite vegetation indices (NDVI, NDWI, SAVI, EVI, etc.)
- Zone-based health scoring (dynamic grid based on farm size)
- Weather risk assessment
- Market price analysis
- AI-powered recommendations with zone-specific actions
- Run a complete analysis on a farm
- Expand the "Analysis History" section on the farm page
- View past analyses and click to see full details
- Compare trends over time
# Deploy to Vercel
npm run build
vercel --prod# Deploy to Railway
railway login
railway init
railway up- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open a Pull Request
Built with β€οΈ for sustainable agriculture and data-driven farming