Solo Project
2026
8 technologies
About This Project
Modern ORMs make schema modeling effortless but frequently introduce catastrophic performance bugs - N+1 query cascades, unindexed sequential table scans, and duplicate query bursts. QueryGuard solves this by intercepting queries directly at the PostgreSQL 3.0 TCP wire-protocol layer during local tests and CI/CD runs with zero application code changes.
Running queryguard exec -- <test_command> spawns a transparent proxy on port 5433, injects a rewritten DATABASE_URL, and parses both simple ('Q') and extended ('P', 'B', 'D', 'E') wire protocol frames. The diagnostic engine normalizes SQL into parameterized templates, produces deterministic SHA-256 fingerprints, and detects cascades in real time. For unindexed table scans, it triggers active EXPLAIN (FORMAT JSON) inspection and generates copy-pasteable CREATE INDEX CONCURRENTLY DDL recommendations. Reports in ANSI terminal tables, GitHub Actions PR comments, JSON, and a zero-dependency HTML waterfall dashboard.
Tech Stack
Key Features
- Zero-code-change PostgreSQL 3.0 TCP wire-protocol proxy with automatic DATABASE_URL injection
- N+1 query cascade and duplicate query detection via deterministic SHA-256 parameterized fingerprinting
- Active EXPLAIN query analysis with automated CREATE INDEX CONCURRENTLY DDL recommendations
- Multi-format reporting: ANSI terminal summary, GitHub Actions PR markdown comments, JSON, and standalone HTML waterfall
- CI/CD performance gating with configurable failure thresholds for N+1 cascades and sequential scans
The Outcome
Published on npm as @adib23704/queryguard and GitHub, with a reusable GitHub Action (Adib23704/QueryGuard@v1) for automated CI/CD performance gating. Compatible with Prisma, Drizzle, TypeORM, Kysely, and node-pg.