Generate Zod schemas and TypeScript types directly from a MySQL database schema. Version 4.1.8 provides a CLI and programmatic API to introspect tables and produce Zod objects, including auto-increment handling, nullable fields, enum support, and configurable output (camelCase, nullish, suffix, etc.). Replaces mysql-zod with different API and expanded options. Active development with monthly releases.
npm install zod-mysqlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Connects to MySQL, introspects specified tables, and generates Zod schemas and TypeScript types into files.
Migrate from `generate(host, user, ...)` to `generate({ host, user, ... })`.Add `nullish: true` to config options.
Ensure your database does not contain empty strings, or disable `requiredString`.
Use `zodCommentTypes: true` in config instead of inline comments.
Run `npm install zod-mysql --save-dev`
Use `import { generate } from 'zod-mysql'`Check host, port, user, and password in config.