A mobile-first SaaS system for milk distribution businesses in Kenya, featuring real-time delivery tracking, automated invoicing, and M-Pesa reconciliation.
Milk Delivery System
A mobile-first SaaS system for milk distribution businesses in Kenya, featuring real-time delivery tracking, automated invoicing, and M-Pesa reconciliation.
## Features
- **Mobile-First Delivery Interface**: Optimized for low-end Android devices on 3G networks
- **Anti-Dispute System**: Tamper-resistant delivery records with customer confirmations
- **SMS Integration**: Real-time customer notifications via Africa's Talking API
- **M-Pesa Integration**: Automated Paybill reconciliation via Safaricom Daraja API
- **Thermal Receipt Printing**: Mobile-optimized receipt generation
- **Admin Dashboard**: Real-time metrics and customer management
- **Audit Trail**: Complete transaction history for dispute resolution
## Tech Stack
- **Backend**: Node.js + Express + PostgreSQL
- **Frontend**: React + TailwindCSS
- **Authentication**: JWT
- **APIs**: Africa's Talking (SMS), Safaricom Daraja (M-Pesa)
- **Database**: PostgreSQL
## Quick Start
```bash
# Install dependencies
npm install
# Set up environment variables
cp .env.example .env
# Run database migrations
npm run migrate
# Start development server
npm run dev
```
## Architecture
```
├── backend/ # Node.js API server
│ ├── src/
│ │ ├── controllers/ # Route handlers
│ │ ├── models/ # Database models
│ │ ├── services/ # Business logic
│ │ ├── middleware/ # Auth, validation
│ │ └── routes/ # API endpoints
│ └── package.json
├── frontend/ # React app
│ ├── src/
│ │ ├── components/ # UI components
│ │ ├── pages/ # Page components
│ │ ├── services/ # API calls
│ │ └── utils/ # Helpers
│ └── package.json
└── database/ # Migrations and seeds
└── migrations/
```
## Security
- JWT-based authentication
- Role-based access control (Admin/Delivery Agent)
- Input validation and sanitization
- Webhook verification for M-Pesa callbacks
- HTTPS enforcement in product …