Include Loyalty/Communication/Sports Center backends and registry updates alongside production nginx and compose wiring. Co-authored-by: Cursor <cursoragent@cursor.com>
2.1 KiB
2.1 KiB
Database Architecture
Architecture only. Column-level reference → database-schema.md
Pattern
Database-per-service (ADR-001).
| Service | Database |
|---|---|
| Core Platform | core_platform_db |
| Identity & Access | identity_access_db |
| Accounting (future) | accounting_db |
| CRM | crm_db |
| Loyalty | loyalty_db |
| Communication | communication_db |
| Sports Center | sports_center_db |
| Ecommerce (future) | ecommerce_db |
| Website Builder (future) | website_builder_db |
| Live Chat (future) | live_chat_db |
| AI Assistant (future) | ai_assistant_db |
| Smart Messenger (future) | smart_messenger_db |
| SMS Panel (future) | sms_panel_db |
| Link Shortener (future) | link_shortener_db |
| Notification (future) | notification_db |
| File Storage (future) | file_storage_db |
| Restaurant (future) | restaurant_db |
Hard Rules
- No direct queries across service databases.
- No cross-DB foreign keys.
- Every business table includes
tenant_id(ADR-003). - IDs are UUID; timestamps are timezone-aware.
- Migrations via Alembic per service; never edit applied migrations in production.
- Conceptual schemas for future services are documented in reference docs until migrations exist.
Core Platform Ownership
Tenants, domains, plans/features/subscriptions, registries, internal tokens, outbox/inbox, audit logs, core users, operational tenant_memberships.
Identity Ownership
user_profiles, identity-layer tenant_memberships (not the Core table — ADR-007).
Dual Membership Clarification
| Database | Table | Role |
|---|---|---|
core_platform_db |
tenant_memberships |
Workspace authorization source of truth |
identity_access_db |
tenant_memberships |
SSO membership listing |