AI-Powered Solutions for Sustainable Agriculture and Enhanced Crop Management
Agrow-AI is a full-stack web application designed to revolutionize agriculture through artificial intelligence. It provides farmers and agricultural experts with intelligent tools for crop management, disease detection, yield prediction, and personalized recommendations. By leveraging AI, Agrow-AI aims to optimize agricultural practices, increase productivity, and promote sustainable farming.
This repository contains both the frontend web interface and the backend API, integrated to deliver a seamless and powerful agricultural intelligence platform.
Based on the project name and structure, Agrow-AI is built to offer a comprehensive suite of features:
- π― AI-Driven Crop Analysis: Integrate machine learning models for detecting crop diseases, predicting yield, and analyzing soil health.
- π± Personalized Recommendations: Provide tailored advice for irrigation, fertilization, pest control, and optimal planting times.
- π Interactive Dashboards: Visualize key agricultural data, trends, and AI insights through a user-friendly interface.
- π User Authentication & Management: Secure user registration, login, and profile management for personalized experiences.
- π Data Management: Efficiently store and retrieve crop data, farm statistics, and environmental parameters.
- π± Responsive Design: A modern, adaptive user interface ensuring accessibility across various devices.
- β‘ Scalable Backend API: A robust API infrastructure capable of handling data processing and AI model interactions.
Frontend:
Backend:
Database:
DevOps:
Follow these steps to get Agrow-AI up and running on your local machine.
Before you begin, ensure you have the following installed:
- Node.js:
v18.xor higher (recommended). You can download it from nodejs.org. - npm: Comes bundled with Node.js.
- MongoDB: Ensure a MongoDB instance is running locally or accessible via a connection string. You can download MongoDB Community Server from mongodb.com.
-
Clone the repository
git clone https://github.com/Vishok-2006/Agrow-AI.git cd Agrow-AI -
Install Backend Dependencies Navigate to the
backenddirectory and install the required packages:cd backend npm install cd .. # Go back to the root directory
-
Install Frontend Dependencies Navigate to the
frontenddirectory and install the required packages:cd frontend npm install cd .. # Go back to the root directory
-
Environment setup Create
.envfiles for both the backend and frontend.For the backend:
cp backend/.env.example backend/.env
Open
backend/.envand configure your environment variables. A typical setup would include:PORT=5000 MONGODB_URI="mongodb://localhost:27017/agrow_ai_db" JWT_SECRET="your_jwt_secret_key" AI_API_KEY="your_ai_service_api_key" # If integrating with external AI servicesFor the frontend:
cp frontend/.env.example frontend/.env
Open
frontend/.envand configure your environment variables. A typical setup would include:VITE_API_URL="http://localhost:5000/api" # Matches your backend port and API prefix -
Database setup Ensure your MongoDB server is running. No specific migration commands are usually needed for MongoDB. The backend application will handle schema creation on first use.
-
Start the development servers The
start.shscript is provided to simplify running both the frontend and backend concurrently.sh start.sh
This script will:
- Start the backend server (typically on
http://localhost:5000). - Start the frontend development server (typically on
http://localhost:5173).
- Start the backend server (typically on
-
Open your browser Visit
http://localhost:5173to access the Agrow-AI application.
Agrow-AI/
βββ .gitignore # Specifies intentionally untracked files to ignore
βββ AI_INTEGRATION_FIX_SUMMARY.md # Summary of AI integration fixes
βββ BACKEND_FIX_SUMMARY.md # Summary of backend fixes
βββ README.md # This README file
βββ backend/ # Node.js/Express.js API
β βββ src/ # Backend application source code
β β βββ config/ # Configuration files (e.g., database connection)
β β βββ models/ # Mongoose/database schemas
β β βββ routes/ # API route definitions
β β βββ controllers/ # Logic for handling API requests
β β βββ middleware/ # Express middleware (e.g., authentication)
β β βββ server.js # Main entry point for the backend server
β βββ package.json # Backend dependencies and scripts
β βββ .env.example # Example environment variables for backend
βββ docs/ # Project documentation and resources
β βββ architecture.md # Example: system architecture documentation
βββ frontend/ # React/Vite web application
β βββ public/ # Static assets (index.html, images)
β βββ src/ # Frontend application source code
β β βββ assets/ # Images, icons, fonts
β β βββ components/ # Reusable UI components
β β βββ pages/ # Application pages/views
β β βββ services/ # API communication logic
β β βββ hooks/ # Custom React hooks
β β βββ styles/ # Global styles, Tailwind CSS configuration
β β βββ App.jsx # Main application component
β β βββ main.jsx # Frontend entry point
β βββ package.json # Frontend dependencies and scripts
β βββ .env.example # Example environment variables for frontend
βββ start.sh # Script to run both frontend and backend development servers
Both the frontend and backend use environment variables for sensitive information and configuration settings. These are loaded from .env files in their respective directories.
| Variable | Description | Default | Required |
| :------------ | :------------------------------------------------ | :---------------- | :------- |
| PORT | Port for the backend server to listen on. | 5000 | Yes |
| MONGODB_URI | Connection string for MongoDB database. | mongodb://localhost:27017/agrow_ai_db | Yes |
| JWT_SECRET | Secret key for signing JWT tokens. | your_jwt_secret_key | Yes |
| AI_API_KEY | API key for external AI services (if applicable). | (none) | No |
| Variable | Description | Default | Required |
| :-------------- | :------------------------------------------------ | :------------------------- | :------- |
| VITE_API_URL | Base URL for the backend API. | http://localhost:5000/api| Yes |
backend/src/config/: May contain database connection settings, API configurations, or other backend-specific settings.
The package.json files in frontend and backend define various scripts for development and building.
| Command | Description |
| :------------- | :-------------------------------------------- |
| npm run dev | Starts the frontend development server. |
| npm run build| Builds the frontend for production. |
| npm run lint | Lints the frontend source code. |
| npm run preview | Serves the production build locally. |
| Command | Description |
| :------------- | :-------------------------------------------- |
| npm run start| Starts the backend server in production mode. |
| npm run dev | Starts the backend server in development mode (e.g., with nodemon). |
| npm test | Runs backend tests (if implemented). |
For a unified development experience, use the start.sh script from the project root. This script orchestrates the launch of both frontend and backend development servers.
sh start.shWhile specific test files are not provided in the directory structure, it is common practice to include tests for both frontend and backend.
If testing frameworks like Jest or Mocha are configured in the backend/package.json, you would typically run:
cd backend
npm testSimilarly, for frontend testing with frameworks like Vitest or React Testing Library, you would run:
cd frontend
npm testTo create a production-ready build of the frontend application:
cd frontend
npm run buildThis will generate optimized static assets in the frontend/dist directory.
- Local Deployment (
start.sh): Thestart.shscript is suitable for local development. For production, you would typically run the backend separately and serve the frontend build assets. - Cloud Hosting (e.g., Vercel, Netlify, Render):
- The
frontend/distfolder can be deployed to static site hosts like Vercel or Netlify. - The
backendcan be deployed to platforms like Render, Heroku, AWS EC2, or Google Cloud Run.
- The
- Docker: For a more containerized deployment, consider adding
Dockerfiles to bothfrontendandbackenddirectories.
The backend API exposes various endpoints to interact with the Agrow-AI system.
The API likely uses JSON Web Tokens (JWT) for user authentication. Users will typically register and log in to obtain a token, which must be included in subsequent requests to protected routes.
(Based on typical full-stack applications with AI integration for agriculture)
| Method | Endpoint | Description | Authentication |
| :----- | :-------------------------- | :------------------------------------------- | :------------- |
| POST | /api/auth/register | Register a new user. | None |
| POST | /api/auth/login | Log in and receive a JWT. | None |
| GET | /api/users/me | Get current user profile. | JWT Required |
| GET | /api/crops | Retrieve all crop entries. | JWT Required |
| POST | /api/crops | Add a new crop entry. | JWT Required |
| GET | /api/crops/:id | Get a specific crop entry by ID. | JWT Required |
| PUT | /api/crops/:id | Update a crop entry. | JWT Required |
| DELETE| /api/crops/:id | Delete a crop entry. | JWT Required |
| POST | /api/ai/predict-yield | Get AI-driven yield prediction. | JWT Required |
| POST | /api/ai/detect-disease | Detect crop diseases using AI. | JWT Required |
| GET | /api/recommendations | Get personalized agricultural recommendations.| JWT Required |
We welcome contributions to Agrow-AI! If you're interested in improving the project, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bug fix:
git checkout -b feature/your-feature-name. - Make your changes.
- Commit your changes with clear and concise messages.
- Push your branch to your forked repository.
- Open a Pull Request to the
mainbranch of this repository.
Please see our CONTRIBUTING.md for more detailed guidelines.
The development setup is identical to the "Quick Start" guide. Ensure all prerequisites are met, dependencies installed in both frontend and backend, and environment variables are configured. Use sh start.sh to begin development.
This project is licensed under the MIT License - see the LICENSE file for details.
- Node.js & Express.js: For a powerful backend runtime and framework.
- React & Vite: For an efficient and modern frontend development experience.
- MongoDB: For flexible and scalable data storage.
- AI/ML Libraries: (Specify any specific libraries used, e.g., TensorFlow.js, scikit-learn, PyTorch, if known)
- Special thanks to all contributors and the open-source community for their valuable tools and resources.
- π Issues: If you find any bugs or have feature requests, please report them on GitHub Issues.
- π§ Contact: [vishok.2006@example.com]
β Star this repo if you find it helpful!
Made with β€οΈ by Vishok-2006