MinIO adapter (@healthzkit/minio)
The @healthzkit/minio package provides a HealthAdapter for the official minio JavaScript client. Each check calls listBuckets() and returns ok with metadata.latencyMs on success; transport or API errors return fail with the caught error.
Install the adapter package and the peer client:
pnpm add @healthzkit/minio minioPeer: minio >= 7.1.0 or >= 8.0.0.
Package entrypoints
@healthzkit/minio—minioAdapterand option types.@healthzkit/minio/minio—minioAdapteronly.
Both resolve to the same factory. Use the subpath when you want a dedicated entry for bundlers.
Shared options
BaseMinioOptions:
| Option | Description |
|---|---|
metadata | Optional (client) => Record<string, unknown> (sync or async) merged into metadata with latencyMs. |
Pass either config or an existing client (not both).
minioAdapter
Each check runs client.listBuckets() and records round-trip latency in metadata.latencyMs.
Config
Pass config as ClientOptions. The adapter lazily imports minio, creates a shared Client, and reuses it across checks.
import { createHealthKit } from "healthzkit";
import { minioAdapter } from "@healthzkit/minio";
const kit = createHealthKit({
checks: [
{
name: "minio",
type: ["readiness"],
adapter: minioAdapter({
config: {
endPoint: process.env.MINIO_ENDPOINT ?? "localhost",
port: Number(process.env.MINIO_PORT ?? 9000),
useSSL: process.env.MINIO_USE_SSL === "true",
accessKey: process.env.MINIO_ACCESS_KEY!,
secretKey: process.env.MINIO_SECRET_KEY!,
},
}),
},
],
});Existing client
Pass client as an existing Client. The adapter reuses that instance across checks.
import { Client } from "minio";
import { minioAdapter } from "@healthzkit/minio/minio";
const client = new Client({
endPoint: process.env.MINIO_ENDPOINT!,
port: 9000,
useSSL: false,
accessKey: process.env.MINIO_ACCESS_KEY!,
secretKey: process.env.MINIO_SECRET_KEY!,
});
const adapter = minioAdapter({
client,
metadata: () => ({ endpoint: process.env.MINIO_ENDPOINT }),
});Check metadata
Successful checks include latency and any custom metadata hook output:
{
"status": "ok",
"metadata": {
"latencyMs": 24,
"endpoint": "localhost"
}
}Wiring into createHealthKit
Treat the factory return value as adapter on a check (same as a hand-written { check() { ... } } object):
adapter: minioAdapter({ client: myMinioClient }),Combine with schedule on the check if you want cached readiness results instead of calling MinIO on every probe (see Scheduling).