npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@fhir-dsl/cli

v0.48.1

Published

CLI tool for generating type-safe FHIR TypeScript types from HL7 specs and profiles

Downloads

3,913

Readme

@fhir-dsl/cli

CLI tool for generating type-safe FHIR TypeScript types from official HL7 specifications and Implementation Guides.

Generates the FhirSchema type used by @fhir-dsl/core for compile-time query safety.

Install

# Global install
npm install -g @fhir-dsl/cli

# Or use with npx
npx @fhir-dsl/cli generate --version r4 --out ./src/fhir

Usage

Generate types from base FHIR R4

fhir-gen generate \
  --version r4 \
  --out ./src/fhir

Generate with US Core profiles

fhir-gen generate \
  --version r4 \
  --ig [email protected] \
  --out ./src/fhir

Generate specific resources only

fhir-gen generate \
  --version r4 \
  --resources Patient,Observation,Condition \
  --out ./src/fhir

Use a local FHIR definitions directory

fhir-gen generate \
  --version r4 \
  --src ./local-fhir-definitions \
  --out ./src/fhir

Emit markdown spec for AI assistants

fhir-gen generate \
  --version r4 \
  --resources Patient,Observation \
  --include-spec \
  --out ./src/fhir

Writes a parallel spec/ tree with one markdown file per resource (and per profile when --ig is used), plus an index.md. Intended as context for AI coding assistants: they get the properties table, cardinality, terminology bindings, and search parameters in a format that's easy to embed or attach.

Commands

fhir-gen generate

Generate TypeScript types from FHIR specification.

| Flag | Required | Default | Description | |---|---|---|---| | --version <version> | Yes | r4 | FHIR version (r4, r4b, r5, r6) | | --out <dir> | Yes | - | Output directory for generated types | | --ig <packages...> | No | - | IG packages to include (e.g., [email protected]) | | --resources <list> | No | all | Comma-separated resource names to generate | | --src <path> | No | - | Local path to FHIR definitions (skips download) | | --cache <dir> | No | - | Cache directory for downloaded specs | | --expand-valuesets | No | false | Generate typed unions from FHIR ValueSet bindings | | --resolve-codesystems | No | false | Generate CodeSystem namespace objects for IntelliSense | | --include-spec | No | false | Emit markdown spec files alongside types (for AI/LLM context) |

What gets generated

out/
  index.ts           # FhirSchema type and re-exports
  primitives.ts      # FHIR primitive types (string, uri, dateTime, etc.)
  datatypes.ts       # Complex datatypes (HumanName, Address, CodeableConcept, etc.)
  registry.ts        # Resource type registry mapping
  search-params.ts   # Typed search parameters per resource
  resources/
    patient.ts       # Patient interface
    observation.ts   # Observation interface
    ...              # One file per resource
  profiles/          # (when --ig is used)
    uscore-patient-profile.ts
    uscore-vital-signs-profile.ts
    ...
  spec/              # (when --include-spec is used)
    index.md
    resources/*.md
    profiles/*.md    # (when --ig is also used)
  client.ts          # Pre-configured FhirClient type

The generated FhirSchema type wires everything together so that @fhir-dsl/core can provide full type safety for queries, includes, and profile narrowing.

License

MIT