What's new
Bun native SQL for Postgres — no pg needed
The @joint-ops/hitlimit-bun postgres store now runs on Bun's built-in SQL client. No extra driver, no N-API, no bindings. Just pass a connection string and go.
import { postgresStore } from '@joint-ops/hitlimit-bun/stores/postgres'
// connection string — store manages the client
hitlimit({ store: postgresStore({ url: process.env.DATABASE_URL }) }, handler)
// or bring your own Bun.SQL instance
import { SQL } from 'bun'
const sql = new SQL(process.env.DATABASE_URL)
hitlimit({ store: postgresStore({ client: sql }) }, handler)The old pg.Pool path still works but is now deprecated — url or client are preferred. pg is no longer a required peer dependency.
Install
# Node.js
npm install @joint-ops/hitlimit@1.5.0
# Bun
bun add @joint-ops/hitlimit-bun@1.5.0What changed
@joint-ops/hitlimit-bun
- New
urloption — pass a Postgres connection string, store owns the client - New
clientoption — pass a caller-ownedBun.SQLinstance pool(pg.Pool) deprecated — still works, pg is now an optional peer dep only- Removed
--external=pgfrom build — pg no longer required at runtime - Full driver-matrix test suite: all three connection modes covered
Docs
- Full audit of all 51 pages — verified against source, fixed wrong types, broken links, and fabricated APIs throughout
- npm READMEs for
hitlimit,hitlimit-bun, andhitlimit-typesfully rewritten — accurate, no comparisons, all 8 stores visible - Postgres store page updated with runtime-gated examples (Node / Bun)
Shoutout
Big thanks to @bobbymannino for raising #23 and clearly laying out the problem. This one's for you.
Full changelog: v1.4.0...v1.5.0