Architecture
Healthcare Microservices Architecture, Decided on Evidence
Microservices buy independent deployment and fault isolation at the price of distributed data, network failure modes, and operational overhead. We help you decide whether that trade is worth it for your clinical product, then engineer the boundaries so it actually pays off.
At a glance
- Standards & integrations
- HL7 v2 ADT, ORM, ORU feeds via interface engineFHIR R4 REST APIs and SubscriptionsEMPI / master patient indexPayer eligibility (X12 270/271)Claims (X12 837/835)Identity providers (Okta, Microsoft Entra ID)
- Typical deliverables
Context map with ownership and integration styles per seam
Architecture decision records, including the monolith-versus-services decision
Service template with outbox, inbox, tracing, and health checks
Event catalog and schema registry with compatibility rules
Healthcare microservices: overview
Most healthcare teams arrive at microservices for one of two reasons: a monolith that has become too risky to deploy, or an org chart that has grown past the point where one codebase can be owned by one team. Both are legitimate. Neither is solved by splitting code into containers. The value comes from boundaries that match how clinical and administrative work actually changes, with each service owning its data and publishing facts other services can rely on.
We start from the domain, not the technology. Scheduling, orders, results, patient identity, consent, billing, and notifications change at different rates, carry different regulatory weight, and fail in different ways. A results service that drops a message is a patient-safety issue; a notification service that retries twice is an annoyance. Drawing boundaries around those differences lets you apply strict consistency where it matters and relax it where it does not, instead of paying distributed-system tax everywhere.
We are equally direct about when not to split. A team of six engineers shipping a single clinical product usually moves faster, with fewer outages, on a well-structured modular monolith with enforced module boundaries and one database with schema-per-module. That design can be decomposed later along seams you have already proven. Premature microservices tend to produce a distributed monolith: every release touches five services, and an outage in one takes down the rest.
Engineering challenges in healthcare microservices
01Distributed monoliths
Services that share a database or call each other synchronously in long chains cannot deploy or fail independently. A single slow eligibility call can cascade into a scheduling outage because nothing was designed to degrade.
02Dual writes and lost events
Writing to the database and then publishing to a broker in two steps eventually loses one of them. In healthcare that looks like a result stored but never routed to the ordering clinician's inbox.
03Patient identity across services
Every service needs to know who the patient is, but only one should own identity and merge logic. When MRN merges or EMPI link changes are not propagated as events, downstream services quietly hold records for the wrong person.
04Cross-service transactions
Registering a patient, verifying coverage, and booking a slot span services with no shared transaction. Without sagas and compensations, partial failures leave orphaned appointments and confused front-desk staff.
05Audit trails that span services
A single clinician action may touch six services. Reconstructing who accessed which record, and why, requires consistent actor and purpose-of-use propagation, which few teams design for up front.
Technical capabilities
What our healthcare microservices work covers
Domain decomposition workshops
We run event storming and context mapping with your clinical, product, and engineering leads to find real bounded contexts. The output is a context map with ownership, upstream and downstream relationships, and the integration style for each seam.
Modular monolith first, when it fits
For smaller teams we design a modular monolith with module APIs, architecture tests that fail the build on forbidden dependencies, and schema-per-module data ownership. You get most of the boundary discipline without network hops or distributed tracing as a prerequisite.
Transactional outbox and inbox
Each service writes state changes and outgoing events in the same local transaction, and a relay publishes them. Consumers keep an inbox table keyed by message ID so redelivery is harmless, which is how you get effectively-once processing on at-least-once infrastructure.
Sagas with explicit compensation
We model multi-step workflows such as referral intake or prior authorization as orchestrated sagas with named compensating actions. The saga state is persisted and visible, so operations staff can see exactly where a stuck referral is and why.
Resilient service-to-service calls
Timeouts, retries with jitter, circuit breakers, and bulkheads are configured per dependency rather than left at library defaults. Calls to payer or EHR endpoints get their own pools so one slow partner cannot exhaust capacity for everything else.
Contract testing and versioning
Consumer-driven contract tests catch breaking API and event schema changes in CI, before a deploy reaches staging. Event schemas live in a registry with compatibility rules, so a renamed field cannot silently break the billing consumer.
Identity and audit propagation
We carry the end-user identity, tenant, and purpose of use through every hop using signed tokens and trace context. Each service emits audit events in a shared format to a central, append-only store.
Incremental extraction from a monolith
Using the strangler fig pattern, we route specific capabilities to new services behind a facade while the monolith keeps running. Change data capture keeps both sides consistent during the transition, and each extraction has a rollback path.
Software architecture
Reference architecture for healthcare microservices
A reference layout for a clinical platform where services own their data and communicate primarily through events, with synchronous calls reserved for queries that need an immediate answer.
- Edge
- API gateway
- OAuth 2.0 / OIDC
- Rate limiting
- WAF
- Domain services
- Patient identity
- Scheduling
- Orders & results
- Consent
- Billing
- Messaging
- Event broker
- Outbox relay
- Schema registry
- Dead-letter queues
- Data
- Database per service
- FHIR read store
- Audit log store
- Object storage
- Platform
- Kubernetes
- Service mesh mTLS
- OpenTelemetry
- Secrets manager
Technology stack for healthcare microservices
- Runtime
- Java / Spring BootKotlin.NETGoNode.js / TypeScript
- Messaging
- Apache KafkaAmazon MSKAzure Service BusRabbitMQDebezium CDC
- Data
- PostgreSQLAmazon AuroraAzure SQLRedisHAPI FHIR server
- Workflow
- TemporalAWS Step FunctionsCamunda
- Platform
- Kubernetes (EKS/AKS/GKE)Istio or LinkerdArgo CDTerraform
- Quality
- Pact contract testsTestcontainersArchUnitk6
Security & compliance
Security and compliance considerations for healthcare microservices
What regulations require
- The HIPAA Security Rule requires audit controls that record and examine activity in systems containing ePHI (45 CFR 164.312(b)); in a service-based design, that obligation applies across every service that touches PHI, not just the front door.
- 45 CFR 164.312(a)(1) requires technical access controls that allow access only to authorized persons or software programs, which covers service-to-service calls as well as human users.
- HIPAA requires a Business Associate Agreement before a vendor creates, receives, maintains, or transmits PHI (45 CFR 164.502(e) and 164.504(e)); every managed broker, database, or observability vendor in the path needs that coverage and must be a HIPAA-eligible service.
Recommended engineering practices
- Mutual TLS between services through a mesh or sidecar, with workload identities (for example SPIFFE IDs) rather than shared secrets.
- Token exchange so downstream services receive a narrowly scoped token carrying the original user and purpose of use, not a powerful service credential.
- Event payloads that carry identifiers and minimal clinical content, with consumers fetching detail through authorized APIs when needed.
- Per-service threat models using STRIDE, revisited whenever a new trust boundary or external integration is added.
- Secrets in a managed vault with short-lived credentials and automated rotation, never in container images or environment files committed to source control.
Regulatory summaries are educational, not legal advice. HIPAA compliance is an organizational program; software can support safeguards but cannot by itself make an organization compliant. Systems that handle PHI need their own risk analysis, vendor evaluation, and Business Associate Agreements before deployment.
Integration capabilities
Integrations we engineer for healthcare microservices
- HL7 v2 ADT, ORM, ORU feeds via interface engine
- FHIR R4 REST APIs and Subscriptions
- EMPI / master patient index
- Payer eligibility (X12 270/271)
- Claims (X12 837/835)
- Identity providers (Okta, Microsoft Entra ID)
- Clinical terminology services (SNOMED CT, LOINC, RxNorm)
- Notification gateways (SMS, email, push)
Engineering methodology
How we approach healthcare microservices
- 1
Assess team, domain, and pain
We look at deploy frequency, incident history, team topology, and where change is actually blocked. This tells us whether the problem is architecture, process, or ownership.
- 2
Map bounded contexts
Event storming with clinical and operations staff produces a context map. We mark which contexts need strong consistency and which can tolerate eventual consistency.
- 3
Choose the topology
We recommend a modular monolith, a small number of coarse services, or fine-grained microservices, with written decision records explaining why and what would change the answer.
- 4
Build the paved road
Before extracting services we put in place the template: outbox, inbox, tracing, contract tests, deployment pipeline, and runbooks. Every new service starts from it.
- 5
Extract and verify incrementally
Capabilities move one at a time behind a facade, with shadow traffic and reconciliation reports confirming parity before cutover.
Business use cases
Where healthcare microservices delivers value
Multi-product digital health company
Separate teams own virtual care, remote monitoring, and billing. Shared identity and consent services publish events that each product consumes, so product teams release on their own schedule.
Breaking up a scheduling monolith
A ten-year-old scheduling system blocks every release. We extract availability search first, since it has the highest read load and the clearest boundary, while bookings stay in the monolith.
Lab order and result routing
Orders, specimen tracking, and result delivery become services with explicit events, so a result that arrives before its order is parked and matched instead of rejected.
Consolidating after acquisition
Two platforms with overlapping patient and provider models are unified behind shared identity and directory services while each keeps its domain logic during transition.
Technical comparison
| Dimension | Modular monolith | Microservices |
|---|---|---|
| Best fit | One product, one to three teams | Several teams with independent release needs |
| Data consistency | Local ACID transactions across modules | Eventual consistency; outbox and sagas required |
| Failure isolation | Process-level; one bad module can affect all | Per service, if bulkheads and timeouts are designed |
| Operational load | One deployable, simple tracing | Mesh, broker, per-service pipelines, distributed tracing |
| Audit and PHI tracking | Single audit pipeline | Requires identity and audit propagation across hops |
| Independent scaling | Scale the whole application | Scale hot services (for example availability search) alone |
| Cost of a wrong boundary | Refactor inside one codebase | Cross-team API and data migration |
| Path forward | Extract services along proven module seams | Merge services if boundaries were wrong |
Typical deliverables
What a healthcare microservices engagement produces
- Context map with ownership and integration styles per seam
- Architecture decision records, including the monolith-versus-services decision
- Service template with outbox, inbox, tracing, and health checks
- Event catalog and schema registry with compatibility rules
- Saga definitions with compensating actions for cross-service workflows
- Contract test suite wired into CI
- Per-service threat models and data-flow diagrams
- Extraction roadmap with rollback criteria
Are you ready for microservices?
- You have at least two teams blocked by each other's release cycles
- Automated deployment and rollback exist for the current system
- Distributed tracing and centralized logging are in place or funded
- Each candidate service can own its data without shared tables
- You have decided which workflows can tolerate eventual consistency
- On-call rotation and runbooks exist for each service owner
- Contract testing is part of CI, not a future plan
Cost and timeline factors
What shapes healthcare microservices cost and timeline
- Number of bounded contexts and how tangled the current data model is
- Whether a platform team, CI/CD, and observability already exist
- Volume and variety of HL7 and FHIR integrations crossing service boundaries
- How many cross-service workflows need sagas and compensation
- Regulatory scope, including audit, consent, and 42 CFR Part 2 data segmentation
- Team experience with distributed systems and on-call operations
Typical timeline
A decomposition assessment and target architecture typically takes a few weeks. Building the paved road and extracting the first one or two services usually takes one to two quarters, and a full decomposition of a large monolith runs over several quarters in planned increments.
Read the cost guideHealthcare microservices FAQs
Should a healthcare startup begin with microservices?
Usually not. A small team building one clinical product gets faster delivery and fewer outages from a modular monolith with enforced module boundaries and schema-per-module data ownership. That structure keeps the option to extract services later, once real load patterns and team boundaries are known. Starting with microservices front-loads the cost of brokers, tracing, contract tests, and on-call before you know where the boundaries belong.
How do microservices handle transactions that span several services?
They avoid distributed transactions and use sagas instead. Each step commits locally and publishes an event; if a later step fails, earlier steps run compensating actions, such as cancelling a held appointment slot. Orchestrated sagas, where a coordinator tracks state, are easier to observe and audit in healthcare than pure choreography, because operations staff can see exactly which step a patient's workflow is stuck on.
What is the outbox pattern and why does it matter for clinical data?
The outbox pattern writes a business change and its outgoing event in the same database transaction, then a separate relay publishes the event to the broker. It removes the dual-write problem where a database update succeeds but the event is lost. For clinical data, that prevents cases such as a critical lab result being saved but never reaching the clinician's worklist.
Do microservices make HIPAA compliance harder?
They add surface area. More services, more data stores, and more network paths mean more places that need access control, audit logging, encryption, and BAA coverage for managed services. Compliance remains an organizational program; architecture can make safeguards consistent by giving every service the same identity propagation, audit event format, and PHI-safe logging from a shared template.
Related engineering topics
- Event-Driven ArchitectureBrokers, event contracts, ordering, and idempotency for HL7 v2 and FHIR event streams, so out-of-order and duplicate clinical messages are handled by design.Read more
- Cloud-Native ArchitectureContainers, managed services, infrastructure as code, and policy guardrails designed so PHI workloads stay on HIPAA-eligible services under a signed BAA.Read more
- System ObservabilityOpenTelemetry tracing, SLOs and error budgets, interface monitoring, and PHI-safe logging so teams see clinical impact before users report it.Read more
- Healthcare Software ModernizationIncremental modernization of aging healthcare applications in place, using strangler-fig patterns that protect clinical workflows while the codebase improves.Read more
- Healthcare Software Architecture GuideHow to make architectural decisions for healthcare systems: decision records, tenancy, PHI boundaries, integration topology, data models, identity, resilience, and evolution.Read more
- Hire Healthcare Software ArchitectsHire healthcare software architects who make and document decisions on integration, data, security, and scalability that hold up under audit and growth.Read more
Discuss your healthcare engineering project
Tell us about the system, the integrations it depends on, and the constraints you are working within. A senior engineer will review it and reply with questions, not a sales script.