HealthcareFHIR

FHIR Facade Architecture Guide: FHIR for Legacy EHR Integration and Legacy Healthcare Systems

April 8, 202614 min readUpdated Oct 30, 2026
Written by
Jitendra Choudhary
Jitendra Choudhary

CTO & Co-Founder

CTO & Co-Founder at Nirmitee.io. Architects healthcare integrations across FHIR, SMART on FHIR, ABDM and NHCX, writing from production experience taking hospital software from sandbox to go-live.

FHIR Facade Architecture Guide: FHIR for Legacy EHR Integration and Legacy Healthcare Systems

Updated October 2026

A FHIR facade is a layer that puts a FHIR API on top of a system that does not speak FHIR, such as a legacy EHR, an HL7 v2 message store or a relational database. The data stays where it is: the facade translates each FHIR request into a query the old system understands and maps the answer back into FHIR resources.

That makes it the usual first option for FHIR for legacy EHR integration when the old system is staying and apps mostly need to read from it. It is a poor fit for bulk export, heavy search or a system you are about to retire. Our FHIR integration services team builds both facades and repositories, and this guide covers how to choose, the FHIR facade architecture, a tested code example and the mistakes that cost the most time.

If the legacy system is on its way out, our healthcare data migration services plan the facade and the move together.

What is a FHIR facade?

A FHIR facade is a FHIR server with no FHIR database behind it. It exposes a FHIR R4 API for the resources and searches you choose to support, declares them in its CapabilityStatement, and answers from the source system at request time.

This answers the question many teams start with: how do we expose legacy clinical data through a FHIR API without moving it? You add a translator in front of the source. Nothing is migrated and clinical staff keep their workflows, which is why facades come up so often in plans for healthcare legacy systems. HAPI FHIR's documentation describes the same idea for its Plain Server: a common FHIR layer on top of a series of existing data sources.

FHIR facade architecture diagram

The facade sits between FHIR clients and legacy systems. Data stays in the source systems.

Every facade does three jobs. It receives FHIR REST calls such as GET /Patient and routes each one to the right adapter. It maps legacy data to FHIR, so a name in HL7 v2 PID-5 becomes a Patient.name HumanName. Then it assembles valid resources, wraps them in Bundles and returns errors as OperationOutcome resources.

How a FHIR facade handles a request

A facade handles a request in seven steps, and step 3 is where most of the design work sits. Here is GET /fhir/Patient?family=Smith from start to finish.

One search request, from the client through the facade to the legacy database and back.
  1. The client sends a standard FHIR REST request to the facade.
  2. The facade checks the SMART on FHIR token and its scopes, for example patient/Patient.rs (patient/Patient.read in SMART v1).
  3. It parses the search parameters and translates them, for example to WHERE last_name ILIKE 'Smith%' or an HL7 v2 QBP query.
  4. It runs the query against the source system.
  5. It maps the results to FHIR resources.
  6. It wraps them in a searchset Bundle with paging links and a self link.
  7. It returns the response with the right HTTP status and headers.

What is inside a production FHIR facade

A production facade has six parts, and the mapping engine is the hardest of them. Mapping work grows with every resource type and search parameter you add.

The six components of a production FHIR facade.
ComponentWhat it doesWhat to watch
API gateway or FHIR server shellHTTP routing, JSON or XML, the CapabilityStatementSupport for _format, _summary and other common parameters
SMART on FHIR authOAuth 2.0, token checks, scope enforcementWhich launch types your clients need: standalone, EHR launch, backend services
Resource routerSends each resource type to the right adapterPatient may come from the MPI, Observation from the lab system, medications from pharmacy
Mapping engineTranslates between FHIR and legacy data modelsLocal codes need crosswalks to LOINC, SNOMED CT and similar code systems
Legacy adaptersDatabase, HL7 v2 MLLP, SOAP and REST connectionsConnection pooling, retries and each system's own errors
Audit loggerRecords who read what, when and under which authorizationPart of your HIPAA access logging, so plan it from the start

Code example: a Python FastAPI facade

