Skip to main content

Installation

Requirements

  • Node.js >= 20
  • TypeScript >= 5.0
  • A package manager: npm, yarn, or pnpm

Install the Core Packages

For most projects, you need the core query builder and the runtime executor:

npm install @fhir-dsl/core @fhir-dsl/runtime

Or with pnpm:

pnpm add @fhir-dsl/core @fhir-dsl/runtime

Or with yarn:

yarn add @fhir-dsl/core @fhir-dsl/runtime

Install the CLI

The CLI generates TypeScript types from FHIR StructureDefinitions. Install it as a dev dependency:

npm install -D @fhir-dsl/cli

Or run it directly with npx:

npx @fhir-dsl/cli generate --version r4 --out ./src/fhir

Package Overview

PackageWhen to Install
@fhir-dsl/coreAlways -- this is the query builder
@fhir-dsl/runtimeAlways -- provides the HTTP executor
@fhir-dsl/cliDev dependency -- generates types for your project
@fhir-dsl/typesAutomatically installed as a dependency of @fhir-dsl/core
@fhir-dsl/fhirpathOptional -- for type-safe FHIRPath expression building
@fhir-dsl/generatorOnly if building custom tooling on top of the generator
@fhir-dsl/utilsOnly if building custom tooling

TypeScript Configuration

fhir-dsl requires strict mode enabled in your tsconfig.json for full type safety:

{
"compilerOptions": {
"strict": true,
"target": "ES2020",
"module": "ESNext",
"moduleResolution": "bundler"
}
}
tip

Without strict: true, optional properties won't be properly narrowed and some type guards won't work as expected.

Next Steps

Once installed, generate your types and start querying.