{"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,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","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,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}