Skip to main content

TypeScript SDK

The Haste Health TypeScript SDK provides type-safe libraries for building FHIR applications in JavaScript and TypeScript. All packages are published to npm under the @haste-health scope.

Core Packages

@haste-health/client

FHIR client for making API requests to Haste Health servers.

npm install @haste-health/client

Features:

  • Type-safe FHIR operations (create, read, update, delete, search)
  • Middleware support for request/response customization
  • HTTP client with automatic authentication
  • Operation execution support
  • Transaction and batch request support

View API documentation →

@haste-health/fhir-types

Complete FHIR R4 and R4B TypeScript type definitions.

npm install @haste-health/fhir-types

Features:

  • All FHIR R4 resource types
  • Full type safety with TypeScript
  • Custom Haste Health resource types (AccessPolicyV2, User, Project, Membership, IdentityProvider)
  • Primitive types (code, uri, id, etc.)

View API documentation →

@haste-health/fhirpath

FHIRPath expression evaluation for JavaScript/TypeScript.

npm install @haste-health/fhirpath

Features:

  • FHIRPath expression parsing and evaluation
  • Resource querying and filtering

View API documentation →

@haste-health/jwt

JWT token handling for OAuth 2.0 authentication.

npm install @haste-health/jwt

Features:

  • Custom Haste Health claims
  • SMART on FHIR scope support
  • TypeScript types for token payloads

View API documentation →

Additional Packages

  • @haste-health/fhir-validation: FHIR resource validation against StructureDefinitions
  • @haste-health/operation-execution: Execute FHIR operations with type safety
  • @haste-health/generated-ops: Auto-generated operation definitions
  • @haste-health/smart-launch: SMART on FHIR app launch flow
  • @haste-health/fhir-patch-building: Build FHIR Patch operations
  • @haste-health/hl7v2-parsing: Parse HL7 v2 messages
  • @haste-health/x-fhir-query: x-fhir-query support see here

Complete Documentation

Full API reference for all packages is available at typescript.haste.health.

Example Usage

import createHTTPClient from "@haste-health/client/http";
import { Patient } from '@haste-health/fhir-types/r4/types';
import { R4 } from '@haste-health/fhir-types/versions';

const client = createHTTPClient({
url: OPEN_URL,
});

// Create a patient
const patient: Patient = {
resourceType: 'Patient',
name: [{ family: 'Smith', given: ['John'] }]
};

const resource = await client.create(
{},
R4,
patient as Resource
);
console.log(response);

// Search for patients
const searchResponse = await client.search_type(
{},
R4,
"Patient",
"name=John" ?? ""
);

Installation

Install packages using npm, yarn, or pnpm:

npm install @haste-health/client @haste-health/fhir-types
yarn add @haste-health/client @haste-health/fhir-types
pnpm add @haste-health/client @haste-health/fhir-types

Source Code

All packages are open source and available in the HasteHealth/HasteHealth repository.