Skip to main content
WIP MITHealthcare Services

FHIR TS Client

TypeScript FHIR R4 client optimized for Angular, type-safe and tree-shakeable

Status
WIP
License
MIT
Category
Healthcare Services
Updated

Project status

Description

FHIR TS Client is a utility library in TypeScript for consuming FHIR R4 servers from Angular 21 applications with end-to-end type safety. It fills a concrete gap in the FHIR JavaScript ecosystem: existing libraries (fhir.js, @types/fhir) are either untyped or not optimized for Angular (no RxJS, no tree-shaking, no SSR-safe).

Key Features

  • Type-safe FHIR R4 Resources

    Type definitions generate official StructureDefinition R4 content, 145+ resource types, rich IntelliSense in IDE, type narrowing for profiles.

  • Angular Native RXJS Observables

    Client HTTP + Observable pattern, no Promise wrapping, natural integration with async pipe + Signals interoperability (toSignal).

  • Runtime Validation for Zod

    Schema Zod for each resource type, payload validation server response, fail-fast on schema mismatch, type narrowing after validation.

  • Tree-shakable ESM

    Import per-resource (import

  • Angular SSR with Server-Side Rendering safe for use in a server-side rendering environment using Node.

    No window/document references, Angular standard, prerender-friendly, tested with Angular Server-Side Rendering 21.

  • Repository pattern for CRUD operations

    Patient Repository Class with find/findById/create/update/delete/search, query builder for FHIR criteria, auto-paginated Bundles.

  • Error Handling Operation Outcome

    Errors typed as OperationOutcome FHIR Resource, severity (error/warning/information), location FHIRPath, structured issue details.

  • High test coverage achieved!

    Karma + Jasmine unit test, Playwright E2E against HAPI FHIR Dockerized, Coverage Report HTML, CI-ready.

Angular + Spring Boot on top of a PostgreSQL database hosted in the cloud via AWS or Google Cloud Platform

  • TypeScript 5.9
  • Angular 21
  • RxJS
  • Zod
  • FHIR R4
  • HAPI FHIR (test server)
  • Karma
  • Jasmine
  • Playwright
  • MkDocs Material

Use cases

  • Angular developers integrating existing frontend with server FHIR R4 (HAPI FHIR, Smile CDR, Microsoft FHIR Server)
  • Team builds patient portals on FHIR standards for enterprise healthcare.
  • Start your digital health startup with type safety and FHIR without writing boilerplate code.
  • System integrator migrating from fhir.js untyped to a type-safe Angular-native library

Road Map

  1. v0.1.0Scheduled

    Core: Patient Profile and Medical Conditions

    • Type definitions: Patient, Observation, and Condition
    • HTTP Client Base with FHIR Interceptor and Content-Type
    • Patient Repository CRUD Base
    • Schema Validation MVP
  2. v0.5.0Scheduled

    Expansion: 30+ Resource Types + Search

    • 30+ resource types with repositories
    • Type-Safe Query Builder for FHIR Search Criteria
    • Automatic bundle pagination
    • Error handling tips for operations.
  3. v1.0.0Scheduled

    Full coverage 145 Resources + Production Ready

    • Type definitions for all 145 R4 Resources
    • Tree shaking optimized ESM.
    • End-to-End Testing with Playwright for 80%+ Test Coverage
    • npm publish and complete MkDocs documentation

Who is it for

  • Junior/ Mid-Level Developer
  • For Developer Senior

Quick start

Start the project locally with four commands, requires Docker and GitHub Desktop is not required but a git client like SourceTree or Visual Studio Code's built-in one will do just fine though.

# Quick start (work-in-progress, repo non ancora pubblicato)
# npm install @fedcal/fhir-ts-client
# import { PatientClient } from '@fedcal/fhir-ts-client/patient';
# const client = inject(PatientClient);
# client.findById('123').subscribe(patient => console.log(patient.name));

Contribute to the project

FHIR TS Client is open source. Open an issue, propose a pull request or leave a star on GitHub: every contribution, no matter how small, is welcome.

  • ⭐ Leave a star if it's useful
  • 🐛 Report bugs or suggest features via issue
  • 🔧 Send a pull request with fixes or improvements
  • 📣 Share the project if you find it interesting