
Product
Socket MCP Adds Org Alerts, Threat Feed Review, and Package Inspection
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.
@pglite/core
Advanced tools
High-performance, in-process, zero-dependency embedded PostgreSQL database engine for Bun & Node.js. A lightweight, serverless SQLite alternative with full Postgres syntax support.
An Ultra-Lightweight Embedded PostgreSQL Engine that Runs Natively in Node.js and the Browser — No WASM, No Emulation, Just Pure Performance.
PostgresLite is a high-performance, in-process, zero-dependency embedded PostgreSQL database engine for Bun, Node.js, and the Browser. It provides a PostgreSQL-compatible SQL interface with the simplicity of a local storage engine—effectively bringing the power of Postgres to the developer experience, serving as a robust SQLite alternative.
Unlike traditional PostgreSQL, PostgresLite requires no server, no network overhead, and zero configuration. It utilizes a custom-built storage engine designed for low-latency I/O, high concurrency, and full ACID compliance.
BEGIN, COMMIT, and ROLLBACK via Write-Ahead Logging (WAL).public, pg_catalog, information_schema).| Category | Supported Keywords / Features |
|---|---|
| DDL | CREATE/DROP TABLE, CREATE/DROP SCHEMA, ALTER TABLE (ADD, DROP, RENAME, TYPE, DEFAULT, NOT NULL) |
| DML | SELECT, INSERT, UPDATE, DELETE, ON CONFLICT (DO NOTHING / DO UPDATE) |
| Query Clauses | WHERE, GROUP BY, HAVING, ORDER BY (ASC/DESC), LIMIT, OFFSET, RETURNING |
| Joins | INNER JOIN, LEFT JOIN, LATERAL JOIN, CROSS JOIN |
| Advanced | WITH (CTE), UNION, INTERSECT, SUBQUERY (In WHERE/FROM) |
| Functions | COUNT, SUM, AVG, MIN, MAX, ARRAY_AGG, COALESCE, NOW, DATE_TRUNC, UPPER, JSON_EXTRACT |
| Operators | LIKE, IN, IS NULL, Regex (~, ~*, !~), JSON (->, ->>, #>, @>, ?), Array (&&, @>) |
| Window | ROW_NUMBER(), RANK() via OVER (PARTITION BY ... ORDER BY ...) |
PostgresLite is built with several advanced database engineering techniques to ensure high performance:
JSONB or TEXT) and prevents page fragmentation.SELECT *) use a constant and minimal memory footprint.ORDER BY operations that exceed available RAM, the engine automatically spills to disk and performs a multi-way merge sort to maintain memory safety.npm install @pglite/core
bun add @pglite/core
import { PGLite } from "@pglite/core";
// For Node.js/Bun:
import { NodeFSAdapter } from "@pglite/core/node-fs";
const db = new PGLite("app.db", { adapter: new NodeFSAdapter() });
// For Browser:
import { BrowserFSAdapter } from "@pglite/core/browser";
const db = new PGLite("app.db", { adapter: new BrowserFSAdapter() });
// 1. DDL & Data Mutation
await db.exec(`
CREATE TABLE users (
id SERIAL PRIMARY KEY,
name TEXT NOT NULL,
metadata JSONB
)
`);
await db.exec(`
CREATE TABLE posts (
id SERIAL PRIMARY KEY,
user_id INTEGER REFERENCES users(id),
title TEXT NOT NULL,
content TEXT
)
`);
// 2. Parameterized Queries (SQL Injection Protected)
await db.exec(
"INSERT INTO users (name, metadata) VALUES ($1, $2)",
["Alice", { role: "admin", active: true }]
);
// 3. Complex Querying (Joins, Aggregates, Grouping)
const results = await db.query(`
SELECT u.name, COUNT(p.id) as post_count
FROM users u
LEFT JOIN posts p ON u.id = p.user_id
WHERE u.name LIKE $1
GROUP BY u.name
ORDER BY post_count DESC
`, ["Al%"]);
console.table(results);
PostgresLite is designed for heavy lifting in local environments:
SELECT * on a 1,000,000 row table does not result in an OutOfMemory error.PostgresLite does not store rows as raw strings. Each 4KB page contains a header, a slot array pointing to record offsets, and the data area. This prevents fragmentation and allows for variable-length records (like JSONB or TEXT) to be updated in place efficiently.
Every mutation is first appended to a .wal file. In the event of a process crash, the engine automatically replays the WAL on the next initialization, ensuring your database state remains consistent and corruption-free.
We welcome contributions to the core engine, specifically in the following areas:
MIT © Senior Systems Programming Team.
FAQs
High-performance, in-process, zero-dependency embedded PostgreSQL database engine for Bun & Node.js. A lightweight, serverless SQLite alternative with full Postgres syntax support.
The npm package @pglite/core receives a total of 21 weekly downloads. As such, @pglite/core popularity was classified as not popular.
We found that @pglite/core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.

Research
More than 140 Mastra npm packages were compromised in a supply chain attack that used a typosquatted dependency to deliver a cross-platform infostealer during installation.