# FarmFlux

GitHub · vxrachit/FarmFlux

FarmFlux brings together soil analysis, crop-disease detection, weather insight, and a Gemini-powered chatbot—helping farmers make informed, data-driven decisions.


# Feature Highlights

Category Details
🌤️ Weather Widget Real-time 7-day forecast & hourly breakdown
🌱 Crop Dashboard Planting cycles, growth stages, task tracker
🧪 Disease Detection Gemini Vision detects leaf diseases from photos
🧑🌾 Chatbot Natural-language Q&A (Gemini Pro) with citations
📊 Farm Analytics Yield estimates & input-cost tracking
🔐 Supabase Auth Email/password & magic-link login
🌍 Multi-Language English, Hindi

# Screenshots

Dashboard overview Chatbot conversation Weather widget
Disease upload Diagnosis result Analytics panel Task manager

# Tech Stack

Frontend Backend Auth / Data
React 18 + Vite + TypeScript FastAPI (Python 3.11) Supabase Auth
Tailwind CSS Gemini 2.0 Flash Model Row-level security
React Router v6 HTTPX JWT stored by Supabase

# Project Structure

FarmFlux
├── frontend
│   ├── src/components          # UI Components
│   ├── src/context             # Language & Auth Contexts
│   ├── src/services            # API Calls (weather, auth)
│   └── App.tsx                 # Route definitions
│
├── backend
│   ├── app
│       ├── api/                # Route handlers (FastAPI routers)
│       │   ├── chatbot.py
│       │   ├── crop_recommendation.py
│       │   ├── disease_detection.py
│       │   ├── supabase.py    # Login/Signup routes via Supabase
│       │   └── weather.py
│       │
│       ├── core/               # App configuration & startup logic
│       │   └── config.py
│       │
│       ├── models/             # Pydantic models and data schemas
│       │   ├── chatbot.py
│       │   ├── crop_recommendation.py
│       │   ├── disease_detection.py
│       │   ├── supabase.py
│       │   └── weather.py
│       │
│       └── services/           # External service utilities (OpenAI, Weather, etc.)
│       │    ├── gemini_services.py
│       │    ├── supabase_client.py
│       │    └── weather_services.py
│       │
│       └── main.py                 # FastAPI app startup & route includes
│
├── requirements.txt            # Python dependencies
├── .env                        # Environment variables (DO NOT COMMIT)
└── README.md                   # Project documentation

# Setup & Run Locally

# 1 clone repo
git clone https://github.com/vxrachit/FarmFlux.git && cd FarmFlux

# 2 backend
cd backend
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
uvicorn app.main:app --reload --port 8000

# 3 frontend
cd ../frontend
npm install
npm run dev

Open http://localhost:5173 and configure your Gemini and Supabase keys in the respective .env files.


# Authentication Flow

React login form ➜ POST /api/login ➜ FastAPI proxy ➜ Supabase Auth ➜ JWT ➜ localStorage ➜ protected routes

# Upcoming

  • Batch image upload for multi-leaf diagnosis
  • Offline TensorFlow.js fallback for field use
  • Crop-rotation planner & expense ledger
  • SMS push alerts in rural networks

# License

MIT © Rachit Verma — free to fork & adapt.