AgriAI is an AI-powered contract farming platform that digitally connects farmers and buyers through a secure and transparent system. The platform enables farmers to upload crop details and buyers to post procurement deals, allowing both parties to search, negotiate, and finalize contracts through mutual agreement.
π Disclaimer: he full implementation of some parts of the project, including advanced recommendation features, payment gateway integration, or proprietary logic, has been intentionally omitted from the public repository to protect sensitive code and data.
- Farmer
- Buyer Each user role has secure authentication and role-based access.
- Structured data storage using MySQL
- Separate tables for users, crops, deals, carts, and contracts
- Secure CRUD operations through Flask APIs
- Input validation and role-based access control
- π Farmer & Buyer Authentication β Secure login and registration
- π± Crop Upload β Farmers can list crops with price, quantity, and availability
- π Deal Posting β Buyers can upload purchase requirements
- π Two-Way Search β Farmers can search buyers and buyers can search farmers
- π Cart-Based Workflow β Crops or deals added to cart for contract initiation
- π Digital Contract System β Contracts generated after mutual approval
- π€ AI Chatbot β Answers farming-related queries and platform guidance
- π Multilingual Support β English, Hindi, and Kannada
- Project is currently not deployed online
- Can be executed locally using Flask backend and web-based frontend
- Enables direct farmer-to-buyer interaction
- Reduces dependency on intermediaries
- Promotes transparent and secure contract farming
- Demonstrates real-world integration of AI, web technologies, and databases
- Strong showcase of AgriTech-focused full stack development
π AgriAI
β
βββ backend/ # Flask backend
β βββ app.py # Main Flask app
β βββ create_tables.sql # SQL scripts to create tables
β βββ .env # Environment variables
β βββ routes/ # API route files
β βββ utils/ # Helper functions, validations
β
βββ src/ # React.js frontend
β βββ components/ # Reusable components
β βββ farmer/ # Farmer-specific pages
β βββ buyer/ # Buyer-specific pages
β βββ Cart.js
β βββ Navbar.js
β βββ i18n.js # Multilingual support
β
βββ README.md # Project documentation
βββ package.json # Frontend dependencies
- Python 3.8+ - Download Python
- Node.js 16+ - Download Node.js
- MySQL 8.0+ - Download MySQL
- Git - Download Git
git clone https://github.com/Ujjal57/AgriAI.git
cd AgriAI# Navigate to backend directory
cd backend
# Create virtual environment
python -m venv venv
# Activate virtual environment
# On Windows:
venv\Scripts\activate
# On macOS/Linux:
# source venv/bin/activate
# Install Python dependencies
pip install -r requirements.txt
# Set up environment variables
cp .env.example .env
# Edit .env file with your database credentials:
# DB_HOST=localhost
# DB_USER=your_mysql_username
# DB_PASSWORD=your_mysql_password
# DB_NAME=agri_ai
# DB_PORT=3306
# Initialize database tables
python init_database.py-- Create database
CREATE DATABASE agri_ai;
-- The application will automatically create required tables
-- when you run init_database.py# Return to root directory
cd ..
# Install Node.js dependencies
npm install
# Start the React development server
npm startTerminal 1: Start Backend Server
cd backend
python app.py- Backend API will run on: http://localhost:5000
Terminal 2: Start Frontend Server
npm start- Frontend will run on: http://localhost:3000
- Frontend: http://localhost:3000
- Backend API: http://localhost:5000
- Port conflicts: If ports 3000 or 5000 are busy, React/Flask will prompt for alternative ports
- Database connection: Ensure MySQL is running and credentials in
.envare correct - Python virtual environment: Always activate the virtual environment before running backend commands
- Dependencies: If you encounter import errors, ensure all packages from
requirements.txtare installed
To enable additional features, uncomment the relevant packages in backend/requirements.txt:
- AI/ML Features: Uncomment groq, mediapipe, scikit-learn, opencv
- Translation: Uncomment deep-translator, langdetect, gTTS
- Admin Dashboard: Uncomment streamlit
- PDF Processing: Uncomment PyMuPDF
- Document Processing: Uncomment python-docx
### πΉ 4. Frontend setup
- Navigate to src/ and install dependencies:
```npm install
npm start
- React app runs on http://localhost:3000
- Flask API runs on http://localhost:5000
- Credentials can be created through registration pages
Ujjal Kumar Dey






