Chhatrapati-sahu-09/Cropshare-connect-farmers-to-NGOs
CropShare bridges farmers and NGOs through a digital platform that streamlines crop donations, logistics coordination, and real-time communication to ensure surplus produce reaches those in need.
Key Challenges:
- Information Asymmetry: Farmers and NGOs lack visibility into each other's needs and availability
- Logistical Barriers: No streamlined system for coordinating pickups and deliveries
- Communication Gaps: Limited channels for direct farmer-NGO interaction
- Resource Waste: Surplus crops often go to waste instead of reaching those in need
- Geographic Limitations: Local solutions needed for fresh produce distribution
🎯 Solution Overview
CropShare is a comprehensive digital platform that bridges the gap between farmers and NGOs, enabling seamless crop donation and distribution workflows. The platform provides:
- Direct Farmer-NGO Connections: Real-time marketplace for crop listings and requests
- Intelligent Matching: Smart algorithms to connect surplus with need
- Logistics Management: Integrated pickup and delivery coordination
- Communication Tools: Built-in messaging and notification systems
- Multi-language Support: Google Translate integration for accessibility
- Weather Intelligence: Real-time weather alerts for crop protection
- Role-based Dashboards: Tailored interfaces for farmers and NGO
🚀 Features & Workflows
1. User Authentication & Role Management
Workflow:
- User registers as Farmer or NGO with profile information
- Email verification and account activation
- Role-based access to platform features
- Profile management and preferences
Technical Implementation:
- JWT-based authentication
- Role-based middleware protection
- Secure password hashing
- Session management
2. Farmer Crop Management
Workflow:
- Farmer logs in and accesses dashboard
- Adds new crop listings with details (type, quantity, location, price)
- Manages existing listings (edit, delete, update status)
- Views incoming NGO requests
- Approves/rejects pickup requests
- Tracks donation history and earnings
Key Features:
- Image upload for crop verification
- Real-time listing status updates
- Request management interface
- Donation tracking and analytics
3. NGO Marketplace & Requests
Workflow:
- NGO browses available crop listings
- Filters by crop type, location, quantity
- Sends requests to farmers with specific needs
- Manages sent requests and responses
- Initiates pickup scheduling for approved requests
- Tracks ecosystem partnerships
Key Features:
- Advanced search and filtering
- Farmer profile viewing
- Request status tracking
- Ecosystem analytics
4. Real-time Communication
Workflow:
- Users initiate chats from crop listings or requests
- Real-time messaging with typing indicators
- File/image sharing capabilities
- Message history and archiving
- Notification system for new messages
Technical Implementation:
- Socket.io for real-time communication
- Message encryption and privacy
- File upload handling
- Push notifications
5. Pickup & Delivery Operations
Workflow:
- NGO initiates pickup request for approved crops
- Farmer receives and responds to pickup requests
- Logistics coordination (date, time, location)
- Status tracking through pickup lifecycle
- Completion confirmation and feedback
Key Features:
- GPS-based location coordination
- Real-time status updates
- Automated notifications
- Quality assurance checkpoints
6. Weather Intelligence & Alerts
Workflow:
- System monitors local weather conditions
- Generates alerts for farmers based on location
- Weather impact analysis for crops
- Preventive action recommendations
- Historical weather data tracking
Integration:
- External weather API integration
- Location-based alerts
- Crop-specific weather recommendations
7. Multi-language Support
Workflow:
- Automatic language detection
- Google Translate widget integration
- User language preferences
- Translated UI elements and content
Technical Implementation:
- Google Translate API integration
- Cookie-based language persistence
- RTL language support
8. Dashboard Analytics
Farmer Dashboard:
- Crop listing performance
- Donation statistics
- Earnings tracking
- NGO connection metrics
- Weather alerts summary
NGO Dashboard:
- Request success rates
- Connected farmers overview
- Pickup operation status
- Ecosystem insights
- Available crop marketplace
🛠 Tech Stack
Frontend
- React 19+ - Modern UI framework
- Vite - Fast build tool and dev server
- React Router - Client-side routing
- Axios - HTTP client for API calls
- Socket.io-client - Real-time communication
- React Icons - Icon library
- CSS Modules - Component-scoped styling
Backend
- Node.js - Runtime environment
- Express.js - Web framework
- MongoDB - NoSQL database
- Mongoose - ODM for MongoDB
- Socket.io - Real-time bidirectional communication
- JWT - Authentication tokens
- bcryptjs - Password hashing
- multer - File upload handling
External Services
- Google Translate - Multi-language support
- Weather API - Weather data and alerts
- Email Service - User notifications
📋 Prerequisites
- Node.js 20.13.1 or higher
- MongoDB 4.4+ or MongoDB Atlas
- npm or yarn package manager
Screenshots
Landing Page
The CropShare landing page introduces the platform's mission to empower farmers, support NGOs, and reduce food waste. It provides clear navigation, language toggle support (Hindi/English), and call-to-action buttons for farmers and NGOs to get started.Crop Marketplace
This page displays a list of available crops shared by farmers. Users can search by crop name, farmer, or location, apply category and location filters, and view essential details such as quantity, price, and posting time.Interactive Map View
The map view allows users to find crops near their location using an interactive map powered by OpenStreetMap. Each marker represents a crop listing, showing quick details like price and quantity for location-based discovery.Farmer Dashboard
The farmer dashboard provides an overview of crop health alerts, weather conditions, storage suitability, and pickup or delivery status. It helps farmers track active requests and manage logistics efficiently.Real-time Chat Interface
The integrated chat interface enables direct communication between farmers, buyers, and NGOs. Users can negotiate quantity, price, and pickup details in real time, ensuring transparent and efficient coordination.Donate to NGOs
This section allows farmers to donate surplus crops directly to nearby NGOs. It displays verified organizations with their locations and needs, enabling farmers to contribute to food distribution and social impact initiatives. ## 🌾 Problem StatementIn many developing regions, farmers face significant challenges with crop surplus and food waste, while NGOs struggle to source fresh, locally-grown produce for their community programs. The lack of efficient platforms creates barriers between farmers who have excess crops and NGOs that need them for distribution to vulnerable populations.
🚀 Installation & Setup
1. Clone the Repository
git clone https://github.com/Chhatrapati-sahu-09/Cropshare-connect-farmers-to-NGOs.git
cd Cropshare-connect-farmers-to-NGOs2. Backend Setup
cd server
npm installCreate .env file in server directory:
PORT=5000
MONGODB_URI=mongodb://localhost:27017/cropshare
JWT_SECRET=your_jwt_secret_key
EMAIL_USER=your_email@gmail.com
EMAIL_PASS=your_email_password
WEATHER_API_KEY=your_weather_api_key
GOOGLE_TRANSLATE_API_KEY=your_google_translate_keyStart the backend server:
npm start3. Frontend Setup
cd ../client
npm installCreate .env file in client directory:
VITE_API_BASE_URL=http://localhost:5000/api
VITE_SOCKET_URL=http://localhost:5000Start the frontend development server:
npm run dev4. Database Setup
Ensure MongoDB is running locally or configure MongoDB Atlas connection.
📖 Usage
For Farmers:
- Register/Login as a farmer
- Complete your profile with location and farming details
- Add crop listings with photos and specifications
- Monitor incoming NGO requests
- Coordinate pickups for approved donations
- Track your impact and earnings
For NGOs:
- Register/Login as an NGO
- Set up organization profile and focus areas
- Browse available crops in your region
- Send requests to farmers for specific needs
- Manage pickup logistics
- Build and track farmer partnerships
🔌 API Documentation
Authentication Endpoints
POST /api/auth/register- User registrationPOST /api/auth/login- User loginGET /api/auth/profile- Get user profile
Crop Management
GET /api/crops- Get all crops (with filters)POST /api/crops- Add new crop (farmer only)PUT /api/crops/:id- Update cropDELETE /api/crops/:id- Delete crop
Request Management
GET /api/requests- Get user requestsPOST /api/requests- Send crop requestPUT /api/requests/:id- Update request status
Messaging
GET /api/messages/:userId- Get conversationPOST /api/messages- Send messageGET /api/messages/unread- Get unread count
Pickup Operations
GET /api/pickups- Get pickups for userPOST /api/pickups- Create pickup requestPUT /api/pickups/:id- Update pickup status
🚀 Future Enhancements
We're continuously working to improve CropShare and expand its capabilities. Here are some planned enhancements:
💳 Online Payment Integration
- Secure payment processing for crop purchases
- Multiple payment methods (UPI, cards, net banking)
- Transaction history and receipts
- Revenue tracking for farmers
📦 Order Tracking System
- Real-time GPS tracking for pickups and deliveries
- ETA predictions and route optimization
- Delivery confirmation with photos
- Automated status updates via SMS/email
🏛️ Government Scheme Integration
- Integration with agricultural subsidy programs
- Automatic eligibility checking
- Scheme benefit tracking and reporting
- Government certification verification
🤖 AI-based Price Recommendations
- Machine learning models for fair pricing
- Market trend analysis and predictions
- Crop quality assessment for pricing
- Dynamic pricing based on demand and supply
🌐 Regional Language Support
- Support for major Indian languages (Hindi, Tamil, Telugu, etc.)
- Voice-based input and commands
- Localized content and notifications
- Cultural adaptation for different regions
🤝 Contributing
- Fork the repository
- Create a 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
Development Guidelines
- Follow ESLint configuration
- Write meaningful commit messages
- Test API endpoints thoroughly
- Maintain component documentation
- Ensure responsive design
� Deployment on Render
Prerequisites for Deployment
- Render account (free tier available)
- MongoDB Atlas account (for database)
- GitHub repository access
Step 1: Prepare Environment Variables
Backend (.env)
NODE_ENV=production
PORT=10000
MONGODB_URI=your_mongodb_atlas_connection_string
JWT_SECRET=your_secure_jwt_secret
EMAIL_USER=your_email@gmail.com
EMAIL_PASS=your_app_password
WEATHER_API_KEY=your_weather_api_key
GOOGLE_TRANSLATE_API_KEY=your_translate_key
CLIENT_URL=https://your-client-app.onrender.comFrontend (.env)
VITE_API_BASE_URL=https://your-server-app.onrender.com/api
VITE_SOCKET_URL=https://your-server-app.onrender.comStep 2: Deploy Backend (Web Service)
- Go to Render Dashboard
- Click "New" → "Web Service"
- Connect your GitHub repository
- Configure service:
- Name:
cropshare-server - Runtime:
Node - Build Command:
npm install - Start Command:
npm start - Root Directory:
server
- Name:
- Add environment variables from Step 1
- Click "Create Web Service"
Step 3: Deploy Frontend (Static Site)
- Click "New" → "Static Site" in Render
- Connect your GitHub repository
- Configure site:
- Name:
cropshare-client - Build Command:
npm run build - Publish Directory:
client/dist - Root Directory:
client
- Name:
- Add frontend environment variables
- Click "Create Static Site"
Step 4: Update CORS Configuration
After deployment, update the backend environment variable:
CLIENT_URL=https://cropshare-client.onrender.com
Step 5: Database Setup
- Create MongoDB Atlas cluster
- Whitelist Render IP addresses (0.0.0.0/0 for development)
- Update
MONGODB_URIin backend environment variables
Step 6: Testing Deployment
- Visit your frontend URL
- Test user registration/login
- Verify API calls work
- Test real-time features (chat)
- Check responsive design
- Verify health check endpoint:
https://your-server-app.onrender.com/api/health
Alternative: Using render.yaml
If you prefer automated deployment:
- Ensure
render.yamlis in your repository root - Push changes to GitHub
- In Render dashboard, select "Blueprint" when creating new services
- Render will automatically create both services
Troubleshooting Common Issues
Build Failures
- Check Node.js version compatibility
- Verify all dependencies are listed in package.json
- Check build logs for specific errors
CORS Errors
- Ensure CLIENT_URL matches your frontend domain
- Check if environment variables are set correctly
- Verify backend is redeployed after CORS changes
Database Connection
- Verify MongoDB Atlas IP whitelist
- Check connection string format
- Ensure database user has correct permissions
Real-time Features
- Confirm Socket.io configuration
- Check firewall settings
- Verify environment variables
Production Optimizations
-
Enable gzip compression
-
Set up CDN for static assets
-
Configure monitoring and logging
-
Set up backup strategies
-
Implement rate limiting
mermaid-diagram (1).png
�📄 License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
🙏 Acknowledgments
- Farmers and NGOs for their invaluable input
- Open source community for amazing tools and libraries
- Weather API providers for environmental data
- Google Translate for accessibility features
📞 Support
For support, email support@cropshare.com or join our Discord community.
Built with ❤️ for sustainable agriculture and community welfare"






