Spin up a real, disposable PostgreSQL or ParadeDB instance programmatically from Node.js (v20+) for testing — no Docker required. Version 0.2.2 uses embedded-postgres to bundle PostgreSQL binaries (~10MB) and auto-downloads pg_search and pgvector extensions from official releases. Unlike ephemeral Docker containers, this library avoids daemon dependency, supports snapshot/restore via template databases, and caches extension binaries in ~/.cache. It is inspired by mongodb-memory-server / redisjson-memory-server but tailored for Postgres extension-heavy workloads. Release cadence is active and frequent as of early 2025. Key differentiators: no system Postgres, no Docker, ParadeDB + pgvector support, zero-copy test isolation, cross-platform binaries (macOS arm64/x64, Linux arm64/x64, Windows x64 with limitations).
npm install postgres-memory-serverNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a disposable PostgreSQL instance, connects with pg client, runs a query, and stops the server.
Upgrade Node.js to v20 or later.
Use getPort() or pass a unique port in options: PostgresMemoryServer.create({ port: 0 }) to auto-assign.Check network connectivity. Use a caching proxy or pre-download extensions manually to ~/.cache/postgres-memory-server/.
N/A
Run 'npm install -D postgres-memory-server' and ensure you use 'import { PostgresMemoryServer } from 'postgres-memory-server''.Use 'PostgresMemoryServer.create()' (async) instead.
Use 'getPort()' to find a free port or pass 'port: 0' to auto-assign.
Ensure 'await client.connect()' before querying; check for connection errors.