A delivery day, not a generic shop
Water delivery is repetitive on purpose: the same households and shops expect bottles on a route, deposits come back, and a missed day is obvious to the customer before it is obvious in a report. The ERP models that day as offices, Leaflet delivery-zone polygons, household customers, and B2B shops with credit limits.
An order becomes a trip and then rider tasks. Bottle deposits have their own ledger, because a missing empty bottle is money, not a note on the order. Shop credit and accounts-receivable aging sit next to product margin so a busy route can still be an unprofitable one.
Recurring orders without a clerk
Subscriptions generate the next day’s orders on a schedule (`water-app:subscription-orders`). That job is the difference between a dispatcher copying yesterday’s sheet and a route that already exists when the riders start. The database uses a dedicated PostgreSQL schema with a `wa_` prefix so this domain does not collide with other products on a shared server.
Riders and customers use a Sanctum mobile API with Firebase Cloud Messaging. Purchasing is in the same app: supplier purchase orders and receiving, plus an optional Pakistan payroll module for the people running the branches. Playwright and PHPUnit cover the flows that break quietly — credit limits, deposits, and the subscription job.
What I would not split apart
Zones, trips, and accounting are one system. A map without a ledger cannot tell you which office is owed money, and a ledger without zones cannot tell you why a rider is late. Leaflet polygons are the dispatch boundary; the double-entry books are the business boundary.
The stack is Laravel 12, Inertia, React, TypeScript, and PostgreSQL. Bootstrap 5 and Yajra DataTables are the operator UI. The mobile clients stay thin: they take tasks and push, and they do not grow a second copy of pricing rules.
In production
Operators manage multi-office dispatch with Leaflet delivery-zone polygons, household and B2B shop customers, and a subscription engine that auto-generates recurring orders. Riders and customers connect through a Sanctum mobile API with Firebase push notifications.
What shipped
- Orders, trips, and delivery tasks with bottle-deposit ledger, shop credit limits, AR aging, and product margin reports
- Subscription engine with daily scheduled order generation (`water-app:subscription-orders`) for recurring deliveries
- Supplier PO/receive flows, optional Pakistan payroll, Firebase FCM push, and Playwright + PHPUnit coverage