A lightweight PostgreSQL query builder for Node.js, optimized for edge environments like Cloudflare Workers. Version 1.8.0 (stable, actively maintained). Builds SQL queries using plain JavaScript objects with full TypeScript type safety. Supports relation expansion, nested JSON field queries, cursor-based pagination, and relation filtering. Minimal dependencies (only pg), making it ideal for size-constrained deployments. Differentiates from heavier ORMs by its small bundle size and simplicity.
npm install unconventional-pg-queriesNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a client from a connection string, then queries the 'users' table with a WHERE LIKE filter, selecting specific columns and limiting to 10 rows.
Use the 'expand' property in the query object to include related data, e.g., query('posts').expand({ author: true }).Use the pool option: createClient({ pool: new pg.Pool({ connectionString }) }).Replace sort: { field: 'asc' } with orderBy: { field: 'asc' }.Use dynamic import: const { createClient } = await import('unconventional-pg-queries');Ensure you import { createClient } and call it to get the client instance, then use client.query('table').Use import type { UnconventionalClient } from 'unconventional-pg-queries';