Register all active platform services and base features in core DB so admin can manage them, add delivery/hospitality/sports-center backend phases, update apps catalog and production deploy tooling. Co-authored-by: Cursor <cursoragent@cursor.com>
3.7 KiB
3.7 KiB
ADR-015: Independent Delivery & Fleet Platform Service
| Field | Value |
|---|---|
| Status | Accepted |
| Date | 2026-07-25 |
| Deciders | Platform Architecture |
| Supersedes | — |
| Superseded by | — |
Context
Restaurant, Cafe, Marketplace, Store, Pharmacy, Clinic, Sports Center, and future verticals all need last-mile logistics: drivers, fleets, dispatch, routing, tracking, proof of delivery, and settlement. Embedding this inside any single vertical would duplicate business logic and couple unrelated domains.
TorbatYar already isolates shared platforms as independent services (Loyalty ADR-011, Communication ADR-012, Sports Center ADR-014). Physical goods / courier logistics need the same independence. This must not be confused with Communication message delivery tracking.
Commercial product name: Torbat Driver.
Decision
- Introduce
deliveryas an independent Delivery & Fleet Platform service with sole ownership ofdelivery_db(ADR-001). - Permission prefix:
delivery.*. Publish-only domain events:delivery.*. - Row-level multi-tenancy via
tenant_id(ADR-003). - Consume Accounting, CRM, Loyalty, Communication, and vertical services (Restaurant, Marketplace, Sports Center, Clinic, etc.) only via REST API and Events — never shared tables or foreign model imports.
- Financial journals only through Accounting Posting Engine (ADR-010). Settlement posts via Accounting APIs/events — Delivery never creates journal entries locally.
- Driver/customer notifications only through Communication (ADR-012).
- Loyalty points/rewards only through Loyalty (ADR-011).
- Routing engines and external fleet providers sit behind protocols/adapters owned by Delivery; future engines plug in without changing verticals.
- Implementation phases are registered as Phase 10.0–10.10 in phase-manifest.yaml; roadmap in delivery-roadmap.md.
- Product AI remains optional and external (ai-architecture.md). Core dispatch/tracking works when AI is off.
- UI for Driver App / Dispatcher Panel lives in
frontend/only (ADR-002); this service exposes APIs and events.
Consequences
Positive
- One reusable logistics platform for all verticals
- No duplicated driver/dispatch logic across Restaurant/Marketplace/etc.
- Enforceable tenancy, audit, and boundary tests
- External routing engines and fleet providers can be swapped behind adapters
Negative
- Additional deployable service and database
- Eventual consistency for cross-service order/delivery views
Neutral
- Registration (this ADR + manifests) precedes business code; Phase 10.0 implements the scaffold
- Message delivery status remains owned by Communication — glossary disambiguates terms
Alternatives Considered
- Delivery subsystem inside Restaurant — rejected (blocks Marketplace/Pharmacy/Clinic reuse).
- Delivery tables inside Core — rejected (violates business-module boundaries and ADR-001).
- Per-vertical bespoke courier stacks — rejected (duplicates logic; contradicts SuperApp platform goals).