HFS Server

SkillFiles & storage

Run, configure, or debug the main HFS FHIR server. Use for hfs binary startup, HFS environment variables, storage backend selection, multi-tenancy routing, HFS REST endpoints, request/response compression, S3 storage, and server behavior flags.

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use the HFS Server skill

What this skill tells your AI

The instructions your AI receives, as published by heliossoftware/hfs in .agents/skills/run-hfs-server/SKILL.md and read by ahel’s review.

Use this when working with the helios-hfs binary or HFS runtime configuration.

Running

# Default: R4, SQLite, port 8080
cargo run --bin hfs

# PostgreSQL
HFS_STORAGE_BACKEND=postgres HFS_DATABASE_URL="postgresql://user:pass@localhost/fhir" cargo run --bin hfs

# SQLite plus Elasticsearch
HFS_STORAGE_BACKEND=sqlite-es HFS_ELASTICSEARCH_NODES="http://localhost:9200" cargo run --bin hfs

# S3, requires the s3 feature
HFS_STORAGE_BACKEND=s3 HFS_S3_BUCKET=my-bucket cargo run --bin hfs --features s3

# Environment overrides
HFS_SERVER_PORT=3000 HFS_LOG_LEVEL=debug cargo run --bin hfs

Server Environment

VariableDefaultDescription
HFS_SERVER_PORT8080Server port
HFS_SERVER_HOST127.0.0.1Host to bind
HFS_LOG_LEVELinfoLog level: error, warn, info, debug, trace
HFS_BASE_URLhttp://localhost:8080Public HTTP(S) base for Location headers and Bundle links
HFS_DATA_DIR./dataFHIR data directory, including search parameters
HFS_DASHBOARD_RECONCILE_SECS30Seconds between Home dashboard reconcile passes (--dashboard-reconcile-interval-secs). Whole seconds, > 0; 0 or non-numeric fails startup. Also spaces per-tenant full recounts (max(interval, 10 × last recount duration)) and failed-seed retries
HFS_DASHBOARD_REFRESH_SECS5Seconds between refreshes of a Home dashboard whose figures are moving (--dashboard-refresh-secs). Whole seconds, > 0, <= HFS_DASHBOARD_IDLE_REFRESH_SECS; otherwise fails startup. In-memory counters only
HFS_DASHBOARD_IDLE_REFRESH_SECS10Seconds between watch ticks of a settled Home dashboard (--dashboard-idle-refresh-secs). Whole seconds, > 0, >= HFS_DASHBOARD_REFRESH_SECS; otherwise fails startup

Set HFS_BASE_URL explicitly for containers and reverse proxies. Include any published path prefix. HFS rejects non-HTTP(S) values, credentials, query strings, and fragments, and it never derives the public base from request forwarding headers. A loopback base that conflicts with the listener produces a startup warning.

Limits

VariableDefaultDescription
HFS_MAX_BODY_SIZE10485760Max request body size in bytes, applied after decompression
HFS_REQUEST_TIMEOUT30Request timeout in seconds
HFS_DEFAULT_PAGE_SIZE20Default search result page size
HFS_MAX_PAGE_SIZE1000Maximum search result page size

Compression

hfs, sof-server, and hts accept gzip, deflate, br, and zstd request bodies via Content-Encoding. Unsupported encodings return 415. Responses are compressed when the client sends Accept-Encoding; Content-Encoding and Vary: Accept-Encoding are set. Body-size limits are enforced on decompressed bodies. SOF does not recompress application/parquet or application/zip.

CORS

VariableDefaultDescription
HFS_ENABLE_CORStrueEnable CORS
HFS_CORS_ORIGINS*Allowed origins
HFS_CORS_METHODSGET,POST,PUT,PATCH,DELETE,OPTIONSAllowed methods
HFS_CORS_HEADERSContent-Type,Authorization,Accept,...Allowed headers

Storage

