Persistence
Postgres
Alpha
DSAR is currently in alpha. APIs, package surfaces, configuration, and documentation may change as the project evolves.
@dsar/persistence-pg provides a Postgres driver for DSAR persistence with advisory-lock migration protection, connection pooling, and full domain record support.
Installation
| Package manager | Command |
|---|---|
| npm | npm install @dsar/persistence-pg |
| pnpm | pnpm add @dsar/persistence-pg |
| yarn | yarn add @dsar/persistence-pg |
| bun | bun 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.