{"repo":"oniani1/queryguard","free":true,"listed":false,"github":"https://github.com/oniani1/queryguard","clone":"git clone https://github.com/oniani1/queryguard.git","description":"Detect N+1 queries at the driver level. Zero config. Works with any ORM.","language":"TypeScript","stars":10,"topics":["database","drizzle","n-plus-one","orm","performance","postgres","prisma","testing","typescript","vitest"],"license":"MIT","category":"databases-storage","readme_excerpt":"queryguard Catch N+1 queries in your tests before they hit production. Why Every ORM makes it easy to write a loop that fires one query per row. Load 100 users, each with a profile: that's 101 queries instead of 2. The database barely notices in development, then the page takes 4 seconds in production with real data. Ruby solved this years ago with Bullet. The Node.js ecosystem had nothing comparable. ORM-specific lint rules catch some patterns, but they miss raw queries, cross-ORM projects, and anything behind an abstraction layer. queryguard works at the database driver level. It patches pg and mysql2 directly. It does not care which ORM generated the SQL. If the query hits Postgres or MySQL, queryguard sees it. How it works queryguard monkey-patches pg.Client.prototype.query , pg.Pool.prototype.query , and the equivalent mysql2 methods at import time. Every query is recorded into an AsyncLocalStorage context scoped to your test or request. The SQL is normalized into a fingerprint (stripping literals, collapsing IN-lists), and when the same fingerprint appears more than threshold times outside a transaction, queryguard reports it as an N+1. No background threads, no network calls, no native modules. Hard numbers Metric Value -------- ------- Package size (tarball) Under 40 KB (CI-gated) Runtime dependencies 0 (CI-gated) Overhead on Payload CMS test suite (136 tests) Negligible, not measurable in local runs False positives on Payload CMS (verified once, not in CI) 0 (136 tes","default_branch":null,"files":null,"tree":[],"storefront":"/r/oniani1","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/oniani1/queryguard/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}