VariableDefaultDescription
HFS_STORAGE_BACKENDsqliteStorage mode
HFS_DATABASE_URLnoneDatabase connection string
HFS_ELASTICSEARCH_NODEShttp://localhost:9200Comma-separated Elasticsearch node URLs
HFS_ELASTICSEARCH_INDEX_PREFIXhfsElasticsearch index prefix
HFS_ELASTICSEARCH_USERNAMEnoneElasticsearch basic auth username
HFS_ELASTICSEARCH_PASSWORDnoneElasticsearch basic auth password
HFS_COMPOSITE_SYNC_MODEasynchronousES-backed composite write sync mode: asynchronous, synchronous, or hybrid

Use HFS_COMPOSITE_SYNC_MODE=synchronous when callers need read-your-write search semantics, such as integration tests or bulk loads that immediately search.

Storage Backends

ModeValue
SQLitesqlite
SQLite plus Elasticsearchsqlite-elasticsearch or sqlite-es
PostgreSQLpostgres, pg, or postgresql
PostgreSQL plus Elasticsearchpostgres-elasticsearch or pg-es
S3s3
S3 plus Elasticsearchs3-elasticsearch or s3-es

S3 requires --features s3:

cargo build -p helios-hfs --features s3
HFS_STORAGE_BACKEND=s3 HFS_S3_BUCKET=my-bucket HFS_S3_REGION=us-east-1 cargo run --bin hfs --features s3
VariableDefaultDescription
HFS_S3_BUCKEThfsS3 bucket name in prefix-per-tenant mode
HFS_S3_REGIONAWS chainAWS region override
HFS_S3_ENDPOINTAWSS3-compatible endpoint URL, such as MinIO
HFS_S3_FORCE_PATH_STYLEfalseRequired by MinIO and most S3-compatible providers
HFS_S3_ALLOW_HTTPtrueAllow insecure HTTP endpoint URLs when HFS_S3_ENDPOINT is set
HFS_S3_VALIDATE_BUCKETStrueValidate bucket existence on startup

The standard AWS credential chain applies. For S3-compatible endpoints, set HFS_S3_ENDPOINT and HFS_S3_FORCE_PATH_STYLE=true. One HFS process shares a single AWS credential chain, so a MinIO primary store and real-AWS bulk-export output store cannot be combined in the same process.

Multi-tenancy

VariableDefaultDescription
HFS_DEFAULT_TENANTdefaultDefault tenant ID
HFS_TENANT_ROUTING_MODEheader_onlyheader_only, url_path, or both
HFS_TENANT_STRICT_VALIDATIONfalseError if URL and header tenant disagree
HFS_JWT_TENANT_CLAIMtenant_idJWT claim name for tenant, future use
# Via header, default
curl -H "X-Tenant-ID: clinic-a" http://localhost:8080/Patient

# Via URL path, requires HFS_TENANT_ROUTING_MODE=url_path or both
curl http://localhost:8080/clinic-a/Patient

Behavior

VariableDefaultDescription
HFS_DEFAULT_FHIR_VERSIONR4Default FHIR version: R4, R4B, R5, R6
HFS_ENABLE_REQUEST_IDtrueEnable request ID tracking
HFS_RETURN_GONEtrueReturn 410 Gone for deleted resources instead of 404
HFS_ENABLE_VERSIONINGtrueEnable ETag versioning
HFS_REQUIRE_IF_MATCHfalseRequire If-Match header for updates and deletes

API Endpoints

InteractionMethodURL
capabilitiesGET/metadata
readGET/[type]/[id]
vreadGET/[type]/[id]/_history/[vid]
updatePUT/[type]/[id]
patchPATCH/[type]/[id]
deleteDELETE/[type]/[id]
createPOST/[type]
searchGET/POST/[type]?params or /[type]/_search
history, instanceGET/[type]/[id]/_history
history, typeGET/[type]/_history
history, systemGET/_history
batch/transactionPOST/
healthGET/health

Signals

GitHub stars
51
Forks
19
Last commit
Sep 2026
Advanced
Catalog kind
skill
Gateway key
run-hfs-server
Source
github.com/heliossoftware/hfs