Connecting Farmers Directly with Consumers | Eliminating Middlemen | Fair Prices for All
- About The Project
- Key Features
- Technology Stack
- Getting Started
- Project Structure
- API Documentation
- Database Schema
- Screenshots
- Team
- Contributing
- License
AgroMart is a comprehensive e-commerce platform designed to revolutionize the agricultural marketplace by connecting farmers directly with consumers, businesses, and industrial buyers. Our platform eliminates intermediaries, ensuring farmers receive fair compensation while consumers access fresh produce at competitive prices.
- Bridge the gap between farmers and consumers through digital innovation
- Eliminate middlemen to ensure fair pricing for both parties
- Create an accessible platform for rural and urban communities
- Improve agricultural supply chain efficiency
- Support sustainable agriculture practices
| User Type | Description |
|---|---|
| Consumers | Individuals seeking fresh, quality farm produce |
| Farmers | Agricultural producers looking to sell directly to market |
| Businesses | Restaurants, stores, and industrial buyers requiring bulk purchases |
| Organizations | Government bodies and NGOs supporting sustainable agriculture |
| Feature | Status | Description |
|---|---|---|
| 🧑🌾 Farmer Registration & Profile | ✅ Complete | Comprehensive profile management with farm information |
| 📦 Product Listing & Management | ✅ Complete | Category-based listing with filtering and sorting |
| 🛒 Cart & Wishlist | ✅ Complete | Full shopping cart and wishlist functionality |
| 💳 Secure Payment Gateway | ✅ Complete | Bkash, Nagad, Stripe, and card payments |
| 📋 Order Management | ✅ Complete | Complete order processing and tracking |
| 🔍 Search, Filter & Pagination | ✅ Complete | Advanced product discovery features |
| 👤 Profile & Role Management | ✅ Complete | User profiles with admin role assignment |
| 🖨️ Print History & Orders | ✅ Complete | Exportable payment and order records (CSV) |
| 📱 Responsive Design | ✅ Complete | Mobile-friendly interface across all devices |
| 🌐 Multi-Language Support | ✅ Complete | Internationalization for global accessibility |
| ⭐ Reviews & Ratings | ✅ Complete | Customer feedback system |
| 🚚 Delivery & Logistics | 🔄 Pending | Delivery integration and tracking |
| 💱 Multi-Currency Support | 🔄 Pending | Auto-detection currency display |
Intelligent crop disease detection system that analyzes uploaded images to identify plant diseases and recommend appropriate treatments.
📸 Upload Photo → 🔬 AI Analysis → 🩺 Disease Identification → 💊 Treatment Recommendations
Smart weather-based decision support system for farmers:
- 🌤️ Live Local Weather — Real-time weather display for your region
- 🌾 Crop Advice — Weather-appropriate crop recommendations
- 🛠️ Smart Product Suggestions — Seeds, fertilizers, and tools aligned with conditions
- 📅 7-Day Forecast — Early planning tools for better farm management
| Category | Libraries |
|---|---|
| State Management | Redux Toolkit, React Query |
| UI/Animation | Framer Motion, Lottie React, Swiper, Keen Slider |
| Authentication | Firebase, JWT |
| Data Visualization | Recharts |
| Internationalization | i18next, i18next-browser-languagedetector |
| PDF/Export | jsPDF, html2canvas, react-csv, json2csv |
| Utilities | Axios, date-fns, lodash, uuid |
Ensure you have the following installed:
- Node.js (v18.x or higher)
- npm or yarn
- MongoDB (local or Atlas connection)
git clone https://github.com/ashraful2871/Agro-Mart.git
cd Agro-Martcd server
npm installCreate a .env file in the server directory:
PORT=5000
MONGO_URI=your_mongodb_connection_string
TOKEN_SECRET_KEY=your_jwt_secret_key
STRIPE_SECRET_KEY=your_stripe_secret_key
STORE_ID=your_sslcommerz_store_id
STORE_PASSWORD=your_sslcommerz_store_password
IS_LIVE=falseStart the backend server:
npm startcd client
npm installCreate a .env file in the client directory:
VITE_API_URL=http://localhost:5000
VITE_STRIPE_PUBLIC_KEY=your_stripe_public_key
VITE_FIREBASE_API_KEY=your_firebase_api_key
VITE_FIREBASE_AUTH_DOMAIN=your_firebase_auth_domain
VITE_FIREBASE_PROJECT_ID=your_firebase_project_idStart the development server:
npm run dev- Frontend:
http://localhost:5173 - Backend API:
http://localhost:5000
agro-mart/
├── client/ # Frontend React Application
│ ├── public/ # Static assets
│ ├── src/
│ │ ├── components/ # Reusable UI components
│ │ ├── pages/ # Page components
│ │ ├── hooks/ # Custom React hooks
│ │ ├── redux/ # Redux store and slices
│ │ ├── utils/ # Utility functions
│ │ ├── locales/ # i18n translation files
│ │ └── App.jsx # Root component
│ ├── package.json
│ └── vite.config.js
│
├── server/ # Backend Node.js Application
│ ├── index.js # Server entry point & all routes
│ ├── package.json
│ └── .env # Environment variables
│
└── README.md
Base URL: https://agro-mart-server.vercel.app (Production) | http://localhost:5000 (Development)
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
POST |
/jwt |
Generate JWT token | ❌ |
Request Body:
{
"email": "user@example.com"
}Response:
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
POST |
/users |
Register new user | ❌ |
GET |
/users |
Get all users (paginated) | ❌ |
GET |
/user/:email |
Get user by email | ❌ |
GET |
/users/:uid |
Get user by UID | ✅ |
PATCH |
/user/:id |
Update user profile | ❌ |
PUT |
/user/role/:email |
Update user role | ❌ |
DELETE |
/user/:id |
Delete user | ✅ |
GET |
/user/role/:email |
Get user role | ✅ |
PATCH |
/users/update-coupon-enabled |
Toggle coupon for all users | ❌ |
GET /users Query Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
page |
number | 1 | Page number |
limit |
number | 5 | Items per page |
search |
string | "" | Search by name, email, or phone |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
POST |
/products |
Create new product | ❌ |
GET |
/products |
Get all products (filtered, sorted, paginated) | ❌ |
GET |
/feature-product |
Get featured products (limit 10) | ❌ |
GET |
/dashboard/product/:id |
Get single product by ID | ✅ |
PATCH |
/dashboard/product-update/:id |
Update product | ✅ |
DELETE |
/product/:id |
Delete product | ✅ |
GET /products Query Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
page |
number | 1 | Page number |
limit |
number | 6 | Items per page |
sort |
number | - | Sort by price (1 = asc, -1 = desc) |
searchQuery |
string | - | Search products by name |
selectedCategory |
string | - | Filter by category |
Response:
{
"totalItems": 100,
"currentPage": 1,
"totalPages": 17,
"products": [...]
}| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
POST |
/add-cart |
Add item to cart | ✅ |
GET |
/all-cart-items/:email |
Get user's cart items | ✅ |
PATCH |
/update-cart-item/:id |
Update cart item quantity | ✅ |
DELETE |
/delete-cart-item/:id |
Remove item from cart | ✅ |
POST /add-cart Request Body:
{
"cartData": {
"productId": "product_id",
"userInfo": {
"email": "user@example.com"
},
"quantity": 1,
"price": 100,
"name": "Product Name"
}
}| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
POST |
/add-wish |
Add item to wishlist | ✅ |
GET |
/wishlist/:email |
Get user's wishlist | ✅ |
DELETE |
/wishlist/:id |
Remove item from wishlist | ✅ |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
POST |
/create-payment-intent |
Create Stripe payment intent | ✅ |
POST |
/payments |
Process payment & save order | ✅ |
POST /create-payment-intent Request Body:
{
"totalAmount": 150.00
}Response:
{
"clientSecret": "pi_xxx_secret_xxx"
}| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
POST |
/init-payment |
Initialize SSLCommerz payment | ❌ |
POST |
/payment/success |
Payment success callback | ❌ |
POST |
/payment/fail |
Payment failure callback | ❌ |
POST |
/payment/cancel |
Payment cancel callback | ❌ |
POST |
/payment/ipn |
Instant Payment Notification | ❌ |
POST /init-payment Request Body:
{
"totalAmount": 1500,
"cartItems": [...],
"cartIds": ["cart_id_1", "cart_id_2"],
"userInfo": {
"name": "John Doe",
"email": "john@example.com"
}
}Response:
{
"GatewayPageURL": "https://sandbox.sslcommerz.com/...",
"tran_id": "uuid-transaction-id"
}| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
GET |
/orders |
Get all orders (filtered, paginated) | ❌ |
GET |
/orders/:email |
Get orders by user email | ❌ |
PATCH |
/orders/:id |
Update order status | ❌ |
GET |
/orders/download |
Download all orders as CSV | ❌ |
GET |
/orders/:id/download |
Download specific order as CSV | ❌ |
GET /orders Query Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
page |
number | 1 | Page number |
limit |
number | 10 | Items per page |
email |
string | - | Filter by email |
status |
string | - | Filter by status |
method |
string | - | Filter by payment method |
orderLimit |
number | - | Filter orders from last N days |
startDate |
string | - | Filter start date (YYYY-MM-DD) |
endDate |
string | - | Filter end date (YYYY-MM-DD) |
Response:
{
"orders": [...],
"totalOrders": 150,
"totalPages": 15
}| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
POST |
/reviews |
Submit a review | ❌ |
GET |
/reviews |
Get all reviews | ❌ |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
GET |
/admin-stats |
Get admin dashboard statistics | ❌ |
GET |
/order-stats |
Get order statistics by status | ❌ |
GET |
/weekly-sales |
Get daily sales data | ❌ |
GET |
/best-selling-products |
Get best selling products | ❌ |
GET /admin-stats Response:
{
"today": { "revenue": 5000, "orders": 12 },
"yesterday": { "revenue": 4500, "orders": 10 },
"thisMonth": { "revenue": 150000, "orders": 320 },
"allTime": { "revenue": 1500000, "orders": 5000 }
}GET /order-stats Response:
{
"totalOrders": 500,
"stats": [
{ "_id": "pending", "totalAmount": 50000, "totalOrders": 100 },
{ "_id": "completed", "totalAmount": 200000, "totalOrders": 350 },
{ "_id": "cancelled", "totalAmount": 25000, "totalOrders": 50 }
]
}For protected routes, include the JWT token in the Authorization header:
Authorization: Bearer <your_jwt_token>
{
_id: ObjectId,
name: String,
email: String,
phone: String,
role: String, // "user" | "admin" | "farmer"
couponEnabled: Boolean,
createdAt: Date
}{
_id: ObjectId,
name: String,
category: String,
price: Number,
description: String,
stockQuantity: Number,
image: String,
addedBy: String,
updatedAt: Date
}{
_id: ObjectId,
productId: String,
userInfo: {
email: String,
name: String
},
quantity: Number,
price: Number,
name: String
}{
_id: ObjectId,
productId: String,
userInfo: {
email: String,
name: String
}
}{
_id: ObjectId,
email: String,
name: String,
totalAmount: Number,
status: String, // "VALID" | "pending" | "completed" | "cancelled"
method: String,
transactionId: String,
cartIds: Array,
cartItems: Array,
productId: Array,
date: String,
invoiceNo: String,
createdAt: Date
}{
_id: ObjectId,
reviews: Object
}📝 Replace placeholder images with actual screenshots of your application
![]() |
|---|
| Ashraful Islam |
| @ashraful2871 |
| 🚀 Team Leader & Lead Developer |
![]() |
![]() |
![]() |
|---|---|---|
| Tayeba Sultana | Aalia Hammed Priom | Muntasir Mahmud Abdullah |
| @Tayebasultana | @aaliahammedpriom | @muntasir-mahmud-abdullah |
| Core Contributor | Contributor | Contributor |
Contributions are what make the open-source community an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Distributed under the ISC License. See LICENSE for more information.
If you have any questions or need support, please open an issue in the repository.




