npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@monlite/postgres

v0.2.0

Published

Postgres engine for @monlite/core — the same monlite API, on a networked Postgres (JSONB) instead of a local SQLite file. Swap the engine, not your code.

Readme

@monlite/postgres

The Postgres engine for monlite. The same @monlite/core API — documents, queries, the full CRUD surface — on a networked Postgres (documents stored as JSONB) instead of a local SQLite file. Swap the engine, not your code.

npm install @monlite/core @monlite/postgres pg
import { createDb } from "@monlite/postgres";

const db = createDb("postgres://user@host/db");

await db.collection("users").create({ data: { name: "Ada", age: 30, tags: ["admin"] } });
const adults = await db.collection("users").findMany({
  where: { age: { gte: 18 }, tags: { has: "admin" } },
  orderBy: { age: "desc" },
});

Or pass the engine to core's createDb:

import { createDb } from "@monlite/core";
import { postgres } from "@monlite/postgres";

const db = createDb("pg", { driver: postgres("postgres://…", { pool: { max: 10 } }) });

Same API, different engine

Documents become jsonb; the query builder emits the Postgres dialect (->/->>/@>/~, jsonb_array_elements, to_jsonb); transactions run on a pooled client with SAVEPOINTs. The db.collection(...) API is identical to SQLite-backed monlite — develop on a .db file, deploy to Postgres, don't rewrite a line.

The whole data surface works:

  • CRUDcreate, createMany, findMany, findFirst, findById, count, exists, update, updateMany, upsert, delete, deleteMany, findOneAndUpdate, bulkWrite, purgeExpired.

  • Aggregationaggregate, groupBy (with having + orderBy), distinct.

  • Realtimewatch() via Postgres LISTEN/NOTIFY (truly cross-process — a write from any connection reaches every watcher).

  • Full-text search@monlite/fts on a native generated tsvector column + GIN index.

  • Vector search@monlite/vector on a native generated vector column + HNSW index (pgvector).

  • Job queue@monlite/queue's createPgQueue(db), claiming with FOR UPDATE SKIP LOCKED.

Not yet: only explain() (Postgres' EXPLAIN output is engine-specific — throws a clear error).

Notes

  • Requires PostgreSQL 14+ (vector search needs pgvector; the monlite/postgres image bundles it). Placeholders ? are rewritten to $1,$2,….
  • Each transaction runs on its own pooled connection — concurrent transactions parallelize (nested ones become SAVEPOINTs) and retry automatically on serialization failure / deadlock.
  • @monlite/core stays the minimal, zero-dependency local engine — this package is purely additive, opt-in.

License

MIT