System Architecture
Web / PWA / Mobile
|
API Gateway (KHAWI API — the controlled application gateway)
|
+---- Identity & Users
+---- Journeys & Matching
+---- Bookings
+---- Safety
+---- Compliance Engine
+---- Notifications
|
+----+-------------------+
| |
PostgreSQL + PostGIS Strapi 5
operational, spatial, content, reference data,
audit policy authoring
|
Redis
cache, queues, realtimeRuntime
React / Vite
↓
Node.js API
├── Matching Worker
└── Compliance Worker
↓
PostgreSQL + PostGIS + Redis + Worker QueueComponent boundaries
Frontend: Authentication, journey creation, ride requests, maps, bookings, notifications and safety.
API: Authentication, authorization, transactional workflows, matching orchestration, compliance orchestration, data access, audit and integrations.
Matching: Owns geospatial route calculation. It answers only "are these compatible?" — it has no authority to decide whether a journey may proceed.
Compliance: Owns the policy decision. It answers only "is this permitted?" — it has no authority to rank or offer candidates.
Keeping these two separate is what allows the operating model to change without rebuilding the matching system.
Data: PostgreSQL/PostGIS for operational and spatial data; Redis for cache, queues and realtime support.
CMS: Strapi 5 for content, reference data and policy authoring.
Direction of calls
Matching and compliance sit behind the API gateway as workers, not as clients of Strapi. Neither calls Strapi to make a decision.
Strapi is reached only for content and for the policy draft that an administrator later activates. A Strapi outage must degrade content rendering. It must not stop journeys already in progress, and it must never turn a compliance decision into a PENDING — see Fail-safe behaviour.
Service decomposition
Start as a modular monolith where practical, with matching and compliance as separate modules rather than separate deployables. The boundary that matters is the contract between them, not the process boundary.
Separate services are justified when matching latency or compliance throughput actually requires it — not before.
Rules
No component silently becomes the source of truth for another layer's responsibilities.
