AgriLink is a comprehensive digital platform designed to revolutionize agricultural commerce in Sri Lanka. It provides real-time market prices, AI-powered demand forecasting, and seamless connectivity between farmers, sellers, and consumers.
*Modern landing page with hero carousel showcasing agricultural imagery and key features*
*Real-time agricultural commodity prices with filtering by category, location, and market type*
*AI-powered agricultural market intelligence with crop demand analysis and price predictions*
*Comprehensive admin interface for managing users, campaigns, and market data*
*User profile management with subscription preferences and price alerts*
Newsletter and email campaign management system for market updates
Responsive design optimized for mobile devices and tablets
- Real-time Price Tracking: Live agricultural commodity prices from wholesale and retail markets
- Market Intelligence: AI-powered price forecasting and demand analysis
- Multi-user Support: Separate interfaces for farmers, sellers, consumers, and traders
- Location-based Services: District and province-wise market data
- Category Management: Organized by product categories (vegetables, fruits, grains, etc.)
- Demand Forecasting: Machine learning models for crop demand prediction
- Price Trend Analysis: Historical data analysis and future price projections
- Market Insights: AI-generated recommendations for farmers and traders
- Real-time Analytics: Live market condition monitoring
- SMS Notifications: Automated price alerts via SMS
- Email Newsletters: Weekly market digests and price updates
- Push Notifications: Real-time alerts for significant price changes
- Chatbot Support: AI-powered customer support in multiple languages
- Content Management: Admin panel for managing users, campaigns, and data
- Analytics Dashboard: Comprehensive business intelligence and reporting
- Campaign Management: Email marketing and customer engagement tools
- User Management: Registration, authentication, and profile management
- Next.js 15 - React framework with App Router
- TypeScript - Type-safe JavaScript
- Tailwind CSS - Utility-first CSS framework
- Lucide React - Modern icon library
- Recharts - Data visualization library
- Next.js API Routes - Serverless API endpoints
- MongoDB - NoSQL database with Mongoose ODM
- JWT Authentication - Secure token-based authentication
- bcryptjs - Password hashing and security
- Python FastAPI - ML model serving
- Pandas & NumPy - Data processing and analysis
- Scikit-learn - Machine learning algorithms
- Custom ML Models - Price prediction and demand forecasting
- Nodemailer - Email service integration
- SMS Gateway - SMS notification service
- Newsletter System - Automated email campaigns
- Vercel - Frontend deployment and hosting
- Netlify - Alternative deployment option
- MongoDB Atlas - Cloud database hosting
- Environment Configuration - Secure config management
Before running this project, make sure you have:
- Node.js (v18.0.0 or higher)
- npm or yarn package manager
- MongoDB database (local or cloud)
- Python 3.8+ (for ML model)
- Git for version control
git clone https://github.com/mSpace-dev/mspace-project.git
cd mspace-project/agrilinknpm installCreate a .env.local file in the agrilink directory:
# Database Configuration
MONGODB_URI=mongodb://localhost:27017/agrilink
DB_NAME=Agrilink
# Authentication
JWT_SECRET=your-super-secure-jwt-secret-key
NEXTAUTH_SECRET=your-nextauth-secret-key
NEXTAUTH_URL=http://localhost:3000
# Email Configuration
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_USER=your-email@gmail.com
EMAIL_PASS=your-app-password
# SMS Configuration
SMS_API_KEY=your-sms-gateway-api-key
SMS_API_URL=your-sms-provider-url
# Application Configuration
NEXT_PUBLIC_BASE_URL=http://localhost:3000
ADMIN_API_KEY=your-admin-api-key
# ML Model Configuration
ML_MODEL_URL=http://localhost:8000Make sure MongoDB is running and accessible. The application will automatically create the necessary collections.
cd model
pip install -r requirements.txt
python main.pynpm run devThe application will be available at http://localhost:3000
agrilink/
โโโ src/
โ โโโ app/ # Next.js app directory
โ โ โโโ api/ # API routes
โ โ โ โโโ admin/ # Admin management APIs
โ โ โ โโโ prices/ # Price data APIs
โ โ โ โโโ alerts/ # Notification APIs
โ โ โ โโโ email/ # Email service APIs
โ โ โ โโโ ...
โ โ โโโ admin/ # Admin dashboard pages
โ โ โโโ customer/ # Customer portal pages
โ โ โโโ prices/ # Market prices pages
โ โ โโโ demandforecast/ # AI forecasting pages
โ โ โโโ ...
โ โโโ components/ # Reusable React components
โ โโโ lib/ # Utility libraries
โ โ โโโ dbConnect.ts # Database connection
โ โ โโโ emailService.ts # Email functionality
โ โ โโโ models/ # Database models
โ โ โโโ ...
โ โโโ scripts/ # Utility scripts
โโโ model/ # Python ML models
โ โโโ main.py # FastAPI ML server
โ โโโ generatedata.py # Data generation
โ โโโ model.ipynb # Jupyter notebook
โโโ public/ # Static assets
โ โโโ images/ # Application images
โ โโโ test-*.html # API testing pages
โโโ screenshots/ # Application screenshots
โโโ ...
- Configure your email provider (Gmail, Outlook, etc.)
- Generate an app-specific password
- Update the email configuration in
.env.local
- Sign up with an SMS gateway provider
- Obtain API credentials
- Configure SMS settings in the environment file
- Set up MongoDB (local or Atlas)
- Create database and configure connection string
- The application will handle schema creation automatically
- Connect your GitHub repository to Vercel
- Set environment variables in Vercel dashboard
- Deploy with automatic CI/CD
- Build the application:
npm run build - Deploy the
outdirectory to Netlify - Configure environment variables
- Build the application:
npm run build - Start the production server:
npm start - Configure reverse proxy (Nginx/Apache)
GET /api/prices- Fetch agricultural commodity pricesPOST /api/prices- Add new price data (admin)GET /api/prices?category=vegetables- Filter by category
POST /api/customer/register- Customer registrationPOST /api/seller/register- Seller registrationGET /api/customer/profile- Get user profile
POST /api/alerts- Create price alertsPOST /api/sms/send- Send SMS notificationsPOST /api/email/send- Send email notifications
POST /api/demandforecast- Get demand predictionsGET /api/analytics- Market analytics data
Use the built-in API testing interface:
http://localhost:3000/api-test.html
# Run development server
npm run dev
# Test API endpoints
npm run test-api
# Check email functionality
npm run test-email- Use TypeScript for type safety
- Follow ESLint configurations
- Use Prettier for code formatting
- Follow Next.js best practices
- Create API routes in
src/app/api/ - Add corresponding pages in
src/app/ - Update database models in
src/lib/models/ - Test functionality using the API test interface
- Users: Customer and seller profiles
- Prices: Agricultural commodity pricing data
- Alerts: Price alert configurations
- Newsletters: Email subscription management
- Analytics: Usage and market data
We welcome contributions to AgriLink! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow the existing code style and conventions
- Add proper TypeScript types for new functions
- Update documentation for new features
- Test your changes thoroughly
- Add comments for complex logic
This project is licensed under the MIT License - see the LICENSE file for details.
For support and questions:
- Email: support@agrilink.lk
- Documentation: docs.agrilink.lk
- Issues: GitHub Issues
- Sri Lankan Department of Agriculture for market data partnership
- Local farmers and agricultural communities for feedback
- Open source community for the amazing tools and libraries
- Development team at mSpace for continuous innovation
- Mobile App: Native iOS and Android applications
- Blockchain Integration: Supply chain transparency
- IoT Integration: Real-time field monitoring
- Multi-language Support: Sinhala and Tamil interfaces
- Payment Gateway: Direct farmer-to-consumer transactions
- Weather Integration: Weather-based price predictions
- v2.0 - AI-powered demand forecasting and enhanced UI
- v1.5 - SMS alerts and mobile optimization
- v1.0 - Initial release with basic price tracking
Made with โค๏ธ for Sri Lankan Agriculture ๐ฑ๐ฐ