Adopt @open-xchange/fastify-sdk
- Deciders: David Bauer, Julian Bäume
- Date: 2026-06-12
Status
Accepted
Context
Booking is a from-scratch Node.js port of a Spring Boot service, so there is no legacy infrastructure code to migrate away from - but there is a choice to make about how much of Fastify's plumbing to hand-roll versus adopt from @open-xchange/fastify-sdk.
The service needs, at minimum: config loading from environment/YAML, structured logging, health/readiness probes, Prometheus metrics on a separate port, a MariaDB connection pool with lifecycle management, Umzug migration tooling (both a startup pending-migrations check and a standalone CLI/Job entry point), request validation, and a Vitest-based test harness that can boot the app in-process.
Building all of this bespoke would duplicate work the SDK already solves and maintains, spreading cross-cutting infrastructure code across a service whose value is in booking domain logic, not plumbing.
Decision
Adopt @open-xchange/fastify-sdk as the foundation from day one: createApp() for the Fastify instance, loadEnv()/requireEnv() for environment handling, the SDK's DATABASES/DB_<NAME>_* convention and MariaDB pool/migrations integration, the SDK's hot-reloadable YAML config registry (Joi-validated), the /live//ready//metrics server on its own port, and createTestApp() + app.inject() for unit/route tests.
Consequences
Positive
- A single upgrade point for cross-cutting concerns: bump the SDK, get updated config/logging/health/metrics behavior.
- No bespoke health-check, graceful-shutdown, or metrics-server code to write or maintain in this repository.
- The hot-reload config registry directly enables replacing the Java service's
PATCH /configendpoint with a watchedconfig.yaml(see ADR-0007) instead of building that mechanism from scratch. - MariaDB pool lifecycle, readiness checks, and migration tooling (
runMigrationsCLI, startup pending-migration guard) come for free.
Negative
- Booking depends on the SDK's release cadence and API surface; a regression or breaking change upstream surfaces here too.
- The SDK is an internal package with thinner documentation than mainstream Fastify plugins; onboarding leans on reading the SDK source and this repository's own wiring.
- Some Java-service concepts (e.g. Spring's actuator-based readiness) don't map 1:1 and required small adapter code (e.g. the DB-ping readiness check, the domain Prometheus counters in
src/services/metrics.ts).
References
@open-xchange/fastify-sdk(private registry)src/index.ts(createApp()wiring)

