AgriAdvisor – AI-Powered Agricultural Advisory System with Marketplace
Back to ProjectFollow the steps below to set up and run the AgriAdvisor project on your local machine. The project has two parts: a Flask backend and a React.js frontend. Both must be running simultaneously for the application to work correctly.
Make sure the following software is installed on your system before proceeding:
Open your terminal or command prompt and run the following command to clone the project:
git clone <repository_url>
cd AgriAdvisor
Navigate to the root project folder and install all required Python packages using pip:
pip install -r requirements.txt
This will install Flask, TensorFlow, scikit-learn, Flask-JWT-Extended, Flask-SQLAlchemy, Flask-Mail, Razorpay SDK, and all other required libraries.
Create a .env file in the root directory of the project. You can copy the example file if provided:
cp .env.example .env
Open the .env file and fill in the following values:
SECRET_KEY=your-secret-key
JWT_SECRET_KEY=your-jwt-secret
SQLALCHEMY_DATABASE_URI=sqlite:///agri.db
MAIL_SERVER=smtp.gmail.com
MAIL_PORT=587
MAIL_USE_TLS=True
MAIL_USERNAME=your@gmail.com
MAIL_PASSWORD=your-gmail-app-password
RAZORPAY_KEY_ID=rzp_test_xxxxxxxxxxxxxx
RAZORPAY_KEY_SECRET=your-razorpay-secret
OPENWEATHER_API_KEY=your-openweathermap-api-key
FRONTEND_URL=http://localhost:5173
Important: For Gmail, you must use an App Password, not your regular Gmail account password. Generate one from your Google Account security settings under Two-Factor Authentication.
The plant disease detection module requires a trained EfficientNetB4 model. Follow these steps:
Note: If a pre-trained model file is already included in the project package you purchased, you can skip the training step and directly place the .h5 file in the models/ folder.
Run the backend server using one of the following commands:
Option A – Using Python directly (recommended for development):
python app.py
Option B – Using Flask CLI (recommended for background running):
flask run --host=0.0.0.0 --port=5001 --no-debugger --no-reload
The Flask backend will start and run at: http://localhost:5001
The SQLite database file agri.db will be automatically created on the first run. Do not delete this file while the server is running.
Open a new terminal window, navigate to the frontend folder, and run the following commands:
cd frontend
npm install
npm run dev
The React frontend will start and run at: http://localhost:5173
Important: Keep both the Flask backend terminal and the React frontend terminal running at the same time. Closing either one will break the application.
Once both servers are running, open your web browser and navigate to:
http://localhost:5173
You will see the AgriAdvisor landing page. You can register a new account or use the demo credentials below to log in immediately:
Razorpay is configured in test mode. To test the payment flow, use the following Razorpay test card details on the checkout screen:
No real money will be charged during test mode transactions.
python -m pip install --upgrade pip and then re-run the install command.If you face any difficulty during installation, CodeAj offers a dedicated Project Setup and Source Code Explanation service. Our team will set up the project on your system, walk you through the entire codebase, and answer your questions in a one-on-one session. Visit projects.codeaj.com/project-setup to book this service.
Our team is here to assist you with installation and setup.