# Kenya Delivery Platform - Complete Setup Guide
## π¦ Project Overview
A complete delivery platform connecting clients with boda boda riders for instant document and goods delivery across Kenya.
### Key Features
β
Client posting system with M-Pesa payment
β
Rider subscription management (5-day free trial)
β
Real-time GPS tracking with Socket.IO
β
M-Pesa Daraja API integration
β
SMS notifications (Africa's Talking)
β
Google Maps distance calculation
β
Admin verification system
β
PWA-ready frontend
---
## π BACKEND SETUP
### Prerequisites
- Node.js 16+ and npm
- MongoDB Atlas account (free tier works)
- M-Pesa Daraja API credentials (sandbox for testing)
- Africa's Talking account (for SMS)
- Google Maps API key
- Cloudinary account (for image uploads)
### Step 1: Install Dependencies
```bash
cd backend
npm install
```
### Step 2: Configure Environment Variables
Create a `.env` file by copying `.env.example`:
```bash
cp .env.example .env
```
### Step 3: Fill in YOUR Credentials
Open `.env` and replace ALL placeholder values:
#### MongoDB
Get from
cloud.mongodb.com
```env
MONGODB_URI=mongodb+srv://YOUR_USERNAME:YOUR_PASSWORD@
cluster0.xxxxx.mongodb.net
```
#### JWT Secret
Generate a strong secret:
```bash
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
```
Paste the output into:
```env
JWT_SECRET=your_generated_secret_here
```
#### M-Pesa Daraja API
Sign up at:
developer.safaricom.co.ke
```env
MPESA_CONSUMER_KEY=your_consumer_key
MPESA_CONSUMER_SECRET=your_consumer_secret
MPESA_PASSKEY=your_lipa_na_mpesa_passkey
MPESA_SHORTCODE=your_paybill_number
MPESA_ENVIRONMENT=sandbox
MPESA_BASE_URL=
sandbox.safaricom.co.ke
MPESA_CALLBACK_URL=
your-deployed-backend.com
```
#### Africa's Talking (SMS)
Sign up at:
africastalking.com
```env
SMS_API_KEY=your_api_key
SMS_USERNAME=your_username
SMS_SENDER_ID=DELIVERY
```
#### Cloudinary (Image Upload)
Sign up at:
cloudin β¦