An AI-Enhanced Permissioned Blockchain Platform for Traceable, Predictive, and Inclusive Tobacco Supply Chains in Zimbabwe
# AI-Enhanced Zimbabwe Tobacco Supply Chain Platform — Backend
Production-ready Django backend for the Zimbabwe tobacco supply chain traceability platform. Supports farmer onboarding, role-based access, traceability event capture, document hashing/verification, blockchain proof anchoring, AI assistant workflows, offline-first sync, and regulator-grade provenance queries.
## Tech Stack
- **Django 5.1** + Django REST Framework
- **PostgreSQL 16** — primary database
- **Redis 7** — cache + Celery broker
- **Celery** — async task processing
- **Web3.py** — blockchain integration (mock + real adapters)
- **LangChain + OpenAI** — agentic AI assistant
- **MinIO** — S3-compatible document storage
- **drf-spectacular** — OpenAPI documentation
- **Docker Compose** — full local deployment
## Quick Start
### 1. Clone & Setup Environment
```bash
cd backend
cp .env.example .env
```
### 2. Docker Compose (Recommended)
```bash
docker-compose up --build
```
This starts: Django, PostgreSQL, Redis, MinIO, Celery Worker, Celery Beat, Nginx.
### 3. Run Migrations
```bash
docker-compose exec web python manage.py migrate
```
### 4. Create Superuser
```bash
docker-compose exec web python manage.py createsuperuser
```
### 5. Seed Test Data
```bash
docker-compose exec web python manage.py seed_data
```
To remove seeded rows (dev/demo): `python manage.py unseed_data` (use `--dry-run` first). Identifiers are defined in `apps/accounts/seed_constants.py`.
This creates test users for all roles:
| Role | Email | Password |
|------|-------|----------|
| Farmer | tafadzwa@example.com | farmer12345 |
| Farmer | chipo@example.com | farmer12345 |
| Buyer | james@zlt.co.zw | buyer12345 |
| Auditor | grace@timb.gov.zw | auditor12345 |
| Admin | admin@tobacco.zw | admin12345 |
### 6. Access
- **API**:
localhost
- **Swagger Docs**:
localhost
- **Admin Panel**:
localhost
- **MinIO Console**:
localhost
### Flutte …