This is a digital platform that connects farmers directly with consumers, bypassing intermediaries and reducing the overall cost of food products. The platform allows farmers to list their produce, and consumers can purchase quality food at lower prices.
- Introduction
- Features
- Installation
- Usage
- API Endpoints
- Technologies Used
- Contributing
- License
- Authors
- User registration and login with JWT authentication
- Farmers can list their products with images
- Consumers can browse and place orders for products
- Payment Processing using Mpesa Express API
- Data pagination for product listings
- Swagger API documentation
- Multi-user authentication with role-based access
- Error handling and data validation
- CI/CD integration for code quality checks
- Human-readable date formatting
-
Clone the repository: git clone https://github.com/RichardMiruka/Farmer-to-Consumer-Application
-
Install the required dependencies: pip install -r requirements.txt
-
Set up environment variables:
Create a
.env
file in the root directory and add the following:CLOUDINARY_CLOUD_NAME=your_cloudinary_cloud_name CLOUDINARY_API_KEY=your_cloudinary_api_key CLOUDINARY_API_SECRET=your_cloudinary_api_secret SENDGRID_API_KEY=your_sendgrid_api_key
-
Run the application:
python run.py
-
Access the application in your web browser at
http://localhost:5000
. -
Register as a farmer or consumer to start using the platform.
- POST
/register
: Register as a new user (farmer or consumer). - POST
/login
: Log in and receive an access token for authentication. - POST
/products
: Create a new product listing (farmers only). - GET
/products
: Get a paginated list of available product listings. - POST
/orders
: Place an order for a product (consumers only). - GET
/orders
: Get a list of orders placed by the authenticated consumer.
- Python and Flask framework for the backend.
- Flask-RESTx for API documentation.
- Flask-JWT-Extended for JWT authentication.
- Flask-WTF for form handling and validation.
- SQLAlchemy for database management.
- Cloudinary for image uploads and storage.
- Sendgrid for email notifications.
- Frontend technologies (HTML, CSS, JavaScript) for the user interface.
Contributions to the Farmer-to-Consumer Platform are welcome! Please follow the standard guidelines for contributing to open-source projects.
This project is licensed under the MIT License.
# Farmer-to-Consumer-App