Skip to content

fhir-zodFHIR types and Zod validation for TypeScript

Install, import, validate. No generators, no servers, no HL7 toolchain required.

fhir-zod gives TypeScript developers FHIR types and runtime validation without the setup. Other approaches hand you a generator and expect you to run it. This one ships the output.

Get started

bash
npm install fhir-zod zod
ts
import { PatientSchema, type Patient } from "fhir-zod/r4/Patient";

const patient: Patient = {
  resourceType: "Patient",
  id: "john-doe",
  active: true,
  name: [{ family: "Doe", given: ["John"] }],
  gender: "male",
  birthDate: "1985-03-15",
};

const result = PatientSchema.safeParse(patient);

if (!result.success) {
  console.error(result.error.issues);
}

What you get

  • TypeScript models and Zod schemas for all core FHIR resources
  • Versioned imports for R5, R4B, R4, and STU3
  • Structural validation, primitive formatting, and choice-type checks
  • Tree-shakeable — you only bundle the FHIR version(s) your project uses
  • Works with Zod 3 and 4

What this library is not

  • Not a FHIR server
  • Not a FHIR client
  • Not a terminology validator
  • Not a FHIRPath engine
  • Not a profile-resolution or slicing engine

Next steps