Knowledge Portal · engineering documentation

Skip to content

Federated from workspace · PRD-001 · Dental Clinic Revenue Operating System/docs/architecture/PUBLIC_API_CATALOG.md Do not edit canonical truth here — update the source repo, then re-run npm run docs:sync.


Public API Catalog

Cross-module surface area for Tier 1 core modules. 106 contracts exist platform-wide; 23 PublicApi gateways implement cross-module boundaries for Wave 2–4 recovery.


Rules

  1. Consumers import Application/Contracts only (plus Application/DTOs for data transfer).
  2. Application/PublicApi is for gateway implementations — consumers never import gateways.
  3. One contract = one capability. No god interfaces (>15 methods requires ADR).
  4. Gateways delegate to internal services — not empty, not >8 internal delegates.

Saas

ContractGatewayCapability
ClinicTenantScopeContract(TenantContext implements)Read tenant clinic ID, scope flags
ClinicTenantContextMutationContract(TenantContext implements)Bind/forget tenant context
ClinicScopedIterationContractClinicScopedIterationGatewayMulti-clinic batch iteration
EntitlementContract(EntitlementService implements)Feature gating

Clinic

ContractGatewayCapability
ClinicTenantContextBindingContractClinicTenantContextBindingGatewayBind session from clinic ID
ClinicCurrencyFormatContractClinicCurrencyFormatGatewayCurrency formatting
ClinicPerformanceCacheContractClinicPerformanceCacheGatewayDashboard/revenue cache
ClinicIterationContractClinicIterationGatewayActive clinic ID iteration
ClinicTenantQueryContractClinicTenantQueryGatewayTenant clinic reads
ClinicTenantCommandContractClinicTenantCommandGatewayTenant clinic writes
ClinicCustomerExperienceQueryContractClinicCustomerExperienceQueryGatewayCX aggregation reads
ClinicServiceCatalogContract(ClinicServiceCatalogService)Service catalog
ClinicIdentityQueryContract(ClinicIdentityQueryService)Clinic identity
ClinicQueryServiceContract(ClinicQueryService)General clinic queries

CRM

ContractGatewayMethodsNotes
CrmActionCommandContractCrmActionCommandGateway10⚠️ High method count — monitor
CrmAuditCommandContractCrmAuditCommandGateway2OK
CrmIntelligenceQueryContractCrmIntelligenceQueryGateway5OK
CrmMetricsQueryContractCrmMetricsQueryGateway3OK
CrmSchedulingQueryContractCrmSchedulingQueryGateway3OK
CrmEntityAccessContractCrmEntityAccessGateway6⚠️ Returns infra models internally
CrmLeadProfileQueryContractCrmLeadProfileQueryGateway1⚠️ Model leakage in return array
CrmLeadTimelineEnrichmentContractCrmLeadTimelineEnrichmentGateway5⚠️ Model leakage
CrmUsageMetricsContractCrmUsageMetricsGateway5⚠️ Model queries
CrmCustomerExperienceQueryContractCrmCustomerExperienceQueryGateway1OK
FinancialQueryContract(FinancialQueryService)Saas/CRM billing reads
ReminderDeliveryProvider(internal)CRM-internal port

Leads

ContractImplementerCapability
LeadEntityContractLead model adapterLead identity without infra import
LeadAccessContractLeadAccessServiceScoped lead lookup
LeadTimelineContractLeadTimelineServiceTimeline writes
LeadCommandServiceContractLeadCommandServiceLead mutations
LeadQueryServiceContractLeadQueryServiceLead reads

Compliance

ContractImplementerCapability
ComplianceAuditContractAuditLogServiceCross-module audit writes
ComplianceAuditQueryContractComplianceAuditQueryServiceAudit feed reads
OperationalEventContextFactoryContractOperationalEventContextFactoryEvent metadata envelope

Workspace

ContractImplementerCapability
WorkspaceNotificationDispatchContractNotificationServiceStaff/external notifications
WorkspaceQueryContractWorkspaceQueryServiceWorkspace reads
NotificationInboxContractSharedNotificationInboxProviderInbox surface

Realtime

ContractGatewayCapability
InAppNotificationPublishContractInAppNotificationPublishGatewayRealtime fan-out for in-app notifications
RealtimePlatformContractRealtimePlatformServicePlatform publish API

ClinicTemplateSystem

ContractGatewayCapability
ClinicTemplateBrandingCommandContractClinicTemplateBrandingCommandGatewayBranding updates
ClinicTemplateOnboardingCommandContractClinicTemplateOnboardingCommandGatewayOnboarding provisioning
ClinicTemplateCustomerExperienceQueryContractClinicTemplateCustomerExperienceQueryGatewayCX reads
ClinicTemplateUsageMetricsContractClinicTemplateUsageMetricsGatewayUsage metering
ClinicTemplateScheduleQueryContract(internal service)CRM scheduling reads

Shared Kernel Contracts

ContractImplementation module
ClinicConfigurationContractClinicTemplateSystem
BackupHandlerContractProduction
TenantConnectionResolverContractSaas

Workspace Contracts

ContractGateway / Implementation
NotificationChannelHandlerContractWorkspace channel handlers (EmailNotificationChannel, etc.)

Future Split Recommendations (report only — do not refactor now)

ContractIssueSuggested split
CrmActionCommandContract10 commands in one surfaceSplit into CrmAppointmentCommandContract, CrmInvoiceCommandContract, CrmLeadCommandContract
CrmEntityAccessGatewayReturns Eloquent modelsReturn DTO snapshots; keep gateway as anti-corruption layer
CrmLeadProfileQueryGatewayArray of infra modelsCrmLeadProfileSnapshot DTO
MarketingPlatformContract24 methodsAlready platform-style; acceptable with freeze policy
Growth → CRM ServicesDirect service importsCrmGrowthMetricsContract gateway

ZAIXOS Knowledge Portal — public engineering docs at /docs · Staff operations at /admin