# fhirlint/fhirlint architecture

> Architecture diagram of the GitHub repository fhirlint/fhirlint, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/fhirlint/fhirlint
- Repository: https://github.com/fhirlint/fhirlint

## Overview

fhirlint is a FHIR validation CLI and Go library that wraps the HL7 FHIR Validator, then adds developer-oriented analysis and reporting. The principal workflow takes resources through validation and presents findings in pipeline-friendly formats; documented branches include profile coverage, linting, suppression, baselines, audits, and editor support. The graph uses sampled source and the README; some capability links rely on README-level documentation because their command implementations were not sampled.

Main entry points: [`internal/validator/run.go`](https://github.com/fhirlint/fhirlint/blob/main/internal/validator/run.go) (HL7 validator), [`cmd/root.go`](https://github.com/fhirlint/fhirlint/blob/main/cmd/root.go) (CLI commands), [`cmd/coverage.go`](https://github.com/fhirlint/fhirlint/blob/main/cmd/coverage.go) (Coverage command), [`internal/lsp/server.go`](https://github.com/fhirlint/fhirlint/blob/main/internal/lsp/server.go) (Language server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User Interfaces"]
  node_cli["CLI commands<br/>[root.go]"]
  node_library["Go API<br/>[fhirlint.go]"]
  node_lsp["Language server<br/>[server.go]"]
end

subgraph group_validation["Validation"]
  node_inputs["Resource input<br/>[reader.go]"]
  node_validator["HL7 validator<br/>[run.go]"]
  node_validatorjar["Validator JAR<br/>[jar.go]"]
end

subgraph group_analysis["Analysis"]
  node_rules["Custom rules<br/>[engine.go]"]
  node_lint["Style lint<br/>[lint.go]"]
  node_references["Reference checks<br/>[refcheck.go]"]
  node_coveragecmd["Coverage command<br/>[coverage.go]"]
  node_coverage["Profile coverage<br/>[coverage.go]"]
  node_igaudit["IG audit<br/>[igaudit.go]"]
  node_configcheck["Config checks<br/>[check.go]"]
end

subgraph group_outputs["Findings and Reports"]
  node_suppression["Suppressions<br/>[suppress.go]"]
  node_baseline["Validation baselines<br/>[baseline.go]"]
  node_reporter["Report formats<br/>[group.go]"]
end

subgraph group_ecosystem["FHIR Ecosystem"]
  node_packagecache[("FHIR package cache<br/>[fhirpkg.go]")]
  node_registry["FHIR registries<br/>[registry.go]"]
  node_java["Java runtime"]
end

node_user(("Developer"))

node_user -->|"runs commands"| node_cli
node_user -->|"calls API"| node_library
node_user -.->|"uses editor"| node_lsp
node_cli -->|"validates resources"| node_validator
node_cli -->|"requests coverage"| node_coveragecmd
node_coveragecmd -->|"runs measurement"| node_coverage
node_cli -.->|"checks configuration"| node_configcheck
node_cli -.->|"audits packages"| node_igaudit
node_library -->|"runs validation"| node_validator
node_lsp -->|"validates documents"| node_validator
node_validator -.->|"reads resources"| node_inputs
node_validator -.->|"invokes JAR"| node_validatorjar
node_validator -->|"requires runtime"| node_java
node_validator -.->|"applies rules"| node_rules
node_validator -.->|"checks style"| node_lint
node_validator -.->|"checks references"| node_references
node_validator -.->|"filters findings"| node_suppression
node_validator -.->|"compares baseline"| node_baseline
node_validator -.->|"formats findings"| node_reporter
node_coveragecmd -->|"loads packages"| node_packagecache
node_coveragecmd -->|"downloads packages"| node_registry
node_igaudit -->|"checks package versions"| node_registry
node_lsp -.->|"offers suppressions"| node_suppression

click node_cli "https://github.com/fhirlint/fhirlint/blob/main/cmd/root.go"
click node_library "https://github.com/fhirlint/fhirlint/blob/main/pkg/fhirlint/fhirlint.go"
click node_lsp "https://github.com/fhirlint/fhirlint/blob/main/internal/lsp/server.go"
click node_inputs "https://github.com/fhirlint/fhirlint/blob/main/internal/input/reader.go"
click node_validator "https://github.com/fhirlint/fhirlint/blob/main/internal/validator/run.go"
click node_validatorjar "https://github.com/fhirlint/fhirlint/blob/main/internal/validator/jar.go"
click node_rules "https://github.com/fhirlint/fhirlint/blob/main/internal/rules/engine.go"
click node_lint "https://github.com/fhirlint/fhirlint/blob/main/internal/lint/lint.go"
click node_references "https://github.com/fhirlint/fhirlint/blob/main/internal/refcheck/refcheck.go"
click node_coveragecmd "https://github.com/fhirlint/fhirlint/blob/main/cmd/coverage.go"
click node_coverage "https://github.com/fhirlint/fhirlint/blob/main/internal/coverage/coverage.go"
click node_igaudit "https://github.com/fhirlint/fhirlint/blob/main/internal/igaudit/igaudit.go"
click node_configcheck "https://github.com/fhirlint/fhirlint/blob/main/internal/configcheck/check.go"
click node_suppression "https://github.com/fhirlint/fhirlint/blob/main/internal/suppress/suppress.go"
click node_baseline "https://github.com/fhirlint/fhirlint/blob/main/internal/baseline/baseline.go"
click node_reporter "https://github.com/fhirlint/fhirlint/blob/main/internal/reporter/group.go"
click node_packagecache "https://github.com/fhirlint/fhirlint/blob/main/internal/fhirpkg/fhirpkg.go"
click node_registry "https://github.com/fhirlint/fhirlint/blob/main/internal/registry/registry.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_library,node_lsp toneBlue
class node_inputs,node_validator,node_validatorjar toneAmber
class node_rules,node_lint,node_references,node_coveragecmd,node_coverage,node_igaudit,node_configcheck toneMint
class node_suppression,node_baseline,node_reporter toneRose
class node_packagecache,node_registry,node_java,node_user toneIndigo
```

## Components

### User Interfaces

- [CLI commands](https://github.com/fhirlint/fhirlint/blob/main/cmd/root.go): `cmd/root.go`
- [Go API](https://github.com/fhirlint/fhirlint/blob/main/pkg/fhirlint/fhirlint.go): `pkg/fhirlint/fhirlint.go`
- [Language server](https://github.com/fhirlint/fhirlint/blob/main/internal/lsp/server.go): `internal/lsp/server.go`

### Validation

- [Resource input](https://github.com/fhirlint/fhirlint/blob/main/internal/input/reader.go): `internal/input/reader.go`
- [HL7 validator](https://github.com/fhirlint/fhirlint/blob/main/internal/validator/run.go): `internal/validator/run.go`
- [Validator JAR](https://github.com/fhirlint/fhirlint/blob/main/internal/validator/jar.go): `internal/validator/jar.go`

### Analysis

- [Custom rules](https://github.com/fhirlint/fhirlint/blob/main/internal/rules/engine.go): `internal/rules/engine.go`
- [Style lint](https://github.com/fhirlint/fhirlint/blob/main/internal/lint/lint.go): `internal/lint/lint.go`
- [Reference checks](https://github.com/fhirlint/fhirlint/blob/main/internal/refcheck/refcheck.go): `internal/refcheck/refcheck.go`
- [Coverage command](https://github.com/fhirlint/fhirlint/blob/main/cmd/coverage.go): `cmd/coverage.go`
- [Profile coverage](https://github.com/fhirlint/fhirlint/blob/main/internal/coverage/coverage.go): `internal/coverage/coverage.go`
- [IG audit](https://github.com/fhirlint/fhirlint/blob/main/internal/igaudit/igaudit.go): `internal/igaudit/igaudit.go`
- [Config checks](https://github.com/fhirlint/fhirlint/blob/main/internal/configcheck/check.go): `internal/configcheck/check.go`

### Findings and Reports

- [Suppressions](https://github.com/fhirlint/fhirlint/blob/main/internal/suppress/suppress.go): `internal/suppress/suppress.go`
- [Validation baselines](https://github.com/fhirlint/fhirlint/blob/main/internal/baseline/baseline.go): `internal/baseline/baseline.go`
- [Report formats](https://github.com/fhirlint/fhirlint/blob/main/internal/reporter/group.go): `internal/reporter/group.go`

### FHIR Ecosystem

- [FHIR package cache](https://github.com/fhirlint/fhirlint/blob/main/internal/fhirpkg/fhirpkg.go): `internal/fhirpkg/fhirpkg.go`
- [FHIR registries](https://github.com/fhirlint/fhirlint/blob/main/internal/registry/registry.go): `internal/registry/registry.go`
- **Java runtime**

### Other components

- **Developer**

## Connections

- Developer → CLI commands: runs commands (evidence: `README.md`)
- Developer → Go API: calls API (evidence: `pkg/fhirlint/fhirlint.go`)
- Developer → Language server: uses editor (evidence: `README.md`)
- CLI commands → HL7 validator: validates resources
- CLI commands → Coverage command: requests coverage (evidence: `README.md`)
- Coverage command → Profile coverage: runs measurement (evidence: `cmd/coverage.go`)
- CLI commands → Config checks: checks configuration (evidence: `README.md`)
- CLI commands → IG audit: audits packages (evidence: `README.md`)
- Go API → HL7 validator: runs validation (evidence: `pkg/fhirlint/fhirlint.go`)
- Language server → HL7 validator: validates documents (evidence: `internal/lsp/server.go`)
- HL7 validator → Resource input: reads resources
- HL7 validator → Validator JAR: invokes JAR (evidence: `README.md`)
- HL7 validator → Java runtime: requires runtime (evidence: `README.md`)
- HL7 validator → Custom rules: applies rules (evidence: `README.md`)
- HL7 validator → Style lint: checks style (evidence: `README.md`)
- HL7 validator → Reference checks: checks references (evidence: `README.md`)
- HL7 validator → Suppressions: filters findings (evidence: `README.md`)
- HL7 validator → Validation baselines: compares baseline (evidence: `README.md`)
- HL7 validator → Report formats: formats findings (evidence: `README.md`)
- Coverage command → FHIR package cache: loads packages (evidence: `cmd/coverage.go`)
- Coverage command → FHIR registries: downloads packages (evidence: `cmd/coverage.go`)
- IG audit → FHIR registries: checks package versions (evidence: `internal/igaudit/igaudit.go`)
- Language server → Suppressions: offers suppressions (evidence: `internal/lsp/server.go`)
