{"id":43604,"library":"pgeon","title":"pgeon","description":"A zero-dependency, type-safe Postgres client for Node.js (v0.0.6). It includes a from-scratch implementation of the Postgres protocol with connection pooling, query cancellation, and SQL injection prevention via prepared statements. Its standout feature is a webpack loader that type-checks static SQL queries at compile time using TypeScript template literal types, catching errors before runtime. Designed for strict one-to-one mapping between Postgres and JavaScript types. Released as an experimental alpha with monthly updates.","status":"active","version":"0.0.6","language":"javascript","source_language":"en","source_url":"https://github.com/inad9300/pgeon","tags":["javascript","Postgres","PostgreSQL","SQL","Postgres client","Postgres driver","type safety","static analysis","TypeScript"],"install":[{"cmd":"npm install pgeon","lang":"bash","label":"npm"},{"cmd":"yarn add pgeon","lang":"bash","label":"yarn"},{"cmd":"pnpm add pgeon","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required for the compile-time SQL type-checking loader.","package":"webpack","optional":true},{"reason":"Needed to write webpack config in TypeScript and reference TypeScript loaders.","package":"ts-node","optional":true}],"imports":[{"note":"ESM only; CommonJS require may not work because the package is ESM-first.","wrong":"const { newPool } = require('pgeon')","symbol":"newPool","correct":"import { newPool } from 'pgeon'"},{"note":"sql is a named export, not default. It is a template literal tag used for static query type-checking.","wrong":"import sql from 'pgeon'","symbol":"sql","correct":"import { sql } from 'pgeon'"},{"note":"Used for TypeScript types only; should be imported with 'import type' in type-strict projects.","wrong":"import { PoolOptions } from 'pgeon'","symbol":"PoolOptions","correct":"import type { PoolOptions } from 'pgeon'"}],"quickstart":{"code":"import { newPool, sql } from 'pgeon'\n\nconst db = newPool({ host: process.env.PGHOST ?? 'localhost', port: Number(process.env.PGPORT) || 5432, username: process.env.PGUSER ?? 'postgres', password: process.env.PGPASSWORD ?? '', minConnections: 1, maxConnections: 10 })\n\nasync function main() {\n  const result = await db.run(sql`SELECT 1 AS num`)\n  console.log(result.rows) // [{ num: 1 }]\n  await db.close()\n}\n\nmain().catch(console.error)","lang":"typescript","description":"Shows connecting to a Postgres database using a connection pool and executing a static query with type safety via the sql template literal tag."},"warnings":[{"fix":"Always import sql from pgeon and use it directly without renaming.","message":"The sql tag must not be aliased or renamed, and no other template literal tag named sql should exist in the codebase.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Order loaders as: ['ts-loader', 'pgeon/webpack-loader.ts'] in the use array.","message":"The webpack loader must be placed after the TypeScript loader in the rules array.","severity":"breaking","affected_versions":">=0.0.1"},{"fix":"Pin to exact version and expect API changes.","message":"The package is in early alpha (0.0.x). Breaking changes may occur without major version bumps.","severity":"deprecated","affected_versions":"<1.0.0"},{"fix":"Use sql tag for all queries that have static structure, and manually type dynamic queries.","message":"Dynamic queries do not get compile-time type checking; only static sql tagged queries are checked.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Use ESM imports (import) and set type: 'module' in package.json.","message":"The library requires Node >=14.0.0 and is ESM-only. CommonJS require may fail.","severity":"gotcha","affected_versions":">=0.0.1"}],"env_vars":null,"search_vec":"'alpha':80 'analysi':95 'cancel':29 'catch':59 'check':47 'client':10,89 'compil':52 'connect':26 'depend':5 'design':63 'driver':91 'error':60 'experiment':79 'featur':39 'from-scratch':17 'implement':20 'includ':15 'inject':32 'javascript':74,84 'liter':57 'loader':43 'map':70 'month':82 'node.js':12 'one':67,69 'one-to-on':66 'pgeon':1 'pool':27 'postgr':9,23,72,85,88,90 'postgresql':86 'prepar':35 'prevent':33 'protocol':24 'queri':28,50 'releas':76 'runtim':62 'safe':8 'safeti':93 'scratch':19 'sql':31,49,87 'standout':38 'statement':36 'static':48,94 'strict':65 'templat':56 'time':53 'type':7,46,58,75,92 'type-check':45 'type-saf':6 'typescript':55,96 'updat':83 'use':54 'v0.0.6':13 'via':34 'webpack':42 'zero':4 'zero-depend':3","created_at":"2026-06-05T17:00:36.067924+00:00","updated_at":"2026-06-05T17:00:36.067924+00:00","problems":[{"fix":"Run npm install pgeon","cause":"Package not installed or missing from node_modules.","error":"Error: Cannot find module 'pgeon'"},{"fix":"Ensure db = newPool() and that newPool is imported correctly.","cause":"The pool was not properly created or db is not a Pool object.","error":"TypeError: db.run is not a function"},{"fix":"Add ts-loader and ensure rules array includes ts-loader before pgeon's webpack-loader.","cause":"The webpack loader for .ts files is not set up correctly; ts-loader may be missing or misconfigured.","error":"Webpack: ModuleParseError: Unexpected token (1:8)"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/inad9300/pgeon","github":"https://github.com/inad9300/pgeon","docs":null,"changelog":null,"pypi":null,"npm":"pgeon","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-05","next_check":"2026-09-03","install_tag":null}}