Skip to main content
The @healthzkit/drizzle package provides a HealthAdapter for an existing Drizzle ORM database instance. Successful checks run a lightweight SQL probe (default SELECT 1) through Drizzle—execute for Postgres and MySQL, run for SQLite—and return ok with metadata.latencyMs plus any fields from an optional metadata hook; failures return fail with the caught error. Install the adapter package and drizzle-orm (your app already has both if you use Drizzle):
Drivers stay in your app. This package does not list pg, mysql2, or SQLite clients as peer dependencies. The probe uses Drizzle’s public API on the db you pass in; driver packages remain in the package that created the instance.

Package entrypoints

  • @healthzkit/drizzle — drizzleAdapter, extractClient, detectDriver, and option types.
  • @healthzkit/drizzle/drizzle — drizzleAdapter only.
  • @healthzkit/drizzle/extract — extractClient, detectDriver, and types.

Options

Basic usage

Pass the same db your service uses for application queries:

Driver override

The adapter can infer the dialect from Drizzle’s session (query for Postgres, execute for MySQL, run / syncRun for SQLite). Set driver when you want an explicit probe path:

Typed metadata

The adapter does not import driver types. If you want a typed metadata callback, supply the client type from your application (where pg, mysql2, and so on are already installed):

Helpers

  • detectDriver(db) — "pg" | "mysql" | "sqlite" | "unknown".
  • extractClient(db) — underlying session.client as unknown.
Import from @healthzkit/drizzle or @healthzkit/drizzle/extract.

When to use this vs driver adapters

Scheduling

For busy databases, pair this adapter with a schedule on the check so readiness reads cached results (see Scheduling).