Commercial Licenses Dashboard
2026
Real-time monitoring platform for government employees across Saudi municipalities. A replayable event stream feeds two purpose-built read models — search/KPIs and spatial — so each query class runs on the engine best suited to it.
The problem
Tens of thousands of commercial licences are issued nationwide every month. Municipal officials need real-time visibility — search by trader, location, status, prohibition flags — plus map-based exploration for field operations.
The architecture
A read-side projection (CQRS) of the Commercial Domain, populated by event-driven replication into two purpose-built read models:
- Elasticsearch indexes for search, KPIs, and pre-calculated prohibition flags (so officials see “this license cannot be renewed” instantly, without a join)
- ArcGIS Server for spatial / map / radius queries
- Dedicated RabbitMQ Streams with a replay window long enough to rebuild the read side without bothering the write side
Geometry and metadata are deliberately split across the two read models — spatial polygons and points live only in the GIS engine, while the search store holds metadata and the pre-calculated flags. Each engine does only what it is best at, at the cost of keeping two projections in sync. Stream consumers are idempotent (keyed on event identity, last-write-wins on timestamp, with dead-letter/retry) and partition by entity, so each licence or zone is processed in order.
The BFF + Data Access Services tier assembles per-page payloads that match the dashboard’s widgets. Hierarchical role-based scope, driven by government SSO claims, controls how much of the data each official can see — from a single locality up to a nationwide view.
Pattern view — a replayable stream builds search and spatial read models without touching the write side.
Outcome
Real-time nationwide visibility for licence supervision. Replay lets the read side be evolved or rebuilt without disturbing the operational system. Pre-calculating prohibition flags is a deliberate trade — derived data is duplicated and must be recomputed when restriction zones change — paid for sub-second queries that never need a runtime spatial join.