
Mia Bhai ChanaChur ERP
Order management ERP with real-time GPS field-sales tracking — live map, geofencing, and event classification for a snack-food distribution business.
Overview
An order management ERP built for a snack-food distribution business (Mia Bhai ChanaChur), covering the full order pipeline plus something most order systems don't attempt: real-time GPS tracking of field sales staff, with live map positions, geofencing against assigned territory, and automatic event classification of what a rep is actually doing during their shift.
Key Features
- Order management across dedicated sales, delivery, and admin dashboards, each scoped to its own role.
- Live field-staff tracking — a real-time overview of who's on duty, whether they're inside their assigned area, and their most recent GPS position, pushed live via a GraphQL subscription rather than polled.
- Geofencing and event classification — check-in/check-out, shop visits, movement, long stops, "outside assigned area," and off-route detection, computed from a stream of GPS pings the mobile app sends at intervals.
- Per-staff daily timeline — a full day's events and route reconstructed for any staff member, for the admin to review after the fact, not just watch live.
- Excel/CSV export for admin reporting and a mobile sales app for reps in the field.
Technical Highlights
- NestJS + GraphQL + Prisma + PostgreSQL backend with Socket.io scaled via a Redis adapter, so live tracking events reach the right connected admin regardless of which server instance is handling their session.
- Geospatial computation with Turf.js (point-in-polygon checks against territory boundaries) and
geolibfor distance/movement calculations — the actual math behind "is this rep inside their assigned area right now." - BullMQ-backed background job processing and Prometheus metrics (
prom-client) exposed for operational monitoring, treating this as production infrastructure rather than an internal tool that's allowed to fail quietly. - Added the live-tracking GraphQL subscription and two new fields onto an already-shipped tracking system as an additive, backward-compatible change — no existing query, mutation, or schema field touched.
Impact
Management gets a live, on-a-map answer to "where is my sales team right now and are they actually covering their territory" instead of end-of-day self-reported summaries — turning field coverage from something you find out about after the fact into something you can see happening.


