minipg packs PostgreSQL into one executable with no server setup
The minipg project page presents PostgreSQL as one executable, ready to use, with no server to configure. A .pgdb directory is the database: its data, config, credentials and Postgres version all live inside it. Running minipg app.pgdb opens a psql shell and creates the database if it is missing. A server starts when a command needs one and stops on its own when idle.
Under the hood, minipg embeds Docker Hub's postgres:18-alpine image and runs it with h9, used as a Zig library. h9's Linux personality runs Alpine's own Postgres binaries directly on the host's hypervisor, while h9's Plan 9 kernel answers their system calls. The page says there is no Linux kernel to boot, no VM image and no Docker.
The command set covers a single statement (minipg app.pgdb "select 1"), printing a connection URL (minipg url), an explicit foreground server (minipg serve), launching your own app with DATABASE_URL set (minipg run app.pgdb -- npm start), and dump and restore. Each .pgdb holds minipg.toml, with settings and the generated superuser password, and pgdata/, the Postgres data directory as plain files. A stopped database can be copied like any directory. New clusters use Postgres's builtin C.UTF-8 locale, which sorts the same on every platform.
Exactly one process runs Postgres for a given .pgdb, enforced by a lock. That process holds the server's h9 machine, whose Linux root is the unpacked image and whose writable working directory is the .pgdb. The image's docker-entrypoint.sh initializes the cluster on first start. Commands never host Postgres themselves: if no server is running, they start one in the background and use it. psql, pg_dump and the other tools each run in their own short-lived h9 machine over the same root, which takes about 90 ms to start.
For CI, the Linux binary is static and needs no privileges or devices. Without /dev/kvm, h9 runs Postgres on its native backend, where it is about 2x slower than native Postgres for one client, and slower under load.
The page also has a browser demo that downloads about 35 MB. It needs JavaScript Promise Integration, available in Chrome and Edge from version 137, with other browsers getting it. The demo runs minipg's Linux build inside the Postgres image itself, starts Postgres as ordinary processes and serves on a unix socket, since a web page has no TCP. New demo databases come from a template cluster made at build time, because initdb takes half a minute on v86.
The source is on GitHub under the MIT license. The project describes minipg as early and h9's Linux personality as young, and says not to trust it yet with data you can't recreate.
Key facts
- minipg is PostgreSQL as a single executable: a .pgdb directory holds the data, config, credentials and Postgres version, and the server starts on demand and stops when idle.
- It embeds the postgres:18-alpine image and runs it with h9, with no Linux kernel to boot, no VM image and no Docker.
- In CI the static Linux binary needs no privileges or devices; without /dev/kvm it uses h9's native backend, about 2x slower than native Postgres for one client.
- A browser demo of about 35 MB runs in Chrome and Edge from version 137.
- The code is MIT-licensed on GitHub, and the project warns that it is early and should not hold data you can't recreate.
Why it matters
minipg turns a database server into something you handle as a program plus a directory. There is no server to configure: a command starts Postgres when needed, and it shuts down when idle. The database, including its settings and credentials, sits in one .pgdb folder that can be copied once the server is stopped.
The route there is unusual. Alpine's own Postgres binaries from the Docker Hub image run through h9, whose Plan 9 kernel answers their system calls, so neither Docker nor a VM image is involved.
Who it affects
The most direct audience is developers who want Postgres for an app without setting up a server, since minipg run launches the app with DATABASE_URL already set. CI users are the other group named by the page: the static Linux binary needs no privileges or devices, and a test job can be as short as minipg init test.pgdb followed by minipg run test.pgdb -- go test ./....
The page does not give a list of supported operating systems and CPU architectures.
How to use it
Everyday commands:
minipg app.pgdb opens a psql shell and creates app.pgdb if it is missing.
minipg app.pgdb "select 1" runs one statement.
minipg url app.pgdb prints a connection URL.
minipg serve app.pgdb runs a foreground server.
minipg run app.pgdb -- npm start starts your app with DATABASE_URL set.
minipg dump app.pgdb > dump.sql and minipg restore app.pgdb dump.sql handle backups and restores.
Building from source requires Zig 0.16, plus curl, jq, tar and xz for the root filesystem. Clone github.com/progrium/minipg with --recursive and run make build, which pulls the root for the host's architecture. The license is MIT. The README lists every command, and the manual is the full guide.
How solid is it
This account rests on the project's own page, which is candid about maturity: minipg is early, and h9's Linux personality is young. The source code is public, and the page offers a live browser demo.
The one performance comparison, about 2x slower than native for a single client, applies to h9's native backend. No figure is given for running on the host's hypervisor, and no benchmark method or workload is described.
Risks and caveats
The project's own warning comes first: don't trust minipg yet with data you can't recreate. On h9's native backend, which is what runs when /dev/kvm is unavailable, Postgres is about 2x slower than native for one client and slower still under load.
The generated superuser password is stored in minipg.toml inside the .pgdb, so anyone copying or sharing that directory passes the password along with the data. The browser demo depends on JavaScript Promise Integration, which not every browser has yet. Bugs and questions go to GitHub issues.
“Don't trust it with data you can't recreate yet.”
— minipg project page