Skip to content

Service boundaries ​

OwnerAuthoritative responsibilityCross-service relationship
AuditImmutable change histories and scoped read capabilitiesAdmin/Organization own HTTP; providers append within business transactions
IdentityCredentials, accounts, tokens, sessions, account profileSupplies account/authentication capabilities
DoctorProfessional profiles, license, specialization, onboarding orchestrationUses Identity and Organization-owned capabilities
OrganizationOrganizations, teams, ordinary members, doctor affiliations, invitations, join requestsOwns relationships rather than credentials
SubscriptionPlans, subscriptions, snapshots, invoices, manual paymentsSupplies billing capabilities to Admin and organization views
MedicineManufacturer, generic, brand, and drug catalogSupplies read APIs and curated Admin management
PatientOrganization-scoped demographics, contact details and addressesSupplies curated patient lookups to clinical workflows
PrescriptionDoctor-owned clinical documents, drafts, issuance, cancellation, derived historyUses patient/doctor display data and organization context
AdminPlatform administration and privileged orchestrationDelegates provider-owned changes; owns admin roles/verification workflow
NotificationTemplates, delivery, and notification stateSends via shared email boundary and SMS adapter

This table describes ownership, including planned capabilities. It is not an implementation checklist: consult each service guide for current behavior.

Ordinary organization members and professional doctor affiliations are distinct. Assigning a doctor member role does not create a doctor profile or affiliation. Prescriptions are owned by their author; the organization supplies context. Patient demographics and prescription-derived clinical history are separate responsibilities.

Consumers import another service's public package and receive implementations through composition-root wiring. Admin uses AdminOrganizationService for organization and membership operations and AdminIdentityService for account provisioning and lookups. Other workflows retain their curated capabilities. HTTP DTOs and storage entities must not become accidental cross-service contracts. Use events for projections and post-change reactions, not commands requiring immediate request-time success.

ADR-008 documents the detailed responsibilities; ADR-012 describes the capability boundary. ADR-004's earlier doctor-as-role decision is superseded by ADR-013.

Clinical input catalogs use shared models in pkg/types/domain and interfaces in pkg/types/ports as an explicit exception to the service-public package convention. Domain models, commands, queries, stable errors and validation remain separate from service/repository ports. Both packages are serialization-free and import no service/HTTP/SQL packages. Prescription owns implementation/storage, Doctor owns authenticated suggestion GETs, and Admin owns authorized management HTTP. The services are AdminClinicalSuggestionService (both catalogs' CRUD) and DoctorClinicalService (both autocomplete queries). Repository ports are injected only into Prescription implementations, never Doctor/Admin. HTTP DTOs remain service-local.

Documentation follows the source. Planned contracts are marked explicitly.