A full-featured, modern multi-role e-commerce platform built with Django. Farm2Market directly connects farmers with buyers, enabling streamlined product listings, cart management, order tracking, and logistics coordination — eliminating the need for middlemen.
- Registration - Register with farm name, location, and bio
- Farmer Dashboard - Manage products (add, edit, view stock) from a dedicated dashboard
- Order Management - Receive and handle orders: confirm, reject, assign logistics, dispatch, and mark as delivered
- Inventory Insights - View in-stock / out-of-stock product statistics at a glance
- Real-time Notifications - Notification badges for new pending orders
- Registration - Register with a delivery address
- Product Discovery - Browse and search products by name or category
- Smart Cart - Add products to cart with support for session-based cart for unauthenticated users
- Cart Merge on Login - Anonymous cart merges seamlessly into the user account on login
- Checkout - Checkout groups items by farmer and creates separate per-farmer orders
- Order History - View past orders and real-time status updates
- Receipt Confirmation - Confirm receipt to complete an order
- Delivery Notifications - Notification badges for delivered orders
- Role-based Access Control - Views protected per user role (farmer/buyer)
- Notification System - Per-user, per-order messages surfaced as navbar badges
- Responsive UI - Shared base template with a consistent footer across all pages
- Admin Panel - All models registered and manageable via Django Admin
- Framework: Django 6.0.3
- Database: PostgreSQL via Supabase (production) / SQLite (local development)
- Authentication: Django built-in authentication
- Image Handling: Pillow 12.2
- Template Engine: Django Templates (HTML/CSS/JS)
- Icons & Styling: Custom CSS with native browser styles
- Python 3.8 or higher
- pip (Python package manager)
- Virtual environment (recommended)
- PostgreSQL / Supabase account (for production database)
git clone <repo-url>
cd Farm2Marketpy -m venv my_env
# On Windows
my_env\Scripts\activate
# On macOS/Linux
source my_env/bin/activateNavigate to the directory containing manage.py:
cd Farm2Market
pip install -r requirements.txtCopy the example file and fill in your values:
copy .env.example .envEdit .env with the following variables:
# Django Settings
SECRET_KEY=your-secret-key-here
DEBUG=True
# Database (leave unset to use local SQLite)
DATABASE_URL=postgresql://user:password@host:5432/dbname
# Supabase S3 Media Storage
AWS_ACCESS_KEY_ID=your-access-key
AWS_SECRET_ACCESS_KEY=your-secret-key
AWS_STORAGE_BUCKET_NAME=media
AWS_S3_ENDPOINT_URL=https://your-project.supabase.co/storage/v1/s3
AWS_S3_REGION_NAME=ap-southeast-1Tip: Leave
DATABASE_URLunset to use a local SQLite database for development.
Farm2Market uses Supabase Storage (S3) to handle user-uploaded product images.
- Create a Public bucket named
mediain your Supabase project. - Inside the bucket, create a folder named
product_images. - Add your S3 Connection details to the
.envfile as shown above.
# First-time or after model changes:
python manage.py makemigrations
python manage.py migratepython manage.py createsuperuserVisit http://127.0.0.1:8000/admin/ to:
- Add product
Categoryentries (Vegetables, Fruits, Grains) - Add
Logisticproviders (Pathao, Steadfast, Uber)
python manage.py runserverVisit http://127.0.0.1:8000/ in your browser.
Farm2Market/ ← Repo root
└── Farm2Market/ ← Django project root (manage.py lives here)
├── Farm2Market/ ← Project config (settings, urls, wsgi, asgi)
├── apps/
│ ├── accounts/ ← Auth, user profiles (Farmer & Buyer)
│ ├── products/ ← Product catalog & categories
│ ├── cart/ ← Shopping cart (DB + session-based)
│ ├── orders/ ← Order lifecycle & logistics
│ └── notifications/← Per-user, per-order notification system
└── templates/
├── base.html ← Shared layout
├── footer.html
├── accounts/
├── cart/
├── orders/
└── products/
-
Profile — Extends Django's
Userwith arole(farmerorbuyer). Farmers havefarm_name,farm_location, andbio; buyers have adelivery_address. -
Category — Groups products into categories (e.g., Vegetables, Fruits, Grains). One-to-many with Products.
-
Product — Listed by farmers with
name,price_per_unit,stock_quantity,unit, and an optionalimage. -
Cart / CartItem — One persistent cart per buyer. Anonymous users get a session-based cart that merges on login.
-
Order / OrderItem — Created per farmer on checkout with a price snapshot. Order status flow:
PENDING ├── CONFIRMED → ASSIGNED → OUT_FOR_DELIVERY → DELIVERED → COMPLETED ├── REJECTED (by farmer) └── CANCELLED (by buyer) -
Logistic — Delivery providers (e.g., Pathao, Steadfast) assigned by farmers at the
CONFIRMEDstage. Storesnameand an optionalcontact_number. -
Notification — Per-user, per-order messages with an
is_readflag, surfaced as navbar badges via context processors.
- Django Admin Panel - Full CRUD operations on all models
- Category Management - Create and organize product categories
- Product Management - Add and manage farmer products with images
- Order Management - View and update order statuses
- User Management - Manage farmer and buyer accounts
- Logistic Management - Add and configure delivery providers
- Stock Control - Monitor and update product inventory
- CSRF protection on all forms
- Password validation and hashing via Django's auth system
- Login-required decorators on all protected views
- Role-based access control (farmers cannot access buyer views and vice versa)
- Environment variables for sensitive configuration data
- Session security for anonymous cart management
| Variable | Required | Description |
|---|---|---|
SECRET_KEY |
Yes | Django secret key for cryptographic signing |
DEBUG |
No | True for development, False for production |
DATABASE_URL |
No | PostgreSQL connection string; defaults to SQLite |
AWS_ACCESS_KEY_ID |
Yes | Supabase S3 Access Key for image uploads |
AWS_SECRET_ACCESS_KEY |
Yes | Supabase S3 Secret Key |
AWS_STORAGE_BUCKET_NAME |
Yes | Target S3 bucket (e.g. media) |
AWS_S3_ENDPOINT_URL |
Yes | Supabase S3 Endpoint URL |
The project uses dj-database-url with a DATABASE_URL environment variable, making it straightforward to deploy on platforms like Render, Railway, or Heroku with a Supabase PostgreSQL database.
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- GitHub: @nabil0203
- GitHub: @turjo25
- GitHub: @mdsajib1473
Project documents are located in the /Reports directory:
Project_Proposal.pdf— Initial project proposalSRS.pdf— Software Requirements SpecificationProject Progress Report.pdf— Progress report
- Django Framework Documentation
- Supabase for hosted PostgreSQL
- Pillow for image handling
Some earlier commits may appear under a different author name due to initial Git configuration issues. This has been resolved, and all future commits are correctly linked to my GitHub profile.



