Skip to main content
Hookfish accepts a ready database, a promise, or a request-aware database binding. The published database package includes PGlite, PostgreSQL, and an experimental SQLite Durable Objects adapter.

PGlite

Use PGlite for local development or one process with persistent disk:
The adapter opens the database lazily and applies bundled migrations once on first use. Set migrationsFolder: false only when another system owns schema application.

PostgreSQL

Use PostgreSQL for multiple instances, ephemeral runtimes, managed backups, or established operational tooling:
The first argument can also be a resolver called with runtime bindings. On Cloudflare Workers, resolve env.HYPERDRIVE.connectionString and set cache: false; see Cloudflare Workers.

Run PostgreSQL migrations

Run migrations before the new application version accepts traffic:
Execute this script from CI or another trusted environment with direct database access. Do not put the database URL in source control.

Durable Objects

The SQLite Durable Objects adapter partitions storage by a selected object and applies its schema lazily when the object starts. This adapter is experimental. For production Workers deployments, use PostgreSQL through Hyperdrive.

Implement a custom adapter

Use defineDatabase when your host owns the storage implementation or needs to resolve a partition at request time:
The returned database must implement Hookfish’s exported Database persistence contract.