|
| 1 | +# DEVELOPER.md |
| 2 | + |
| 3 | +## Overview |
| 4 | +- Harmony Proxy is a Rust workspace providing a configurable data mesh proxy/gateway for heterogeneous systems, with first-class healthcare protocols (FHIR, JMIX, DICOM/DICOMweb). It is part of the Runbeam ecosystem. |
| 5 | +- Key concepts: endpoints, middleware, services/backends, pipelines, and storage. See [docs/README.md](docs/README.md) for full architecture. |
| 6 | + |
| 7 | +## Prerequisites |
| 8 | +- Rust (stable) via rustup |
| 9 | +- macOS or Linux |
| 10 | +- Optional: DCMTK tools for DIMSE integration tests (e.g., macOS: `brew install dcmtk`, Debian/Ubuntu: `sudo apt-get install dcmtk`) |
| 11 | + |
| 12 | +## Repository layout |
| 13 | +- Root crate: harmony (src/lib.rs, src/main.rs) |
| 14 | +- Workspace crates: crates/dimse, crates/dicom_json_tool, crates/transform |
| 15 | +- Examples: examples/config (config.toml, pipelines/, transforms/), examples/custom_endpoint (example crate) |
| 16 | +- Docs: docs/* (getting-started, configuration, endpoints, middleware, backends, router, envelope, dimse-integration, testing, security, system-description) |
| 17 | +- Samples: samples/jolt/*; additional DICOM samples in dev/samples |
| 18 | +- Temporary outputs: prefer ./tmp (gitignored) over /tmp |
| 19 | + |
| 20 | +## Build, run, test |
| 21 | +- Build (debug): `cargo build` |
| 22 | +- Build (release): `cargo build --release` |
| 23 | +- Run with example config: `cargo run -- --config examples/config/config.toml` |
| 24 | +- Run tests: `cargo test` |
| 25 | +- With logs: `RUST_LOG=harmony=debug cargo test -- --nocapture` |
| 26 | +- Format: `cargo fmt --all` |
| 27 | +- Lint: `cargo clippy --all-targets -- -D warnings` |
| 28 | + |
| 29 | +## Configuration model (high level) |
| 30 | +- Config is loaded from the provided TOML file and can merge additional files from proxy.pipelines_path and proxy.transforms_path relative to the base config directory. |
| 31 | +- Major sections: proxy, network, pipelines, endpoints, backends, middleware/middleware_types, services, targets, storage, transforms. |
| 32 | +- Validation enforces: proxy ID and log level; per-network interface/HTTP constraints; pipeline endpoints exist; middleware_types are known or specified via module; targets have non-empty URLs; storage backend options are valid. |
| 33 | +- See: src/config/config.rs and [docs/configuration.md](docs/configuration.md). |
| 34 | + |
| 35 | +## Pipelines and middleware |
| 36 | +- Pipelines bind networks to endpoints and an ordered set of middleware/services. |
| 37 | +- Built-in middleware types include: jwtauth, auth, connect, passthru, json_extractor, jmix_builder, dicomweb_to_dicom, dicom_to_dicomweb, dicomweb, transform. |
| 38 | +- JWT guidance: prefer RS256 in production, enforce algorithm, validate exp/nbf/iat, iss/aud as applicable. HS256 is for development/tests only. |
| 39 | + |
| 40 | +## JMIX and schema path |
| 41 | +- The JMIX schema directory used by validation or transforms is configurable and may be placed outside the repo (e.g., ../jmix). Ensure paths in config reference your chosen location. |
| 42 | + |
| 43 | +## Storage and tmp |
| 44 | +- Filesystem storage defaults to a project-local ./tmp directory. Favor ./tmp for all temporary files. The path may be configurable via storage options. |
| 45 | + |
| 46 | +## Testing notes |
| 47 | +- Strategy: unit/integration tests should be fast and deterministic. See [docs/testing.md](docs/testing.md). |
| 48 | +- DIMSE integration: DCMTK processes may be spawned; artifacts are written under ./tmp with per-test UUIDs. Enable verbose DIMSE output with `HARMONY_TEST_VERBOSE_DCMTK=1`. Additional debugging: `HARMONY_TEST_DEBUG=1`. |
| 49 | +- Sample data: samples/ and dev/samples/ contain example inputs. |
| 50 | + |
| 51 | +## Security considerations |
| 52 | +- Encryption: the project uses AES-256-GCM where applicable, with ephemeral public key, IV, and authentication tag encoded in base64. |
| 53 | +- Credentials and secrets: do not commit. Load via environment variables or secret managers. Prefer least-privilege file permissions. |
| 54 | +- JWT: in production, require RS256 with strict algorithm checks and claim validation. |
| 55 | +- Temporary files: prefer ./tmp within the working directory. |
| 56 | +- See [docs/security.md](docs/security.md) for more detail. |
| 57 | + |
| 58 | +## Commit and PR hygiene |
| 59 | +- Use Conventional Commits for messages (e.g., feat:, fix:, docs:, refactor:, test:, build:, ci:, chore:, perf:, style:, revert:). Keep PRs focused; avoid mixing unrelated changes. |
| 60 | +- Trunk-based development: open feature branches targeting main. |
| 61 | +- Tests, lint, and fmt should pass locally before opening a PR. |
| 62 | + |
| 63 | +## Quick links |
| 64 | +- README: [README.md](README.md) |
| 65 | +- Docs index: [docs/README.md](docs/README.md) |
| 66 | +- Getting started: [docs/getting-started.md](docs/getting-started.md) |
| 67 | +- Configuration: [docs/configuration.md](docs/configuration.md) |
| 68 | +- Middleware: [docs/middleware.md](docs/middleware.md) |
| 69 | +- Security: [docs/security.md](docs/security.md) |
| 70 | +- Testing: [docs/testing.md](docs/testing.md) |
| 71 | +- Router: [docs/router.md](docs/router.md) |
0 commit comments