{"id":44073,"library":"tusken","title":"tusken","description":"A TypeScript-native Postgres client with code generation capabilities. Version 0.1.0 is the initial release, offering a query builder and type-safe SQL execution. It differentiates itself by generating TypeScript types from your database schema, reducing boilerplate and runtime errors. Built on top of the popular 'pg' driver, it requires peer dependencies 'pg', 'postgres-interval', and 'postgres-range'. Still in early development, with a focus on developer experience and type safety.","status":"active","version":"0.1.0","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","postgres","typescript","codegen"],"install":[{"cmd":"npm install tusken","lang":"bash","label":"npm"},{"cmd":"yarn add tusken","lang":"bash","label":"yarn"},{"cmd":"pnpm add tusken","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"PostgreSQL driver for Node.js","package":"pg","optional":false},{"reason":"Interval type support for Postgres","package":"postgres-interval","optional":true},{"reason":"Range type support for Postgres","package":"postgres-range","optional":true}],"imports":[{"note":"Named export, not default.","wrong":"import tusken from 'tusken'","symbol":"tusken","correct":"import { tusken } from 'tusken'"},{"note":"ESM-only; use named import.","wrong":"const sql = require('tusken').sql","symbol":"sql","correct":"import { sql } from 'tusken'"},{"note":"Named export for the client class.","wrong":"import PgClient from 'tusken'","symbol":"PgClient","correct":"import { PgClient } from 'tusken'"}],"quickstart":{"code":"import { tusken, sql } from 'tusken';\n\nconst db = tusken({\n  host: process.env.PGHOST ?? 'localhost',\n  port: parseInt(process.env.PGPORT ?? '5432'),\n  database: process.env.PGDATABASE ?? 'mydb',\n  user: process.env.PGUSER ?? 'user',\n  password: process.env.PGPASSWORD ?? '',\n});\n\nasync function main() {\n  const result = await db.query(sql`SELECT * FROM users WHERE id = ${1}`);\n  console.log(result.rows);\n  await db.end();\n}\nmain().catch(console.error);","lang":"typescript","description":"Connects to Postgres using environment variables, runs a parameterized query, and closes the connection."},"warnings":[{"fix":"Pin to a specific version and test upgrades.","message":"tusken is in version 0.x and API may change without major version bump.","severity":"breaking","affected_versions":"<1.0.0"},{"fix":"Run 'npm install pg' alongside tusken.","message":"Peer dependency 'pg' must be installed separately; tusken does not bundle it.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Use 'import' syntax or ensure your project is configured for ESM.","message":"Using 'require' style imports will fail because tusken is ESM-only.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Always use 'db.query(sql`...`)' for parameterized queries.","message":"The 'sql' tagged template literal only works with tusken's query method; passing to other libraries may break.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"search_vec":"'0.1.0':13 'boilerpl':40 'builder':21 'built':44 'capabl':11 'client':7 'code':9 'codegen':80 'databas':37 'depend':55 'develop':67,72 'differenti':29 'driver':51 'earli':66 'error':43 'execut':27 'experi':73 'focus':70 'generat':10,32 'initi':16 'interv':59 'javascript':77 'nativ':5 'offer':18 'peer':54 'pg':50,56 'popular':49 'postgr':6,58,62,78 'postgres-interv':57 'postgres-rang':61 'queri':20 'rang':63 'reduc':39 'releas':17 'requir':53 'runtim':42 'safe':25 'safeti':76 'schema':38 'sql':26 'still':64 'top':46 'tusken':1 'type':24,34,75 'type-saf':23 'typescript':4,33,79 'typescript-n':3 'version':12","created_at":"2026-06-05T17:02:51.257293+00:00","updated_at":"2026-06-05T17:02:51.257293+00:00","problems":[{"fix":"Run 'npm install tusken pg'","cause":"Package not installed or not in node_modules.","error":"Cannot find module 'tusken'"},{"fix":"Make sure to call 'tusken(options)' and use the returned object.","cause":"Did not initialize tusken client correctly.","error":"TypeError: db.query is not a function"},{"fix":"Use 'import { tusken } from 'tusken'' in an ESM context, or switch to a bundler that supports ESM.","cause":"Using named imports in a CJS context or wrong import syntax.","error":"SyntaxError: Named export 'tusken' not found. The requested module 'tusken' is a CommonJS module..."},{"fix":"Run 'npm install pg'.","cause":"Missing peer dependency 'pg'.","error":"Module 'pg' is required but not installed"}],"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":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"tusken","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}}