AgriBridge is a comprehensive agricultural marketplace platform that facilitates seamless interactions between farmers, buyers, middlemen, and transporters through role-specific digital interfaces.
AgriBridge connects various stakeholders in the agricultural supply chain, enabling:
- Farmers to list and sell their agricultural products
- Buyers to browse products and place bids
- Middlemen to facilitate transactions between farmers and buyers
- Transporters to offer logistics services for product delivery
The platform streamlines the agricultural supply chain by creating direct connections between stakeholders, eliminating inefficiencies, and providing transparency in transactions.
- Multi-role authentication system (farmer, buyer, middleman, transporter, admin)
- Role-specific dashboards and functionality
- Secure login and registration
- Create and manage product listings
- Review and respond to bids
- Request transport services
- Manage farm profile and certifications
- Verification system for trusted selling
- Browse available agricultural products
- Place bids on products
- Request transport for purchased products
- Message farmers directly
- View available transport requests
- Accept transport jobs
- Update delivery status
- Manage transport schedule
- In-app messaging between users
- Notifications for new bids, accepted offers, and delivery updates
- React: UI library for building the user interface
- TypeScript: Type-safe JavaScript for better developer experience
- Tailwind CSS: Utility-first CSS framework for styling
- shadcn/ui: Component library for a consistent design system
- TanStack Query: Data fetching and state management
- React Hook Form: Form handling with validation
- Wouter: Lightweight routing library
- Zod: Schema validation for forms and data
- Node.js: JavaScript runtime for the server
- Express: Web framework for handling API requests
- PostgreSQL: Database for persistent storage
- Drizzle ORM: Type-safe database toolkit
- Passport.js: Authentication middleware
- WebSockets: Real-time communication (for messaging)
agriBridge/
├── client/ # Frontend React application
│ ├── src/
│ │ ├── components/ # Reusable UI components
│ │ │ ├── bids/ # Bid-related components
│ │ │ ├── dashboard/ # Dashboard components
│ │ │ ├── layout/ # Layout components (header, footer)
│ │ │ ├── messages/ # Messaging components
│ │ │ ├── products/ # Product-related components
│ │ │ ├── transport/ # Transport-related components
│ │ │ └── ui/ # Shadcn UI components
│ │ ├── hooks/ # Custom React hooks
│ │ ├── lib/ # Utility functions
│ │ ├── pages/ # Page components
│ │ └── App.tsx # Main application component
├── server/ # Backend Express application
│ ├── auth.ts # Authentication setup
│ ├── index.ts # Server entry point
│ ├── routes.ts # API routes
│ ├── seed-data.ts # Database seeding
│ ├── storage.ts # Data storage interface
│ └── vite.ts # Vite configuration for the server
├── shared/ # Shared code between client and server
│ └── schema.ts # Database schema and types
├── drizzle.config.ts # Drizzle ORM configuration
├── package.json # Project dependencies
├── tsconfig.json # TypeScript configuration
└── vite.config.ts # Vite configuration
The application uses the following data models:
Represents all users of the platform with role-specific fields:
- Core fields: id, username, password, fullName, email, phone, role, location
- Farmer-specific fields: farmName, farmBio, farmAddress, verificationId, certifications
Agricultural products listed by farmers:
- Core fields: id, farmerId, name, category, description, quantity, unit, price, currency, location
- Status tracking: active, sold, expired
Offers made by buyers on products:
- Core fields: id, productId, buyerId, amount, quantity, message
- Status tracking: pending, accepted, rejected, countered
Logistics requests for product delivery:
- Core fields: id, productId, requesterId, transporterId, pickupLocation, deliveryLocation, quantity, date
- Status tracking: pending, accepted, in_transit, delivered
Communication between users:
- Core fields: id, senderId, receiverId, content, read, createdAt
- Node.js (v20.x or higher)
- npm (v10.x or higher)
- PostgreSQL (v16.x)
-
Clone the repository:
git clone https://github.com/yourusername/agriBridge.git cd agriBridge
-
Install dependencies:
npm install
-
Set up environment variables:
- Create a
.env
file in the root directory - Add the following variables:
DATABASE_URL=postgresql://user:password@localhost:5432/agriBridge SESSION_SECRET=your_session_secret
- Create a
-
Start the development server:
npm run dev
-
Open http://localhost:5000 in your browser to see the application.
npm run dev
: Start the development servernpm run build
: Build the production applicationnpm run start
: Start the production servernpm run db:migrate
: Run database migrationsnpm run db:seed
: Seed the database with initial data
The API is organized around RESTful resources:
POST /api/register
: Register a new userPOST /api/login
: Login a userGET /api/logout
: Logout a userGET /api/user
: Get the current user
GET /api/products
: List all productsGET /api/products/:id
: Get a specific productPOST /api/products
: Create a new product (farmer only)PATCH /api/products/:id
: Update a product (owner only)GET /api/user/products
: Get products owned by the current user
POST /api/bids
: Place a bid on a product (buyer/middleman only)GET /api/products/:id/bids
: Get bids for a specific productGET /api/user/bids
: Get bids placed by the current userPATCH /api/bids/:id/status
: Update bid status (farmer only)
POST /api/transport
: Create a transport requestGET /api/transport/requester
: Get transport requests created by the current userGET /api/transport/transporter
: Get transport requests assigned to the current user (transporter only)GET /api/transport/available
: Get available transport requests (transporter only)PATCH /api/transport/:id/status
: Update transport request status
POST /api/messages
: Send a messageGET /api/messages/:userId
: Get messages between the current user and another userGET /api/messages/unread
: Get unread messages for the current userPATCH /api/messages/:id/read
: Mark a message as read
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License.