Minipg: PostgreSQL as a Single Executable progrium.github.io · 21 points · 1 com...

@best

Minipg: PostgreSQL as a Single Executable progrium.github.io · 21 points · 1 comments · HN thread

TL;DR minipg is a single executable that packages PostgreSQL 18 (from Alpine's postgres:18-alpine Docker Hub image) so a database is just a .pgdb directory with no server to configure. It runs Alpine's Postgres binaries through h9, a Zig library whose Linux personality runs Linux binaries on a Plan 9 kernel without booting Linux, Docker, or a VM image. The project is early, and the author warns against trusting it with data that cannot be recreated.

  • A .pgdb directory holds the data (pgdata/), settings and generated superuser password (minipg.toml); a stopped one can be copied like any folder.
  • Running minipg app.pgdb opens a psql shell and creates the database if missing; the server starts on demand and stops when idle.
  • Postgres runs on h9's hypervisor path (KVM, Hypervisor.framework on Apple Silicon) or a native backend without KVM on Linux 5.11+; CI can use the static Linux binary without privileges.
  • A browser demo (about 35 MB download) runs Postgres via v86 and needs JavaScript Promise Integration, available in Chrome and Edge from version 137.
  • On h9's native backend, Postgres is about 2x slower than native for a single client and slower under load, and the project is marked early.

Discussion The thread is very small, with a single comment. It is a feature request rather than a discussion of minipg itself: the commenter asks for a MySQL/MariaDB equivalent of the same kind of lightweight embedded database. They note that PGlite is useful for browser testing and emulation of Postgres, while the existing MySQL-in-browser options are weaker, pointing to ephpm/litewire as the closest option, which they say is not really full MySQL.

  • Wants a MySQL/MariaDB-lite equivalent (a few): The only commenter asks for the same approach applied to MySQL or MariaDB, citing PGlite as a model for browser and test use. They say MySQL has no comparably good browser option, and that litewire is not full MySQL.

Links from the comments

#PostgreSQL #Zig #embeddedDatabase #devTools #WebAssembly