Connecting Nigerian farmers directly with buyers, eliminating middlemen and maximizing profits through technology.
- 🌟 Problem Statement
- 💡 Solution
- ✨ Features
- 🛠️ Tech Stack
- 🚀 Quick Start
- 📁 Project Structure
- 🗄️ Database Schema
- 🔧 API Endpoints
- 🎨 UI Components
- 🔐 Authentication
- 📦 Deployment
- 🤝 Contributing
- 📄 License
Nigeria's agricultural sector faces significant challenges that hinder growth and efficiency:
- Middleman Exploitation: Farmers receive only 30-40% of the final consumer price due to multiple intermediaries
- Price Opacity: Lack of transparent pricing information leads to unfair negotiations
- Logistics Inefficiencies: Poor transportation and delivery systems increase costs and waste
- Limited Market Access: Smallholder farmers struggle to reach urban markets and large buyers
- Information Asymmetry: Farmers lack real-time market data and buyer requirements
- Post-Harvest Losses: Inadequate storage and logistics result in 40% of produce being wasted
- Farmer Income: Average farmer earns ₦50,000-₦150,000 annually vs. potential ₦300,000+
- Food Prices: Consumers pay 2-3x the farm-gate price
- GDP Contribution: Agriculture contributes only 23% to GDP despite employing 70% of the workforce
- Youth Migration: Lack of profitability drives rural-urban migration
AgriNuel revolutionizes Nigeria's agricultural value chain by creating a digital marketplace that:
- Eliminates Middlemen: Direct farmer-buyer connections
- Provides Price Transparency: Real-time pricing data and analytics
- Optimizes Logistics: Integrated delivery tracking and route optimization
- Ensures Quality: Standardized grading and verification systems
- Builds Trust: Review systems and secure payment processing
- Direct Trading Platform: Farmers list products, buyers place orders directly
- Real-time Price Tracking: Live market data from multiple sources
- Integrated Logistics: Partnered delivery services with tracking
- Quality Assurance: Standardized grading and certification
- Community Building: Farmer cooperatives and buyer networks
- Product Listing: Easy upload with photos and detailed descriptions
- Price Optimization: Real-time market data and pricing recommendations
- Order Management: Track orders from placement to delivery
- Payment Security: Secure payment processing with instant settlements
- Logistics Support: Integrated delivery tracking and route optimization
- Community Access: Connect with other farmers and cooperatives
- Peer Networking: View other farmers' products and chat directly
- Direct Sourcing: Purchase directly from verified farmers
- Quality Assurance: View product grades, certifications, and farmer ratings
- Bulk Ordering: Place large orders with negotiated pricing
- Delivery Tracking: Real-time updates on order status and delivery
- Price Comparison: Compare prices across farmers and regions
- Scheduled Delivery: Plan deliveries for specific dates and times
- Bulk Procurement: Source large quantities for processing/distribution
- Supplier Networks: Build relationships with verified farmer groups
- Quality Standards: Access certified organic and premium products
- Logistics Management: Coordinate multi-supplier deliveries
- Analytics Dashboard: Market trends and procurement insights
- Framework: Next.js 14 (App Router)
- Language: TypeScript
- Styling: Tailwind CSS
- UI Components: Radix UI + Custom Components
- State Management: React Hooks + Context
- Icons: Lucide React
- Backend-as-a-Service: Supabase
- Database: PostgreSQL
- Authentication: Supabase Auth
- File Storage: Supabase Storage
- Real-time: Supabase Realtime
- Package Manager: pnpm
- Code Quality: ESLint + Prettier
- Git Hooks: Husky
- Environment: Node.js 18+
- Hosting: Vercel
- Database: Supabase Cloud
- CDN: Cloudflare
- Monitoring: Vercel Analytics
- Node.js 18+ and pnpm
- Supabase account and project
- Git
-
Clone the repository
git clone https://github.com/adenueltech/agrinuel.git cd agrinuel -
Install dependencies
pnpm install
-
Environment Setup
cp .env.example .env.local
Fill in your Supabase credentials:
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url NEXT_PUBLIC_SUPABASE_ANON_KEY=your_anon_key SUPABASE_SERVICE_ROLE_KEY=your_service_role_key
-
Database Setup Run the SQL scripts in
scripts/directory in order:-- Run in Supabase SQL Editor -- 01-create-tables.sql -- 02-seed-data.sql -- 03-update-market-prices.sql -- 04-seed-logistics-data.sql -- 05-seed-chat-data.sql
-
Storage Setup Create these buckets in Supabase Storage:
product-images(public)profile-images(public)
-
Start Development Server
pnpm dev
-
Open Browser
http://localhost:3000
agrinuel/
├── app/ # Next.js App Router
│ ├── (auth)/ # Authentication pages
│ ├── dashboard/ # Main dashboard
│ ├── profile/ # User profiles
│ ├── contact/ # Contact page
│ ├── api/ # API routes
│ ├── globals.css # Global styles
│ └── layout.tsx # Root layout
├── components/ # React components
│ ├── ui/ # Reusable UI components
│ ├── landing/ # Landing page sections
│ ├── marketplace/ # Product/marketplace components
│ ├── dashboard/ # Dashboard components
│ ├── auth/ # Authentication components
│ └── logistics/ # Logistics components
├── lib/ # Utility libraries
│ ├── supabase/ # Supabase configuration
│ └── utils.ts # Helper functions
├── scripts/ # Database scripts
├── public/ # Static assets
└── types/ # TypeScript definitions
CREATE TABLE users (
id UUID PRIMARY KEY REFERENCES auth.users(id),
email TEXT UNIQUE NOT NULL,
full_name TEXT NOT NULL,
phone TEXT,
user_type TEXT CHECK (user_type IN ('farmer', 'buyer')),
profile_image_url TEXT,
bio TEXT,
location JSONB,
farm_size TEXT,
experience_years INTEGER,
specializations TEXT[],
created_at TIMESTAMP DEFAULT NOW(),
updated_at TIMESTAMP DEFAULT NOW()
);CREATE TABLE products (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
farmer_id UUID REFERENCES users(id),
category_id UUID REFERENCES categories(id),
name TEXT NOT NULL,
description TEXT,
price_per_unit DECIMAL NOT NULL,
unit TEXT NOT NULL,
quantity_available INTEGER NOT NULL,
harvest_date DATE,
quality_grade TEXT,
organic BOOLEAN DEFAULT false,
location JSONB,
images TEXT[],
status TEXT DEFAULT 'available',
created_at TIMESTAMP DEFAULT NOW(),
updated_at TIMESTAMP DEFAULT NOW()
);CREATE TABLE orders (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
buyer_id UUID REFERENCES users(id),
farmer_id UUID REFERENCES users(id),
product_id UUID REFERENCES products(id),
quantity INTEGER NOT NULL,
unit_price DECIMAL NOT NULL,
total_amount DECIMAL NOT NULL,
delivery_address JSONB,
delivery_date DATE,
status TEXT DEFAULT 'pending',
created_at TIMESTAMP DEFAULT NOW()
);CREATE TABLE deliveries (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
order_id UUID REFERENCES orders(id),
driver_name TEXT,
driver_phone TEXT,
vehicle_info JSONB,
pickup_location JSONB,
delivery_location JSONB,
estimated_distance DECIMAL,
estimated_duration INTEGER,
status TEXT DEFAULT 'assigned',
created_at TIMESTAMP DEFAULT NOW()
);POST /api/auth/signup- User registrationPOST /api/auth/signin- User loginPOST /api/auth/signout- User logout
GET /api/products- List products with filtersPOST /api/products- Create new product (farmers only)PUT /api/products/[id]- Update product (owner only)DELETE /api/products/[id]- Delete product (owner only)
GET /api/orders- User's ordersPOST /api/orders- Create new orderPUT /api/orders/[id]- Update order status
GET /api/analytics/prices- Market price dataGET /api/analytics/dashboard- User dashboard stats
- Hero Section: Animated carousel with call-to-action
- Features Section: Key platform benefits
- Pricing Section: Subscription plans
- Testimonials: User success stories
- Contact Section: Contact form and information
- Marketplace: Product browsing and search
- My Products: Farmer's product management
- Analytics: Price tracking and insights
- Logistics: Delivery tracking and optimization
- Messages: Real-time chat system
- Sign Up/In Forms: Multi-step registration
- Email Verification: Account activation flow
- Password Reset: Secure password recovery
- Email/Password: Standard authentication
- Social Login: Google, Facebook (optional)
- Email Verification: Account activation
- Password Reset: Secure recovery flow
- Session Management: Automatic token refresh
- Farmers: Product listing, order management, analytics
- Buyers: Product browsing, ordering, delivery tracking
- Admins: Platform management (future feature)
-
Connect Repository
# Connect to Vercel vercel --prod -
Environment Variables Set these in Vercel dashboard:
NEXT_PUBLIC_SUPABASE_URL NEXT_PUBLIC_SUPABASE_ANON_KEY SUPABASE_SERVICE_ROLE_KEY -
Database Connection Ensure Supabase allows Vercel IP addresses
- Environment variables configured
- Database migrations run
- Storage buckets created and configured
- Email templates configured
- Domain SSL certificate
- Analytics and monitoring set up
- Fork the repository
- Create feature branch
git checkout -b feature/amazing-feature
- Make changes and test
- Commit changes
git commit -m 'Add amazing feature' - Push to branch
git push origin feature/amazing-feature
- Create Pull Request
- TypeScript: Strict type checking enabled
- ESLint: Code linting and formatting
- Prettier: Consistent code formatting
- Conventional Commits: Standardized commit messages
# Run tests
pnpm test
# Run linting
pnpm lint
# Type checking
pnpm type-checkThis project is licensed under the MIT License - see the LICENSE file for details.
- Supabase Team: For the amazing backend-as-a-service platform
- Next.js Team: For the incredible React framework
- Vercel: For seamless deployment and hosting
- Nigerian Farmers: For inspiring this solution
- Open Source Community: For the tools and libraries
- Email: support@agrinuel.com
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Built with ❤️ for Nigerian farmers and buyers
Transforming agriculture through technology - one connection at a time.