This small facade puts a FHIR Patient search on a legacy PostgreSQL table.

from fastapi import FastAPI, Query, Request
from fastapi.responses import JSONResponse
from typing import Optional
from urllib.parse import urlencode
import asyncpg

app = FastAPI(title="FHIR Facade", version="R4")

# Search parameters this facade supports. List the same ones in the CapabilityStatement.
SUPPORTED_PARAMS = {"family", "given", "_id"}
# The legacy system stores one letter. FHIR wants a code from its gender value set.
GENDER = {"M": "male", "F": "female", "O": "other"}

async def get_db():
    return await asyncpg.connect(
        host="legacy-db", database="hospital_ehr",
        user="fhir_readonly", password="***"
    )

def map_patient_to_fhir(row: dict) -> dict:
    """Map a legacy patient table row to a FHIR Patient resource."""
    return {
        "resourceType": "Patient",
        "id": str(row["patient_id"]),
        "meta": {"lastUpdated": row["modified_at"].isoformat()},
        "identifier": [{
            "system": "http://hospital.example.org/mrn",
            "value": row["mrn"]
        }],
        "name": [{
            "use": "official",
            "family": row["last_name"],
            "given": [row["first_name"]]
        }],
        "gender": GENDER.get(row["sex"], "unknown"),
        "birthDate": row["dob"].isoformat()
    }

def unsupported_search(names: list) -> JSONResponse:
    """400 with an OperationOutcome for search parameters we do not support."""
    return JSONResponse(status_code=400, content={
        "resourceType": "OperationOutcome",
        "issue": [{
            "severity": "error",
            "code": "not-supported",
            "diagnostics": f"Unsupported search parameter(s): {', '.join(sorted(names))}"
        }]
    })

@app.get("/fhir/Patient")
async def search_patient(
    request: Request,
    family: Optional[str] = Query(None),
    given: Optional[str] = Query(None),
    _id: Optional[str] = Query(None, alias="_id")
):
    # The R4 spec says servers SHOULD ignore unsupported parameters.
    # "Prefer: handling=strict" asks for an error instead.
    unknown = [k for k in request.query_params if k not in SUPPORTED_PARAMS]
    if unknown and "handling=strict" in request.headers.get("prefer", ""):
        return unsupported_search(unknown)

    # Translate FHIR search parameters to SQL. FHIR string search is
    # case-insensitive and matches the start of the value, so match a prefix.
    conditions, params = [], []
    if family:
        conditions.append(f"last_name ILIKE ${len(params)+1}")
        params.append(f"{family}%")
    if given:
        conditions.append(f"first_name ILIKE ${len(params)+1}")
        params.append(f"{given}%")
    if _id:
        conditions.append(f"patient_id = ${len(params)+1}")
        params.append(int(_id))

    where = " AND ".join(conditions) if conditions else "1=1"
    db = await get_db()
    rows = await db.fetch(f"SELECT * FROM patients WHERE {where} LIMIT 50", *params)
    await db.close()

    # The self link carries only the parameters we applied, so the client can see what was ignored.
    base = str(request.base_url).rstrip("/") + "/fhir/Patient"
    applied = [(k, v) for k, v in request.query_params.multi_items() if k in SUPPORTED_PARAMS]
    return {
        "resourceType": "Bundle",
        "type": "searchset",
        "link": [{"relation": "self", "url": f"{base}?{urlencode(applied)}"}],
        "entry": [{
            "fullUrl": f"{base}/{row['patient_id']}",
            "resource": map_patient_to_fhir(dict(row)),
            "search": {"mode": "match"}
        } for row in rows]
    }

@app.get("/fhir/metadata")
async def capability_statement():
    return {
        "resourceType": "CapabilityStatement",
        "status": "active",
        "date": "2026-10-30",
        "kind": "instance",
        "fhirVersion": "4.0.1",
        "format": ["json"],
        "rest": [{
            "mode": "server",
            "resource": [{
                "type": "Patient",
                "interaction": [{"code": "search-type"}],
                "searchParam": [
                    {"name": "family", "type": "string"},
                    {"name": "given", "type": "string"},
                    {"name": "_id", "type": "token"}
                ]
            }]
        }]
    }

FHIR string search is case-insensitive and matches the start of a value, so family=Smi returns Smith and not Nesmith. The R4 search specification says servers should generally ignore parameters they do not support, and that a client can ask for an error with Prefer: handling=strict. The code does both, and its self link shows only the parameters it applied.

We ran this example on 30 October 2026 with pytest, using a stubbed database and synthetic rows. All 5 tests passed, covering the prefix match, the gender mapping, ignored parameters, the strict 400 response and the metadata endpoint. It has not run against a real PostgreSQL server or a FHIR validator. A production version also needs connection pooling, paging, error handling and SMART on FHIR authorization.

FHIR facade vs repository vs hybrid: how to choose your FHIR architecture

Choose a facade when the source system is staying and clients mostly read small amounts of current data. Choose a repository when you need bulk export, full search or a FHIR-native write path, and a hybrid when different data has different needs.

QuestionFHIR facadeFHIR repositoryHybrid
Where does data live?In the source systemCopied to a FHIR storeSome copied, some in the source
How current is it?As current as the sourceAs current as the last loadVaries by resource
How fast are reads?Limited by the source systemSet by the FHIR storeFast for copied data, source speed for the rest
How much FHIR search?Only what you mapWhatever the server supportsWider for copied data, limited for live data
WritesHard: each write must map back to the sourceNative to the FHIR storeNeeds an agreed path back to the source of record
Main riskLoad on the source systemThe copy drifting from the sourceRunning and reconciling both paths
Best forRead-heavy access to systems that are stayingAnalytics, bulk export, new systemsMixed workloads and gradual migration
Three questions that settle most choices. This is our guidance, not part of any standard.

Worked example: a payer's claims system

Take an illustrative payer whose claims live in a legacy adjudication system. Apps search by _lastUpdated to pick up changes, and the payer also wants bulk $export for analytics.

With a live facade, every _lastUpdated search hits the claims system. If that system has no reliable last-modified time on every row a resource is built from, the facade cannot answer correctly. A bulk export means reading and mapping every claim at request time, which can load production for hours.

A FHIR store fed from the claims system answers both natively. The cost is that data is only as current as the last load, and you have to reconcile the copy against the source.

The likely answer is a hybrid: a live facade for single-member reads that must match the claims system, and a FHIR store for change search and bulk export. Write down the freshness you agree on, for example "changes visible within 15 minutes", so everyone tests against the same target.

Which legacy systems a facade can wrap

A facade can wrap any source you can query, but the effort differs a lot by source. The ratings below are our judgment of relative difficulty, and your schema can move a source up or down.

Six common source types and the FHIR resources a facade can expose from them.
SourceDifficultyMain challenge
HL7 v2 message storeMediumSegments do not map one to one. OBX can feed Observation, DiagnosticReport or DocumentReference depending on context. Our HL7v2 facade implementation guide covers the gateway, message store and search limits.
Relational databaseLow to mediumEvery schema is different, so mapping is built per deployment.
C-CDA documentsMedium to highC-CDA is organized by document section and FHIR by resource, so each section needs parsing.
X12 EDI (837, 835, 278)HighFinancial transactions with nested loops do not line up with clinical resources.
Proprietary EHR APIsVariesEach vendor has its own data model, authorization and rate limits. Epic, Oracle Health and MEDITECH each need their own adapter.
Flat files and batchLow to map, harder to keep currentYou have to store the data and detect changes between loads, so this is closer to a small repository.

What we learned from a multi-EHR FHIR facade

In one multi-EHR FHIR facade case study, we built a single FHIR R4 API for a healthcare data platform company, in front of Epic, Oracle Health (Cerner) and athenahealth. All three support FHIR R4, but authorization, data models and resource coverage differ. athenahealth needed the most adapter work, code system translation never finished, and caching rules had to differ by resource. EHR version drift was a real problem too, which is a good reason to test each adapter again after every vendor upgrade.

