NewsCrawler.org

minipg: PostgreSQL as a single executable

What happened next

  1. How I Got Postgres into a Single Binary

The whole story · 2 →

minipg packages PostgreSQL as one ready-to-use executable that needs no server configuration. Its database is a .pgdb directory that holds the data, config, credentials and Postgres version, and running minipg app.pgdb opens a psql shell on it. The server starts when a command needs it and stops on its own when idle.

minipg embeds the postgres:18-alpine image from Docker Hub and runs it with h9[1], a Zig library. h9's Linux personality runs Alpine's own Postgres binaries directly on the host's hypervisor[2], so no Linux kernel, VM image or Docker is needed. The browser demo downloads about 35 MB and needs JavaScript Promise Integration, which Chrome and Edge support from version 137. Because a page has no TCP, the demo serves Postgres over a unix socket[3].

In CI, the Linux binary is static and needs no privileges, and without /dev/kvm h9 runs Postgres on its native backend. The source is on GitHub under the MIT license. The author warns that minipg is early and that on h9's native backend Postgres is about 2x slower than native for one client, so it should not hold data that cannot be recreated yet.

Repository minipg github.com

Open source project that packages PostgreSQL as a single executable, with no server setup, starting Postgres only when a command needs it.

Stars: 101Forks: 4License: MITUpdated:

Read the original progrium.github.ioDiscussion

Discussion

Commenters ask for a MySQL/MariaDB equivalent and compare minipg with PGlite, a Postgres for the browser. One user likes it for testing on a Mac without Docker, and another asks whether it works with Node.js as a replacement for SQLite. One commenter complains that the 35 MB download starts as soon as the page opens.

Sources

Published: First seen: Читать по-русски

Open as a page