Persistence

Postgres

@dsar/persistence-pg provides a Postgres driver for DSAR persistence with advisory-lock migration protection, connection pooling, and full domain record support.

Installation

Package managerCommand
npmnpm install @dsar/persistence-pg
pnpmpnpm add @dsar/persistence-pg
yarnyarn add @dsar/persistence-pg
bunbun add @dsar/persistence-pg

Quickstart

Standalone Service

The simplest way to get started — creates a persistence service you can pass directly to the backend:

Effect Layer Composition

For Effect-based applications, use the layer API for dependency injection:

Migrations

Migrations run automatically on startup with advisory-lock protection to prevent concurrent migration conflicts in multi-instance deployments.

Related