Skip to content

mSpace-dev/mspace-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

245 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŒพ AgriLink - Smart Agricultural Marketplace Platform

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.

๐Ÿ  Home Page

Image *Modern landing page with hero carousel showcasing agricultural imagery and key features*

๐Ÿ“Š Market Prices Dashboard

Image *Real-time agricultural commodity prices with filtering by category, location, and market type*

๐Ÿค– AI Demand Forecasting

Image *AI-powered agricultural market intelligence with crop demand analysis and price predictions*

๐Ÿ‘จโ€๐Ÿ’ผ Admin Panel

Image *Comprehensive admin interface for managing users, campaigns, and market data*

๐Ÿ‘ค Customer Profile

Image *User profile management with subscription preferences and price alerts*

๐Ÿ“ง Email Campaign Management

Newsletter and email campaign management system for market updates

๐Ÿ“ฑ Mobile Experience

Mobile View Responsive design optimized for mobile devices and tablets

โœจ Features

๐Ÿช Core Marketplace Features

  • 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.)

๐Ÿค– AI & Analytics

  • 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

๐Ÿ“ฑ Communication & Alerts

  • 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

๐Ÿ› ๏ธ Admin & Management

  • 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

๐Ÿš€ Technology Stack

Frontend

  • 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

Backend

  • Next.js API Routes - Serverless API endpoints
  • MongoDB - NoSQL database with Mongoose ODM
  • JWT Authentication - Secure token-based authentication
  • bcryptjs - Password hashing and security

AI & Machine Learning

  • Python FastAPI - ML model serving
  • Pandas & NumPy - Data processing and analysis
  • Scikit-learn - Machine learning algorithms
  • Custom ML Models - Price prediction and demand forecasting

Communication Services

  • Nodemailer - Email service integration
  • SMS Gateway - SMS notification service
  • Newsletter System - Automated email campaigns

DevOps & Deployment

  • Vercel - Frontend deployment and hosting
  • Netlify - Alternative deployment option
  • MongoDB Atlas - Cloud database hosting
  • Environment Configuration - Secure config management

๐Ÿ“‹ Prerequisites

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

๐Ÿ› ๏ธ Installation & Setup

1. Clone the Repository

git clone https://github.com/mSpace-dev/mspace-project.git
cd mspace-project/agrilink

2. Install Dependencies

npm install

3. Environment Configuration

Create 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:8000

4. Database Setup

Make sure MongoDB is running and accessible. The application will automatically create the necessary collections.

5. Python ML Model Setup (Optional)

cd model
pip install -r requirements.txt
python main.py

6. Run Development Server

npm run dev

The application will be available at http://localhost:3000

๐Ÿ“ Project Structure

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
โ””โ”€โ”€ ...

๐Ÿ”ง Configuration

Email Setup

  1. Configure your email provider (Gmail, Outlook, etc.)
  2. Generate an app-specific password
  3. Update the email configuration in .env.local

SMS Integration

  1. Sign up with an SMS gateway provider
  2. Obtain API credentials
  3. Configure SMS settings in the environment file

Database Configuration

  1. Set up MongoDB (local or Atlas)
  2. Create database and configure connection string
  3. The application will handle schema creation automatically

๐Ÿš€ Deployment

Vercel Deployment

  1. Connect your GitHub repository to Vercel
  2. Set environment variables in Vercel dashboard
  3. Deploy with automatic CI/CD

Netlify Deployment

  1. Build the application: npm run build
  2. Deploy the out directory to Netlify
  3. Configure environment variables

Custom Server Deployment

  1. Build the application: npm run build
  2. Start the production server: npm start
  3. Configure reverse proxy (Nginx/Apache)

๐Ÿ“Š API Documentation

Price API Endpoints

  • GET /api/prices - Fetch agricultural commodity prices
  • POST /api/prices - Add new price data (admin)
  • GET /api/prices?category=vegetables - Filter by category

User Management

  • POST /api/customer/register - Customer registration
  • POST /api/seller/register - Seller registration
  • GET /api/customer/profile - Get user profile

Alerts & Notifications

  • POST /api/alerts - Create price alerts
  • POST /api/sms/send - Send SMS notifications
  • POST /api/email/send - Send email notifications

AI & Analytics

  • POST /api/demandforecast - Get demand predictions
  • GET /api/analytics - Market analytics data

๐Ÿงช Testing

API Testing

Use the built-in API testing interface:

http://localhost:3000/api-test.html

Running Tests

# Run development server
npm run dev

# Test API endpoints
npm run test-api

# Check email functionality
npm run test-email

๐Ÿ‘จโ€๐Ÿ’ป Development

Code Style

  • Use TypeScript for type safety
  • Follow ESLint configurations
  • Use Prettier for code formatting
  • Follow Next.js best practices

Adding New Features

  1. Create API routes in src/app/api/
  2. Add corresponding pages in src/app/
  3. Update database models in src/lib/models/
  4. Test functionality using the API test interface

Database Schema

  • Users: Customer and seller profiles
  • Prices: Agricultural commodity pricing data
  • Alerts: Price alert configurations
  • Newsletters: Email subscription management
  • Analytics: Usage and market data

๐Ÿค Contributing

We welcome contributions to AgriLink! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Development Guidelines

  • 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

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ†˜ Support

For support and questions:

๐Ÿ† Acknowledgments

  • 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

๐Ÿ”ฎ Roadmap

Upcoming Features

  • 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

Version History

  • 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 ๐Ÿ‡ฑ๐Ÿ‡ฐ

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors