# oguimbal/pg-mem

An in memory postgres DB instance for your unit tests

Repository: https://github.com/oguimbal/pg-mem
Canonical: https://ross.abutalabs.com/products/pg-mem
Language: TypeScript
License: MIT
License Family: permissive
Topics: hacktoberfest, pg-promise, typeorm, node-postgres, pg-mem, postgresql, typescript, unit-testing, unit-tests, nodejs, mocha, deno, node, slonik, sql-syntax-parser
Last push: 2026-02-26T11:33:42+00:00

## Health v2 (maintenance only)
Score: 54/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 69, release rhythm 8, longevity 100
- inputs: {"age_days": 2239, "days_push": 188, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2360, forks 116 (observed 2026-08-28T04:06:40.823388+00:00)

## What it is
pg-mem is an in-memory emulation of a PostgreSQL database written in TypeScript, usable in Node.js or the browser. It lets you run SQL queries against a fake Postgres instance, making it ideal for mocking the database layer in unit tests.

## Use cases
- mock a postgres database in unit tests
- run sql queries in memory without a real postgres server
- test typeorm or pg-promise code without a database
- create restore points and roll back database state between tests
- parse and validate postgres sql syntax in javascript

## When to choose
- you want fast, dependency-free database mocks for unit tests
- your tests use pg-promise, typeorm, node-postgres, or slonik
- you need to run simple postgres queries in a browser or deno

## When to avoid
- you need full postgres feature coverage or complex query fidelity
- you are running integration tests against a real database
- your sql uses advanced postgres syntax that may not be supported

## Facets
- artifact type: library
- maturity: active
- function: database, testing, mocking, parser
- domain: databases, testing, developer-tools
- platform: browser
- tags: in-memory-database, postgresql-emulation, sql-parser, unit-testing, test-doubles, nodejs, deno, typescript

## Member repositories
- oguimbal/pg-mem (main) score 54

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:06:40.823388+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T02:36:12.709950+00:00, confidence not recorded.
  - readme: https://github.com/oguimbal/pg-mem (fetched 2026-08-28T04:06:40.823388+00:00, sha 4cc36a19f23e)
- Data as of 2026-08-30T08:39:29.467469+00:00.
