{"id":44175,"library":"zoo.pg","title":"Zoo Postgres Client","description":"A TypeScript-native Postgres client library (v1.5.x, monthly releases) with minimal dependencies and a focus on performance and type safety. Unlike pg or node-postgres, zoo.pg ships pre-built TypeScript types, requires no external drivers, and supports ESM-only imports. Designed for modern Node.js (14+) and Deno environments, it provides prepared statements, connection pooling, and transaction support out of the box.","status":"active","version":"1.5.9","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","typescript"],"install":[{"cmd":"npm install zoo.pg","lang":"bash","label":"npm"},{"cmd":"yarn add zoo.pg","lang":"bash","label":"yarn"},{"cmd":"pnpm add zoo.pg","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Runtime dependency for actual PostgreSQL wire protocol implementation","package":"postgres","optional":false}],"imports":[{"note":"ESM-only since v1.0; no CommonJS support.","wrong":"const postgres = require('zoo.pg')","symbol":"default","correct":"import postgres from 'zoo.pg'"},{"note":"Named export for tagged template literals.","wrong":"const { sql } = require('zoo.pg')","symbol":"sql","correct":"import { sql } from 'zoo.pg'"},{"note":"Named export, not default.","wrong":"import PostgresError from 'zoo.pg'","symbol":"PostgresError","correct":"import { PostgresError } from 'zoo.pg'"}],"quickstart":{"code":"import postgres from 'zoo.pg';\n\nconst sql = postgres({\n  host: 'localhost',\n  port: 5432,\n  database: 'test',\n  user: 'user',\n  password: process.env.PGPASSWORD ?? ''\n});\n\nasync function main() {\n  const result = await sql`SELECT 1 AS number`;\n  console.log(result); // [{ number: 1 }]\n  await sql.end();\n}\n\nmain().catch(console.error);","lang":"typescript","description":"Shows ESM import, connection setup with environment variable for password, simple query, and cleanup."},"warnings":[{"fix":"Use import syntax instead of require().","message":"ESM-only: require() not supported.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Update to version 1.5.0 or later, or use explicit type annotation.","message":"Default export is not a function in some TypeScript setups; fails silently.","severity":"gotcha","affected_versions":">=1.0.0 <1.5.0"},{"fix":"Pass options object with max: number when creating the client.","message":"Connection pool default max is 10; not configurable via connection string.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Replace $1 with ? in parameterized queries.","message":"Renamed query parameter syntax from $1 to ? in v1.2.","severity":"breaking","affected_versions":">=1.2.0"}],"env_vars":null,"search_vec":"'14':52 'box':68 'built':35 'client':3,9 'connect':60 'deno':54 'depend':16 'design':48 'driver':41 'environ':55 'esm':45 'esm-on':44 'extern':40 'focus':19 'import':47 'javascript':69 'librari':10 'minim':15 'modern':50 'month':12 'nativ':7 'node':29 'node-postgr':28 'node.js':51 'perform':21 'pg':26 'pool':61 'postgr':2,8,30 'pre':34 'pre-built':33 'prepar':58 'provid':57 'releas':13 'requir':38 'safeti':24 'ship':32 'statement':59 'support':43,64 'transact':63 'type':23,37 'typescript':6,36,70 'typescript-n':5 'unlik':25 'v1.5.x':11 'zoo':1 'zoo.pg':31","created_at":"2026-06-05T17:03:19.995407+00:00","updated_at":"2026-06-05T17:03:19.995407+00:00","problems":[{"fix":"Use import postgres from 'zoo.pg' instead of require.","cause":"Trying to use require() to import the module.","error":"TypeError: postgres is not a function"},{"fix":"Set \"type\": \"module\" in package.json or use .mjs extension.","cause":"Attempting to import with CommonJS require() or in a CJS project.","error":"Error: Must use import to load ES Module: /path/to/zoo.pg/index.mjs"},{"fix":"Use ? as placeholder in parameterized queries.","cause":"Old parameter placeholder $1 used instead of new ? syntax.","error":"SyntaxError: Unexpected token '?'"}],"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://gitlab.com/zootakuxy-node-lib/postgres#readme","github":null,"docs":null,"changelog":null,"pypi":null,"npm":"zoo.pg","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}}