Anatomic-postgres is a lifecycle component for integrating the Postgres.js SQL client into the Anatomic dependency injection system for Node.js. At version 0.4.0, it wraps the 'postgres' module (commonly known as 'postgres.js') to provide managed connection lifecycle (start/stop) and configuration injection. Unlike direct use of postgres.js, this package enables declarative setup, automatic connection pooling, and graceful shutdown within an Anatomic system. It is designed for projects already using Anatomic and seeking to attach a PostgreSQL client as a managed dependency. The package is actively maintained.
npm install anatomic-postgresNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to set up an Anatomic system with a PostgreSQL client, configure connection string, start/stop, and run a query.
Ensure that 'config' is added to the Anatomic system before 'postgres' (e.g., .add('config', {postgres: {...}}).dependsOn('config') is already done but the config object must be provided.)Use CommonJS require() or set up a bundler with appropriate transformation.
Pin exact version and review release notes.
const pg = require('anatomic-postgres'); // call the factory pg()Add a 'config' component to the system, e.g., .add('config', {})