Layering an enterprise ERP
ZarST: one Laravel backend in DDD layers behind a web console, a field app and Telegram bots.
- Three kinds of clients — a Next.js web console, a React Native field app and Telegram bots — work with the same backend.
- The Interfaces layer handles HTTP, authentication and a role model of 80+ permissions split by department.
- Application use cases orchestrate the Domain, where the rules of dispatch, HR, warehouse and the water network live.
- Infrastructure implements persistence in MySQL and adapters to the city request platform, the billing system and Hikvision terminals.
Context
Suv taʼminot, the municipal water utility of Zarafshan (≈220 employees, 15 departments), ran on paper, phone calls and scattered Excel files.
Technical challenge
Dispatch, HR, warehouse, billing data and the water network had to move into one system used from offices, the field and Telegram — while the rules kept changing department by department.
Chosen solution
One Laravel / PHP 8.4 backend in Domain, Application, Infrastructure and Interfaces layers, serving a Next.js console, a React Native app and three Telegram bots, with 80+ permissions split by department and an audit log.
Trade-offs
DDD layering adds code and ceremony compared with plain controllers and models; in return, business rules change without touching delivery code, and ~900 backend tests cover them in isolation.
Result
~1,000 dispatch requests, 22,000 apartments and 845 wells in one database; the water balance over 200,000+ billing rows is calculated automatically.
All deep dives