A driver for using PGlite (an in-process PostgreSQL implementation) with MikroORM v6. Current stable version is 0.5.1, released with active maintenance. Peer dependencies require @electric-sql/pglite ^0.3.10 and @mikro-orm/postgresql ^6.5.6. It supports easy initialization with automatic lifecycle management and optional injection of an existing PGlite instance for advanced use cases like file system storage or custom configurations. Particularly useful for testing, prototyping, and development environments where a full PostgreSQL server is not desired.
npm install mikro-orm-pgliteNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Sets up a MikroORM instance using PGlite with in-memory ephemeral storage, then verifies connection and disconnects.
Set dbName: 'postgres' (or any valid database name) in the MikroORM.init options.
To persist data, inject a PGlite instance with file system storage using driverOptions.connection.pglite.
Upgrade Node.js to v20.19.5 or higher.
Use npm or pnpm for installation and running.
Install both: npm install @electric-sql/pglite @mikro-orm/postgresql mikro-orm-pglite
Add dbName: 'postgres' to the init options.
Ensure @mikro-orm/postgresql v6.5.6 is installed and import PGliteDriver from 'mikro-orm-pglite'.