What regulations ask for, and what a facade does not settle

US rules ask for FHIR APIs from certain payers and from certified health IT, and neither rule mandates a facade. A facade is one way to build the API, and it has to meet the same implementation guides as any other.

The CMS-0057-F fact sheet covers Medicare Advantage organizations, state Medicaid and CHIP fee-for-service programs, Medicaid managed care plans, CHIP managed care entities and QHP issuers on the Federally Facilitated Exchanges. It sets two groups of dates:

  • In 2026: prior authorization decisions within 72 hours for urgent requests and 7 calendar days for standard ones (QHP issuers on the Exchanges are excluded), specific denial reasons, and public prior authorization metrics, first due by March 31, 2026.
  • From January 1, 2027, generally: the Patient Access, Provider Access, Payer-to-Payer and Prior Authorization APIs. Exact dates depend on payer type, and drug prior authorizations are excluded.

Hospitals are not directly covered by these API requirements. ONC's certification program is aimed at health IT developers, so a facade you run for your own apps does not need certification unless you plan to certify it. ONC's HTI-5 final rule, issued in October 2026, changes the certification criteria, so check its current list before you plan around any one criterion. If you are a payer planning for these dates, see our CMS-0057-F interoperability suite.

Outside the US, the 2025 State of FHIR survey by HL7 and Firely (expert input from 82 participants across 52 countries) reports FHIR mandated or recommended in 73% of countries with health data regulation.

How to integrate FHIR across legacy hospital systems: build or buy

You have four routes, and the right one depends on your engineers and your existing platform. Not every "FHIR server" is a facade: some products are built to store FHIR data, so check for a way to plug in your own data access.

RouteExamplesFacade supportFits teams that
Open-source frameworkHAPI FHIR Plain Server (Java)Built for an arbitrary backend you provide. You write the data access code.Have Java developers and want control
Commercial platformFirely Server, Smile CDR, InterSystems IRISFirely facade plugins, Smile CDR Hybrid Providers, InterSystems FHIR facadeWant vendor support and accept a license cost
Cloud FHIR serviceAzure Health Data Services, AWS HealthLake, Google Cloud Healthcare APIMainly FHIR stores, so they fit the repository or hybrid side. Azure's $convert-data converts HL7 v2 and C-CDA to FHIR.Already run on that cloud and accept a copy of the data
Custom buildFastAPI, Express, GoWhatever you write, including all of the FHIR behaviorNeed one narrow API on an unusual system

Our FHIR server comparison goes deeper on the fhir server architecture of the open-source, commercial and cloud routes. If you are hiring, a FHIR architect should own the CapabilityStatement and the search scope before anyone writes mappings.

Roll it out one resource group at a time

Start with Patient and add resources only when a client needs them, because each one brings its own mapping and terminology work. This is an order of work. Durations depend on your source system.

  1. Patient: the base of nearly every FHIR interaction, with simpler mapping.
  2. Clinical core: Condition, AllergyIntolerance and the medication resources.
  3. Diagnostics: Observation and DiagnosticReport, where varied local codes make mapping harder.
  4. Documents and visits: DocumentReference, Encounter and Procedure.
  5. Advanced features: writes and subscriptions, plus a fresh look at whether busy resources should move to a hybrid model.

Common FHIR facade mistakes

Most facade failures come from taking on too much scope or finding the source system's limits late.

Mapping everything at once

FHIR R4 lists about 145 resource types and no client needs all of them. Pick the ones your use case needs, using US Core profiles as a guide if you serve US clients.

Underestimating search

Each FHIR search parameter needs its own translation rule. Patient?name=Smith is simple. Observation?code=http://loinc.org|85354-9&date=gt2024-01-01&_include=Observation:patient is far harder, so decide which searches you will support before you promise them.

An inaccurate CapabilityStatement

Clients use /metadata to learn what your server can do. If it claims more than the facade supports, client apps fail in ways that are hard to trace, and conformance tests fail too.

No plan for load on the source

A pure facade queries the legacy system on every request, and a busy resource can overwhelm an old database. Use connection pooling, enforce _count limits, and resolve _include only when asked. Use HTTP caching headers such as ETag where you can. Any cache holding patient data needs the same security and audit controls as the source.

Skipping terminology mapping

Legacy systems often store local codes such as "Lab code 4532" where FHIR clients expect LOINC or SNOMED CT. Without crosswalk tables, the API returns valid FHIR that clients cannot interpret.

Adding authorization last

Modern FHIR clients expect SMART on FHIR, and retrofitting it leaves gaps. Design scopes and audit logging from the first endpoint.

How to test a FHIR facade

Test it against the FHIR specification and against your source data, because passing one says nothing about the other. A validator shows that a resource is well formed. It cannot show that the patient's allergy is the right one, so compare a sample of mapped records with the source system as well.

Inferno runs conformance tests against FHIR servers, and we use it on our own open-source work. Our open-source headless EHR passed 47 of 47 ONC (g)(10) SMART App Launch Standalone Patient App tests on 27 October 2026. That result covers the SMART group only, not full (g)(10), and that project is an EHR rather than a facade. Check authorization the same way on a facade.

Will a FHIR facade survive the move to R6?

Yes, if mapping code is kept apart from the adapters, because a new FHIR version then changes only the output mapping. FHIR R6 has reached normative balloting, and we found no final publication notice when we checked on 30 October 2026. Our FHIR R6 guide tracks what changes. A repository may also have to migrate stored data, which a facade avoids.

Planning a FHIR facade?

Bring us your source system and the first client you need to serve, and we will tell you whether a facade fits. Our FHIR facade development and API build work is done by a team that is ISO 27001:2022 certified and signs BAAs, and has built 350+ Mirth Connect interfaces. We have also run a SMART on FHIR app against the Epic and Oracle Health developer sandboxes.

Ready to scale?

Talk to our healthcare engineering team about building, integrating, and shipping faster.

Frequently Asked Questions

What is a FHIR facade?

A FHIR facade is a layer that exposes a FHIR API on top of a non-FHIR system such as a legacy EHR, an HL7 v2 message store or a relational database. Data stays in the source. The facade translates each request into the source's query language and maps the answer back into FHIR resources.

How do we expose legacy clinical data through a FHIR API?

You have two main options. A FHIR facade answers each request live from the legacy system, with no copy of the data. A FHIR repository loads a copy into a FHIR store. Start with a facade when the system is staying and clients mostly read small amounts of current data.

How do we integrate FHIR standards across legacy hospital systems?

Route each resource type to the system that owns it, for example Patient to the MPI and Observation to the lab system, and put one facade API in front. Add crosswalks for local codes, and start with Patient before adding more resources.

What is the difference between a FHIR facade and a FHIR repository?

A facade keeps data in the source and queries it at request time, so reads are as current as the source but search and speed are limited by it. A repository copies data to a FHIR store, which gives wider search and bulk export, but the copy can lag or drift.

What are the drawbacks of a FHIR facade?

Speed is limited by the source system, and every search parameter needs its own translation rule. Writes must map back to the source, bulk export can load production, and change search needs reliable last-modified times in the source.

What components make up a FHIR facade architecture?

Six parts: an API gateway or FHIR server shell, a SMART on FHIR authorization layer, a resource router, a mapping engine, legacy system adapters and an audit logger. The mapping engine is usually the hardest, because the work grows with every resource and search parameter.

Does CMS-0057-F require a FHIR facade?

No. CMS-0057-F requires impacted payers to provide specific FHIR APIs, generally from January 1, 2027, and does not say how to build them. A facade can serve some of that work, but bulk data needs often point to a FHIR store or a hybrid. Hospitals are not directly covered by these API requirements.

Which tools can build a FHIR facade?

HAPI FHIR Plain Server is built for a backend you provide. Firely Server has facade plugins, Smile CDR has Hybrid Providers, and InterSystems documents a FHIR facade approach. You can also build one in a framework such as FastAPI, but then you own all the FHIR behavior.
Share