FHIR in Rust

Model FHIR in typed Rust — five releases, R2 through R6 — and store it in a SQL database as real relational tables — typed columns, child tables, foreign keys, check constraints — not JSON blobs. Get it back losslessly.

Start the tutorial Run the examples

Pre-release. Each database port is described at its own conformance level. The conformance matrix is the status document to trust, and the audit findings list every known divergence, with evidence.

What is here

Four families, one repository

A data model, six storage libraries, a shared persistence core, and an HTTP surface — deliberately separate, composing in one direction.

fhir — the model

The complete HL7 FHIR data model as Rust types — five releases (R2–R6) as separate crates, generated from the official specification, with validation, builders, choice enums, an XML bridge, a REST client, and cross-release conversion with a loss report.

fhir-<engine> — the databases

Six FHIR-to-relational libraries — PostgreSQL, SQLite, MySQL, MariaDB, SQL Server, Oracle — one specification, one shared pure-Rust core, identical across all six and gated in CI. Schemas are generated from the FHIR specification packages.

fhir-loco — the server

A FHIR RESTful API — Rust, Loco, Axum — mounted over a store. CRUD, vread, history, search, CapabilityStatement, PASETO authentication. The split is the point: storage guarantees live in the libraries, HTTP lives here.

The databases

Six ports

Conformance levels, not feature lists: what has been verified for that port.

PortDatabaseStatus
fhir-postgresqlPostgreSQL 18Reference full store, full test suite
fhir-sqliteSQLite 3Store native, embeddable, no server
fhir-mysqlMySQL 8.4Store
fhir-mariadbMariaDB 11.4Store
fhir-mssqlSQL ServerStore live-verified; a standing TLS advisory risk (F-67)
fhir-oracleOracle DatabaseStore live-verified; no upgrade path yet, snapshot reads open

The levels are defined in Conformance, and broken down requirement by requirement in the conformance matrix — read that before choosing one.

Learn it

Guides and tutorials

The specification decides what must be true; these explain how it works.

Run it

Examples

Complete programs from the model crate — each one a tutorial in its header comment.

Run one from a checkout with cargo run --example <name> — see the examples index.

Implement or audit it

The specifications

Four families, four bodies of requirements. Requirement ids are permanent.

The specification root says which spec governs which code and how the requirement-id namespaces relate. Non-normative companions: conformance matrix · audit findings · locale and accent folding · publishing readiness. The server specification covers the HTTP surface.

Use it

On crates.io, and in one repository

The model family is published; the database ports are pre-release.

The model is fhir = "3" — five releases behind cargo features, r5 on by default. The database ports and the server are pre-release in the fhir-rust repository, each at the conformance level the matrix states.