pg-mem

JSON →
library 3.0.14 ·javascript
verified Jun 5, 2026

pg-mem v3.0.14 is an experimental in-memory emulation of a PostgreSQL database for Node.js and browser environments, released under active development with weekly commits. It supports SQL syntax parsing via a custom parser (pgsql-ast-parser), provides adapters for popular ORMs/query builders such as TypeORM, MikroORM, Knex, Kysely, pg-promise, Slonik, and postgres.js, and offers unique features like immutable restore points for zero-cost rollback in unit tests. Key differentiators include browser compatibility, custom function registration, and no native dependencies. However, it is not a full PostgreSQL replacement; many advanced features are missing (e.g., some data types, triggers, window functions) and the SQL parser may reject valid PostgreSQL syntax. It ships TypeScript types and is primarily used for testing and development.