Aidbox TS SDK is a pnpm monorepo of TypeScript libraries for building FHIR healthcare interfaces. Published under the @health-samurai npm scope.
| Package | Path | Description |
|---|---|---|
@health-samurai/aidbox-client |
packages/aidbox-client |
FHIR client library with Result monad error handling |
@health-samurai/react-components |
packages/react-components |
React design system (shadcn/ui + custom components) |
@health-samurai/aidbox-fhirpath-lsp |
packages/aidbox-fhirpath-lsp |
FHIRPath language server for CodeMirror |
react-components → aidbox-client, aidbox-fhirpath-lsp
aidbox-fhirpath-lsp → aidbox-client
- Runtime: Node.js 24, ES modules, TypeScript 5.8 (strict)
- Package manager: pnpm 10.21 (workspaces)
- Compilation: SWC (transpilation) + tsc (declarations only)
- Bundling: Vite 7 (dev/build), Tailwind CSS 4 (styles)
- UI: React 19, Radix UI, shadcn/ui, CodeMirror 6, TanStack Table
- Testing: Vitest 3.2
- Linting/Formatting: Biome 2.1
- Docs: Storybook 9 (components), TypeDoc (API)
pnpm install # Install all dependencies
pnpm -r run build # Build all packages (dependency order)
pnpm -r run lint:check # Lint all packages
pnpm -r run tsc:check # Type-check all packages
pnpm -r run test # Run all tests
pnpm hooks # Install git hookspnpm build # Compile with SWC + generate declarations
pnpm lint:check # Check with Biome
pnpm lint:fix # Auto-fix lint issues
pnpm format:fix # Auto-format
pnpm tsc:check # Type-check
pnpm test # Run tests (aidbox-client only)
pnpm storybook # Dev server on :6006 (react-components only)Enforced by Biome 2.1.3 — no ESLint or Prettier.
- Indentation: Tabs
- Quotes: Double quotes
- Imports: Auto-organized alphabetically
- Lint rules:
recommended+react+testdomains - FHIR types are excluded from linting (
!src/fhir-types/**)
- Main class:
AidboxClient<TBundle, TOperationOutcome, TUser>insrc/client.ts - Error handling via
Result<T, E>monad (src/result.ts) - Pluggable auth:
AuthProviderinterface withBrowserAuthProvider,BasicAuthProvider,SmartBackendServicesAuthProvider - Generated FHIR R4 types in
src/fhir-types/(do not edit manually) - Full FHIR HTTP coverage: instance/type/system-level operations
- Base layer: shadcn/ui components in
src/shadcn/components/ui/ - Custom components in
src/components/(DataTable, CodeEditor, TreeView, etc.) - Design tokens in
src/tokens.cssandsrc/index.css(CSS variables) - Typography utilities in
src/typography.css - Icons in
src/icons.tsx(custom FHIR domain SVGs + Lucide) - All exports via
src/index.tsx - Path alias:
#shadcn/*maps to./src/shadcn/*
- Web Worker-based LSP (
src/worker.ts) - React hooks for CodeMirror integration (
src/hooks.ts) - IndexedDB caching (
src/idb-cache.ts)
Tests live in packages/aidbox-client/test/. File parallelism is disabled (integration tests share state).
cd packages/aidbox-client
pnpm test # Run once
pnpm test:watch # Watch modeReact components use Storybook stories as visual tests (61 .stories.tsx files).
Runs automatically on commit (install with pnpm hooks):
pnpm -r run lint:check
pnpm -r run tsc:checkGitHub Actions workflows in .github/workflows/:
- common.yaml: Lint + typecheck on every push
- aidbox-client.yaml: Client-specific checks
- pages.yaml: Deploy Storybook + TypeDoc to GitHub Pages (master only)
- release.yaml: NPM publishing
- Always run
pnpm lint:fixafter editing code to match project formatting (tabs, double quotes, import ordering). - Do not edit files in
src/fhir-types/— these are generated. Usepnpm generate-typesif types need updating. - Build before type-checking when working across packages:
pnpm -r run build && pnpm -r run tsc:check. - Use the
Resultmonad for error handling inaidbox-client, not try/catch. - Follow shadcn/ui patterns for new UI components: CVA variants,
cn()utility, Radix primitives,asChildprop support. - Design tokens over hardcoded values — use CSS variables from
tokens.cssfor colors, spacing, and typography. - Add Storybook stories for new or modified React components.
- Import path: all react-components are exported from the single
src/index.tsxentry point. - Use the
/uiskill (Claude Code) when generating UI components to reference the full design system.