A comprehensive full-stack application designed to detect and classify crop diseases using machine learning. The project is split into three decoupled services:
- Frontend: A sleek React user interface for image uploads and results display.
- Backend API: A fast Node.js Express server to handle uploads and business logic.
- ML Service: A robust Python FastAPI backend dedicated to running inference using TensorFlow.
- Tech Stack: React 18, Tailwind CSS, Axios, React Router v6.
- Role: Provides the user-facing interface (
agrilens-frontend) to seamlessly upload plant photos and analyze results. - Port: Runs on
http://localhost:3000by default.
- Tech Stack: Node.js, Express, Mongoose (MongoDB), Multer.
- Role: Acts as the main API layer. It coordinates file uploads, handles database connections, stores images in
backend/uploads/, and manages CORS / security boundaries with Helmet. - Port: Runs on
http://localhost:5001.
- Tech Stack: Python 3.8+, FastAPI, TensorFlow, Pillow, OpenCV.
- Role: Dedicated ML inference server. Reads
.h5models from theml_service/models/directory, processes images, and serves predictions viaPOST /predict/{model_name}. - Port: Runs on
http://localhost:8000.
- Node.js (v16.0.0 or newer)
- Python (v3.8 or newer)
- MongoDB (Local or Atlas URI inside
backend/.env) - Pre-trained
.h5model files.
To streamline launching all three services at once:
- Copy your trained TensorFlow model files (
.h5) into theml_service/models/folder. - Run the
start.batscript located in the root directory.
The script will automatically verify your environment, install missing Node/Python packages across all three folders, spin up each service, and launch the web interface in your browser.
If you prefer to start each service independently in separate terminal windows:
1. ML Service
cd ml_service
pip install -r requirements.txt
python simple_server.py2. Node.js Backend
cd backend
npm install
npm run dev3. React Frontend
cd frontend
npm install
npm start