TorbatYar/docs/architecture/adr/ADR-014.md
Mortezakoohjani e41ecfad4c Sync platform docs, infra, and module services with Accounting integration.
Include Loyalty/Communication/Sports Center backends and registry updates alongside production nginx and compose wiring.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-25 22:35:23 +03:30

62 lines
3.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# ADR-014: Independent Sports Center Platform Service
| Field | Value |
| --- | --- |
| Status | Accepted |
| Date | 2026-07-24 |
| Deciders | Platform Architecture |
| Supersedes | — |
| Superseded by | — |
## Context
Gyms, clubs, and sports facilities need members, memberships, coaches, attendance/access, booking, training programs, competitions, and related operations. Embedding this inside CRM, Loyalty, Accounting, or Restaurant would couple unrelated domains and block reuse.
TorbatYar already has independent platform services for Loyalty ([ADR-011](ADR-011.md)) and Communication ([ADR-012](ADR-012.md)). Sports operations need the same independence with a dedicated database and permission tree.
## Decision
1. Introduce `sports_center` as an **independent business platform service** with sole ownership of `sports_center_db` ([ADR-001](ADR-001.md)).
2. Permission prefix: `sports_center.*`. Publish-only domain events: `sports_center.*`.
3. Row-level multi-tenancy via `tenant_id` ([ADR-003](ADR-003.md)).
4. Consume Accounting, CRM, Loyalty, and Communication **only** via REST API and Events — never shared tables or foreign model imports.
5. Financial journals only through Accounting Posting Engine ([ADR-010](ADR-010.md)).
6. Messaging only through Communication ([ADR-012](ADR-012.md)).
7. Loyalty points/rewards only through Loyalty ([ADR-011](ADR-011.md)).
8. Implementation phases are registered as **Phase 9.09.10** in [phase-manifest.yaml](../../ai-framework/phase-manifest.yaml); roadmap in [sports-center-roadmap.md](../../sports-center-roadmap.md).
9. Product AI and Automation remain optional and external ([ai-architecture.md](../ai-architecture.md)).
## Consequences
### Positive
- Clear ownership for sports operations
- Reusable integrations with platform services
- Enforceable tenancy, audit, and boundary tests
### Negative
- Additional deployable service and database
- Eventual consistency for cross-service customer views
### Neutral
- Scaffold may exist under `backend/services/sports_center` before Phase 9.0 implementation; registration precedes business code
## Alternatives Considered
1. Sports subsystem inside CRM — rejected (CRM is Sales-only).
2. Sports tables inside Core — rejected (violates business-module boundaries and ADR-001).
3. Per-tenant bespoke apps without a service — rejected (not SuperApp-native).
## Related Documents
- [Sports Center Phase 9.0](../../sports-center-phase-9-0.md)
- [Phase Handover 9.0](../../phase-handover/phase-9-0.md)
- [Module Boundaries](../module-boundaries.md)
- [Module Registry — sports_center](../../module-registry.md#sports_center)
- [Sports Center Roadmap](../../sports-center-roadmap.md)
- [Phase Manifest](../../ai-framework/phase-manifest.yaml)
- [Service Manifest](../../ai-framework/service-manifest.yaml)
- [ADR-001](ADR-001.md) · [ADR-003](ADR-003.md) · [ADR-010](ADR-010.md) · [ADR-011](ADR-011.md) · [ADR-012](ADR-012.md)