{"id":27678,"library":"database-validator-generator","title":"database-validator-generator","description":"CLI tool that generates Zod v4 schemas and JSDoc typedefs from PostgreSQL database metadata. Version 0.0.1 is the initial release. It connects to a Postgres instance, inspects tables, and outputs an ESM module with Zod schemas for runtime validation. Unlike ORM-based solutions or generic schema generators, it targets Zod v4 specifically and is intentionally minimal: no migrations, no query building, no abstraction layer. Relies on a peer dependency of zod@^4.0.0. Development is active, with frequent updates expected.","status":"active","version":"0.0.1","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","postgres","postgresql","zod","schema","validation","cli","jsdoc","database"],"install":[{"cmd":"npm install database-validator-generator","lang":"bash","label":"npm"},{"cmd":"yarn add database-validator-generator","lang":"bash","label":"yarn"},{"cmd":"pnpm add database-validator-generator","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency required by generated schemas; must be installed separately.","package":"zod","optional":false}],"imports":[{"note":"Generated file is ESM-only (.mjs). CommonJS require will fail.","wrong":"const { usersSchema } = require(\"./schemas.mjs\")","symbol":"usersSchema","correct":"import { usersSchema } from \"./schemas.mjs\""},{"note":"Default export is not provided; must use named import.","wrong":"import schemas from \"./schemas.mjs\"","symbol":"schemas","correct":"import { schemas } from \"./schemas.mjs\""},{"note":"Zod v4 supports named import for the z object; star import may cause issues with tree-shaking.","wrong":"import * as z from \"zod\"","symbol":"z","correct":"import { z } from \"zod\""}],"quickstart":{"code":"npm install --save-dev database-validator-generator\nnpm install zod\nDATABASE_URL=\"postgres://user:password@localhost:5432/app\" npx database-validator-generator generate\ncat schemas.mjs","lang":"typescript","description":"Installs the cli and zod, generates schemas from a postgres database, then shows the output file."},"warnings":[{"fix":"Install zod@^4.0.0: npm install zod@4","message":"Generated schemas target Zod v4. Using with Zod v3 will cause runtime errors.","severity":"breaking","affected_versions":">=0.0.1"},{"fix":"Use import() or convert your project to ESM (type: \"module\" in package.json).","message":"The generated file is ESM (.mjs) and uses top-level await. It cannot be required via CommonJS.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Use --connection with sslmode=require or set DATABASE_URL accordingly.","message":"Connection string must include credentials. SSL may be required for hosted databases.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"","message":"N/A for version 0.0.1","severity":"deprecated","affected_versions":""}],"env_vars":null,"search_vec":"'0.0.1':20 '4.0.0':77 'abstract':68 'activ':80 'base':47 'build':66 'cli':5,91 'connect':26 'databas':2,17,93 'database-validator-gener':1 'depend':74 'develop':78 'esm':36 'expect':84 'frequent':82 'generat':4,8,52 'generic':50 'initi':23 'inspect':31 'instanc':30 'intent':60 'javascript':85 'jsdoc':13,92 'layer':69 'metadata':18 'migrat':63 'minim':61 'modul':37 'orm':46 'orm-bas':45 'output':34 'peer':73 'postgr':29,86 'postgresql':16,87 'queri':65 'releas':24 'reli':70 'runtim':42 'schema':11,40,51,89 'solut':48 'specif':57 'tabl':32 'target':54 'tool':6 'typedef':14 'unlik':44 'updat':83 'v4':10,56 'valid':3,43,90 'version':19 'zod':9,39,55,76,88","created_at":"2026-05-09T05:51:30.508668+00:00","updated_at":"2026-05-09T05:51:30.508668+00:00","problems":[{"fix":"Run: npm install zod@^4.0.0","cause":"zod is a peer dependency and must be installed explicitly.","error":"Error: Cannot find module 'zod'"},{"fix":"Use dynamic import: import('./schemas.mjs') or set type: 'module' in package.json.","cause":"Generated file is ESM and cannot be used with require().","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module"},{"fix":"Ensure you have zod@^4.0.0 installed.","cause":"Zod v4 changed some APIs; generated code uses v4 syntax.","error":"error: expected 'z.object(...)' got 'z.union(...)'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"database-validator-generator","cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/database-validator-generator","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database","serialization","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-05-09","next_check":"2026-08-07","install_tag":null}}