Can you run real PostgreSQL 18 as effortlessly as SQLite—from a single executable over a plain directory, with no Docker or background daemons?
Developers love SQLite for its simplicity: it's an embedded database inside one file. PostgreSQL packs far more power (JSONB, full-text search, window functions, extensions), yet even local tests usually force you to install Docker and manage volumes.
Jeff Lindsay, creator of Dokku, built minipg (v0.4, MIT, written in Zig)—a single executable that launches real PostgreSQL 18 on top of a local folder. It's experimental, so don't trust it with critical data yet, but it's already handy for dev and testing.
How PostgreSQL 18 fit into a single file
Before landing on this architecture, Lindsay tried two other approaches. First was PGlite, Postgres compiled to WebAssembly. Because WASM has no fork(), PGlite runs in single-user mode with one connection: open a transaction and send a second query before committing, and everything deadlocks.
Next he ran full Postgres inside the v86 x86 emulator in a hidden browser window. Connections worked, yet startup on an M3 MacBook took 7 seconds—way too slow for quick scripts.
The third attempt clicked using hyper9 (h9). It runs native Linux binaries directly on the host's built-in hypervisor (KVM, Hypervisor.framework, or WHP), while a Plan 9 microkernel inside h9 handles syscalls. Skipping a Linux kernel boot and Docker daemon cut startup from 7 seconds down to ~800 ms.
Inside the binary sits a trimmed postgres:18-alpine image without docs or LLVM (jit=off). The v0.4 zip archives weigh 24.9–33.7 MB, and first run unpacks the ~90 MB image once into a local cache.
Running over a folder and the in-browser playground
Your database lives in a plain folder like app.pgdb/, holding minipg.toml (version, port, and generated password with 0600 permissions), a pgdata/ directory with C.UTF-8 locale, and a .lock file. When stopped, you can copy or delete the folder like any directory.
# Create app.pgdb, boot Postgres 18, and open psql
minipg app.pgdb
# Run SQL without manually starting a server
minipg app.pgdb "create table notes (id serial, body text)"
minipg app.pgdb "select * from notes"
# Launch your app with DATABASE_URL pre-populated
minipg run app.pgdb -- npm start
# Explicit server port and SQL dump
minipg serve app.pgdb -p 5432
minipg dump app.pgdb > dump.sql
The server boots on demand: initial initdb takes ~4s, warm starts take ~800 ms, and tools like psql connect to 127.0.0.1 over SCRAM-SHA-256 in ~90 ms. After 60 seconds of idle time (MINIPG_IDLE), the server shuts down on its own. Compare that to Docker:
# For comparison: the same image in Docker
docker run --name mypg -e POSTGRES_PASSWORD=secret \
-p 5432:5432 -v ./pgdata:/var/lib/postgresql/data \
-d postgres:18-alpine
With minipg, there's no Docker Desktop or volume juggling, and in CI the static musl binary runs without --privileged (minipg run test.pgdb -- go test ./...). You can even try it without installing anything in the browser playground—an in-browser VM (~35 MB, requires Chrome/Edge 137+ with JSPI) running Linux minipg inside a 386 emulator over Unix sockets.
Experimental limits: minipg vs PGlite and Docker
| Criterion | minipg (v0.4) | PGlite | Docker (postgres:18-alpine) |
|---|---|---|---|
| Format | CLI binary + .pgdb folder | WASM library in JS/TS | Container and daemon |
| Connections | Multi-process TCP server | Single (single-user mode) | Multi-process TCP server |
| Best for | Local tests, CI, agents | Browser, embedded unit tests | Production, load, teams |
PGlite shines in-process inside JS/TS, though it chokes on concurrent connections. minipg gives you a real pooled server, yet v0.4 has sharp edges. On Linux without KVM (MINIPG_ENGINE=sud, needs Linux 5.11+), single-client throughput is 2× slower than native and 6–12× slower under load; connecting takes ~27 ms, and each client eats ~33 MB on fork() (capping around ~790 connections). Note that sud mode is not a sandbox: a superuser running COPY ... TO PROGRAM executes commands directly on your host.
So far, Linux x86_64 and Windows x86_64 are tested (Windows needs WHP enabled and reserves 5 GB of RAM upfront). macOS Apple Silicon (remember xattr -d com.apple.quarantine ./minipg after browser download) and Linux arm64 builds are untested, while Intel Macs and Windows ARM aren't supported. For local prototypes, Dockerless CI, and AI agents, minipg already saves a lot of time—just keep Docker or native Postgres for production, heavy load, and critical data.


