Real-time Ops
Case Study
Smart Irrigation Zambia
Smart Irrigation Zambia — Full-stack e-commerce and operations platform for selling, quoting, and installing irrigation systems across Zambia
Overview
Smart Irrigation Zambia is a Next.js 16 web application serving farmers (self-serve 5-step ordering with geolocation and site photos) and an admin operations team (live SSE dashboard, farm map, status pipeline).
Architecture
Browser (React 19) -> Next.js App Router (Server Actions/RSC) -> Prisma 7 -> PostgreSQL 16; SSE stream via /api/events over in-memory pub/sub.Key Design Decisions
- Server Actions for mutations; Route Handlers only where needed
- In-memory realtime bus for SSE broadcasts
- Client-only maps via dynamic import with ssr: false
- Mockable payment layer separated from order logic
Features Implemented
Customer Ordering
- Product grid with type filters
- 5-step checkout: customer, location, farm, payment, confirm
- Geolocation + draggable map
- Site photo uploads
- Order tracking by ID or phone
Admin Operations
- Dashboard counts and revenue
- Live orders table via SSE with toast + chime
- Order detail with timeline and map
- Product CRUD
- Farm map with all farms
Challenges & Solutions
In-memory realtime bus is process-local
Replace with Redis pub/sub for multi-instance.
Future Enhancements
- Real payment provider integration
- Object storage for photos
- Tests and CI
Deployment
Frontend
Vercel
Backend
Database
PostgreSQL (Docker)
CI/CD
GitHub Actions
Tech Stack
Next.jsReactTypeScriptTailwind CSSPrismaPostgreSQLNextAuth