Skip to main content

CLI Server

FHIR ANT can also run as a standalone command-line server on any platform that supports Dart (Linux, macOS, Windows). This is useful for development, CI/CD, and server deployments.

Running

cd packages/fhirant_server
dart run bin/server.dart

Options

FlagDefaultDescription
--port, -p8080Server port
--db-pathdata/dbDatabase file path
--sqlcipher-path(auto-detect)Custom SQLCipher library path
--config, -cYAML configuration file
--httpsfalseEnable HTTPS
--cert-pathHTTPS certificate file
--key-pathHTTPS private key file
--dev-modefalseDisable authentication
--help, -hShow usage

Environment Variables

VariableDescription
FHIRANT_ENCRYPTION_KEYDatabase encryption key
FHIRANT_JWT_SECRETJWT signing secret

Examples

# Basic server on port 3000
dart run bin/server.dart --port 3000

# Dev mode (no auth) with custom DB path
dart run bin/server.dart --dev-mode --db-path /tmp/fhirant

# HTTPS with certificates
dart run bin/server.dart --https --cert-path cert.pem --key-path key.pem

# Production with encryption key
FHIRANT_ENCRYPTION_KEY=my-secret-key dart run bin/server.dart

Docker

A Dockerfile is included for containerized deployments:

docker build -t fhirant .
docker run -p 8080:8080 -e FHIRANT_ENCRYPTION_KEY=my-key fhirant

Testing

# Run all server tests
cd packages/fhirant_server && dart test

# Run smoke test against a running server
dart run tools/smoke_test.dart http://localhost:8080

# Run smoke test with auth testing
dart run tools/smoke_test.dart http://localhost:8080 --auth