pgpm

A Postgres Package Manager

Modular Postgres development with reusable packages, deterministic migrations, recursive dependency resolution, tag-aware versioning, and turnkey module-first workspaces.

terminal

Bring the Modularity of npm to Postgres

pgpm enables modular Postgres by converting your SQL migrations into versioned packages with dependency graphs, deterministic installs, and reproducible deployments across every environment.

Install packages like npm, write migrations in pure SQL, test end-to-end with TypeScript, and organize everything in intuitive Node-style workspaces for clean, maintainable development.

1

Get Started

Install the pgpm CLI to start managing your PostgreSQL packages.

npm install -g pgpm
Browse all packages
2

Environment Setup

Get up and running in seconds with simple commands.

pgpm docker start
eval "$(pgpm env)"

Tip: Already running Postgres? Skip the Docker step and just export your PG* environment variables.

3

Complete Workflow Example

See the full workflow from workspace creation to package installation and deployment.

# 1. Create a workspace
pgpm init workspace

# 2. Create your first module
cd my-workspace
pgpm init

# 3. Install a package
cd packages/my-module
pgpm install @pgpm/faker

# 4. Deploy everything
pgpm deploy --createdb --database mydb1
psql -d mydb1 -c "SELECT faker.city('MI');"
>  Ann Arbor

Modular PostgreSQL Development

pgpm brings the power of package management to PostgreSQL, making it easy to share and reuse database modules across projects and teams.

With deterministic migrations and recursive dependency resolution, you can build complex database applications with confidence, knowing that your schema changes are reproducible and your dependencies are correctly resolved.

Built for Modularity

pgpm turns PostgreSQL migrations into a modular package system, giving you clean versioning, dependency graphs, and reproducible deployments.

Postgres Module System
Reusable, composable database packages with dependency management, per-module plans, and versioned releases
Deterministic Migration Engine
Version-controlled, plan-driven deployments with rollback support and idempotent execution enforced by dependency and validation safeguards
Recursive Module Resolution
Recursively resolves database package dependencies (just like npm) from plan files or SQL headers, producing a reproducible cross-module migration graph
Tag-Aware Versioning
Deploy to @tags, resolve tags to changes, and reference tags across modules for coordinated releases
Portable Postgres Development
Rely on standard SQL migrations for a workflow that runs anywhere Postgres does
Turnkey Module-First Workspaces
pgpm init delivers a ready-to-code Postgres workspace with CI/CD, Docker, end-to-end testing, and modern TS tooling