Minipg: Full PostgreSQL in One Executable

Original: Minipg: PostgreSQL as a Single Executable

Why This Matters

Zero-config, self-contained Postgres lowers the barrier for local dev and CI setups.

Developer Jeff Lindsay released minipg, a single-binary PostgreSQL tool that runs a full Postgres 18 instance with no server setup. A .pgdb directory holds all data, config, and credentials. About 35 MB download.

Minipg packages PostgreSQL as a single executable using an unconventional stack. It embeds Docker Hub's postgres:18-alpine image and runs it via h9, a Zig library that lets Alpine's native Postgres binaries run directly on the host hypervisor—no Linux kernel to boot, no VM image, and no Docker daemon needed.

A .pgdb directory is the entire database: data files, config, credentials, and Postgres version bundled together. A server starts on demand when a command needs it and shuts down when idle. Only one process manages a given .pgdb at a time, enforced with a lock.

The CLI covers basic workflows: open a psql shell, run a single statement, print a connection URL, start an explicit foreground server, launch an app with DATABASE_URL preset, and dump or restore data. In CI, the static Linux binary needs no special privileges—without /dev/kvm, h9 falls back to its native backend.

Supported platforms: Linux x86_64 (KVM or native fallback, kernel 5.11+), Linux arm64 (KVM), macOS Apple Silicon (Hypervisor.framework), and browsers via v86 emulation. The browser demo runs minipg's Linux build inside the Postgres image itself, using a unix socket since browser pages have no TCP.

The project is early-stage and carries a clear warning: on h9's native backend, Postgres runs roughly 2x slower than native for a single client and degrades further under load. Source is MIT-licensed on GitHub; building requires Zig 0.16.

Source

progrium.github.io — Read original →