Hambana — marketplace and logistics for Iraq
Hambana is a production e-commerce and delivery ecosystem built for the Iraqi market: multi-vendor storefronts, real-time order tracking, and in-app voice and video between buyers and sellers. It is the largest single system I have shipped, and it is where most of my opinions about backend architecture come from.
Architecture
- API: a NestJS monolith organised into 21 domain modules (catalog, cart, checkout, payments, logistics, dispatch, chat, notifications, vendors, reviews, and more) sharing one Prisma schema over PostgreSQL with PostGIS for geospatial dispatch.
- Clients: Flutter buyer and vendor apps from a shared package set, plus a Next.js vendor portal for inventory and analytics.
- Real time: self-hosted LiveKit with a TURN server for WebRTC audio and video, and WebSocket channels for order state and courier location.
- Background work: BullMQ queues on Redis for payment reconciliation, notification fan-out, and scheduled jobs.
Security and reliability
- TOTP multi-factor authentication for vendor and admin accounts.
- Certificate-pinned TLS in the mobile apps.
- Role-scoped authorization at the module boundary, audited in CI.
- 677 automated checks (unit, integration, and end-to-end) gate every merge.
Performance
Load tests against the staging cluster hold a p95 response time under 800 ms at 300 concurrent virtual users on the hot checkout and search paths.
Why it matters
Hambana taught me how a system behaves after the demo: queue backlogs, retry storms, geospatial edge cases, and app-store release trains. Everything in Reguant, arch-guard, and Zagros exists because of problems first met here.