{"id":42131,"library":"tsbean-driver-postgres","title":"TSBean PostgreSQL Driver","description":"PostgreSQL driver for TSBean-ORM, based on the pg library. Current stable version is 3.0.2, released alongside tsbean-orm 3.0.0. This driver automatically handles identifier conversion from camelCase (TypeScript) to snake_case (PostgreSQL), supporting custom conversion or disabling entirely. It is designed exclusively for use with tsbean-orm as a peer dependency. The driver connects to PostgreSQL using the pg package and provides a DataSource via PostgreSQLDriver.createDataSource(). Release cadence follows tsbean-orm releases. Key differentiator: built-in identifier mapping between ORM and database naming conventions.","status":"active","version":"3.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/AgustinSRG/tsbean-driver-postgres","tags":["javascript","typescript"],"install":[{"cmd":"npm install tsbean-driver-postgres","lang":"bash","label":"npm"},{"cmd":"yarn add tsbean-driver-postgres","lang":"bash","label":"yarn"},{"cmd":"pnpm add tsbean-driver-postgres","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package is ESM-only. CommonJS require() will not work.","wrong":"const PostgreSQLDriver = require('tsbean-driver-postgres')","symbol":"PostgreSQLDriver","correct":"import { PostgreSQLDriver } from 'tsbean-driver-postgres'"},{"note":"For type-only imports when you only need the type of PostgreSQLDriver.","wrong":"","symbol":"PostgreSQLDriver (type)","correct":"import type { PostgreSQLDriver } from 'tsbean-driver-postgres'"},{"note":"DataSourceDriver is exported by tsbean-orm, not this driver package.","wrong":"import { DataSourceDriver } from 'tsbean-driver-postgres'","symbol":"DataSourceDriver","correct":"import { DataSourceDriver } from 'tsbean-orm'"},{"note":"DataSource is from tsbean-orm, not from the driver package.","wrong":"import { DataSource } from 'tsbean-driver-postgres'","symbol":"DataSource","correct":"import { DataSource } from 'tsbean-orm'"}],"quickstart":{"code":"import { DataSourceDriver, DataSource } from \"tsbean-orm\";\nimport { PostgreSQLDriver } from \"tsbean-driver-postgres\";\n\n// Create a PostgreSQL data source with connection options\nconst mySource = PostgreSQLDriver.createDataSource({\n    host: process.env.DB_HOST ?? \"localhost\",\n    port: parseInt(process.env.DB_PORT ?? \"5432\"),\n    user: process.env.DB_USER ?? \"postgres\",\n    password: process.env.DB_PASSWORD ?? \"postgres\",\n    database: process.env.DB_NAME ?? \"my_database\",\n});\n\n// Set as default data source for the ORM\nDataSource.set(DataSource.DEFAULT, mySource);\n\nconsole.log(\"PostgreSQL data source configured successfully.\");","lang":"typescript","description":"Creates a PostgreSQL data source using connection parameters and sets it as the default data source for TSBean-ORM."},"warnings":[{"fix":"Replace new PostgreSQLDriver(options) with PostgreSQLDriver.createDataSource(options).","message":"The constructor PostgreSQLDriver(options) is deprecated since version 2. Use PostgreSQLDriver.createDataSource(options) instead.","severity":"deprecated","affected_versions":">=1.0.0 <2.0.0"},{"fix":"Use import statements. If you need CJS, stick to version 2.x or use dynamic import().","message":"In version 3.0.0, the package switched from CJS to ESM-only. CommonJS require() will throw an error.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Rename 'disableIdentifierConversion' to 'disableAutoIdentifierConversion' in your data source configuration.","message":"The option 'disableIdentifierConversion' is deprecated since version 3. Use 'disableAutoIdentifierConversion' instead.","severity":"deprecated","affected_versions":">=2.0.0 <3.0.0"},{"fix":"Set disableAutoIdentifierConversion: true in your data source config, or provide a customIdentifierConversion function.","message":"Identifier conversion (camelCase <-> snake_case) is enabled by default. If your database uses mixed-case or unconventional identifiers, queries may fail.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Upgrade Node.js to version 16 or higher.","message":"Node.js engine requirement increased from >=10.0.0 to >=16.0.0 in version 3.0.0.","severity":"breaking","affected_versions":">=3.0.0"}],"env_vars":null,"search_vec":"'3.0.0':25 '3.0.2':19 'alongsid':21 'automat':28 'base':10 'built':84 'built-in':83 'cadenc':75 'camelcas':33 'case':37 'connect':61 'convent':93 'convers':31,41 'current':15 'custom':40 'databas':91 'datasourc':71 'depend':58 'design':47 'differenti':82 'disabl':43 'driver':3,5,27,60 'entir':44 'exclus':48 'follow':76 'handl':29 'identifi':30,86 'javascript':94 'key':81 'librari':14 'map':87 'name':92 'orm':9,24,54,79,89 'packag':67 'peer':57 'pg':13,66 'postgresql':2,4,38,63 'postgresqldriver.createdatasource':73 'provid':69 'releas':20,74,80 'snake':36 'stabl':16 'support':39 'tsbean':1,8,23,53,78 'tsbean-orm':7,22,52,77 'typescript':34,95 'use':50,64 'version':17 'via':72","created_at":"2026-06-04T18:55:46.041275+00:00","updated_at":"2026-06-04T18:55:46.041275+00:00","problems":[{"fix":"Change require('tsbean-driver-postgres') to import { PostgreSQLDriver } from 'tsbean-driver-postgres'.","cause":"Package is ESM-only since version 3; using require() fails.","error":"ERR_REQUIRE_ESM: require() of ES Module not supported"},{"fix":"Run 'npm install tsbean-orm' alongside tsbean-driver-postgres.","cause":"tsbean-orm is a peer dependency and must be installed explicitly.","error":"Cannot find module 'tsbean-orm'"},{"fix":"Use PostgreSQLDriver.createDataSource(options) instead.","cause":"Using new PostgreSQLDriver() after version 2; the constructor is removed.","error":"TypeError: PostgreSQLDriver is not a constructor"},{"fix":"Check your network connection and hostname. For Docker, use 'host.docker.internal' for localhost.","cause":"Database host is not reachable or DNS resolution fails.","error":"Error: getaddrinfo ENOTFOUND localhost"}],"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/AgustinSRG/tsbean-driver-postgres","github":"https://github.com/AgustinSRG/tsbean-driver-postgres","docs":null,"changelog":null,"pypi":null,"npm":"tsbean-driver-postgres","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-04","next_check":"2026-09-02","install_tag":null}}