AI-powered smart farm monitoring platform — crop disease detection, farm management, and weather intelligence as a Progressive Web App.
AgroNavis is an open-source PWA that helps farmers monitor crops, detect plant diseases via YOLOv8 AI, manage multiple farms with GPS precision, and receive hyper-local weather-based irrigation recommendations. It supports English, Hindi, and Bengali and works offline.
Services
| Service | Stack | Port |
|---|---|---|
| Frontend | Next.js 14, TypeScript, Tailwind CSS | 3000 |
| Backend API | Express.js, TypeScript | 3001 |
| ML Service | FastAPI, YOLOv8, PyTorch | 8001 |
| Database | Supabase (PostgreSQL + RLS) | — |
- Node.js 18+
- Python 3.9+
- Docker & Docker Compose (for Docker setup)
- Supabase account
- OpenWeatherMap API key
git clone https://github.com/YOUR_ORG/agronavis.git
cd agronavis
cp .env.example .env
cp frontend/.env.local.example frontend/.env.local
cp backend/.env.example backend/.env
# Fill in your credentials in each file
docker-compose up -d --buildAccess: Frontend http://localhost:3000 | API http://localhost:3001 | ML http://localhost:8001
git clone https://github.com/YOUR_ORG/agronavis.git
cd agronavis
# Install all dependencies
npm run install:all
# Copy and fill env files
cp .env.example .env
cp frontend/.env.local.example frontend/.env.local
cp backend/.env.example backend/.env
# Terminal 1 — frontend + backend
npm run dev
# Terminal 2 — ML service
cd backend/ml-service
python -m venv venv && source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
python main.pySUPABASE_URL=
SUPABASE_ANON_KEY=
SUPABASE_SERVICE_KEY=
DATABASE_URL=postgresql://postgres:password@localhost:5432/agronavis
JWT_SECRET=
CORS_ORIGIN=http://localhost:3000
PORT=3001
NODE_ENV=development
WEATHER_API_KEY=
ML_SERVICE_URL=http://localhost:8001NEXT_PUBLIC_SUPABASE_URL=
NEXT_PUBLIC_SUPABASE_ANON_KEY=
NEXT_PUBLIC_API_BASE_URL=http://localhost:3001/api
NEXT_PUBLIC_APP_URL=http://localhost:3000
NEXT_PUBLIC_WEATHER_API_KEY=- Create a project at supabase.com.
- Copy your Project URL and anon/service keys into the env files.
- Run migrations:
cd backend
npm run db:link # link to your Supabase project
npm run db:push # apply all migrationsagronavis/
├── frontend/ # Next.js PWA
│ └── src/
│ ├── components/ # UI components
│ ├── pages/ # Routes
│ ├── hooks/ # Custom React hooks
│ ├── auth/ # Auth logic
│ ├── utils/ # API helpers
│ └── styles/
├── backend/ # Express API
│ ├── src/
│ │ ├── routes/ # REST endpoints
│ │ ├── services/ # Business logic
│ │ ├── middleware/ # Auth, CORS
│ │ └── lib/ # DB client
│ ├── ml-service/ # FastAPI + YOLOv8
│ │ ├── main.py
│ │ ├── src/
│ │ └── models/ # Trained model weights (not committed)
│ └── supabase/
│ └── migrations/ # SQL migrations
├── .env.example
├── docker-compose.yml
└── package.json # Monorepo scripts
All protected endpoints require Authorization: Bearer <token>.
Auth
POST /api/auth/register
POST /api/auth/login
GET /api/auth/profile
Farms
GET /api/farms
POST /api/farms
GET /api/farms/:id
PUT /api/farms/:id
DELETE /api/farms/:id
GET /api/farms/:id/details
Crops
GET /api/crops
POST /api/crops
GET /api/crops/:id
PUT /api/crops/:id
DELETE /api/crops/:id
AI Analysis
POST /api/ml/analyze-image # base64 image
POST /api/ml/analyze-image-upload # multipart file
GET /api/ml/models/info
Other
GET /api/farmers, POST, PUT
GET /api/soil-health, POST
GET /api/resources, POST
GET /api/yields, POST
Error responses follow a consistent shape:
{ "success": false, "error": "message", "code": "ERROR_CODE" }# Backend
cd backend && npm test
# Frontend
cd frontend && npm testFrontend — Vercel: push to main, import repo in Vercel, set env vars.
Backend — any Node.js host (Railway, Fly.io, Heroku). Set all backend env vars.
ML Service — any Python host or Docker container. Ensure model weights are present at backend/ml-service/models/.
Note: Model weight files (.pt, .onnx) are excluded from the repo via .gitignore. Download or train your own and place them in backend/ml-service/models/.
See CONTRIBUTING.md.
See SECURITY.md.