CLI and library to generate Zod schemas (v2.2.0) from a MySQL database by introspecting table schemas. Supports configurable output including camelCase conversion, nullish vs nullable, and required string validation. Differentiators include simple JSON config, table filtering, and direct API usage. Actively maintained by a single developer, release cadence is irregular.
npm install mysql-zodNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows both JSON config and programmatic usage to generate Zod schemas from MySQL tables.
Create directory beforehand or remove 'folder' to use default './'.
Backup previous generated files or use a different output folder.
Update zod to latest. Minimum zod peer dependency is 3.x.
Use 'nullish' instead to generate .nullish() schemas.
Install zod: npm install zod
Start MySQL server or update connection config in mysql-zod.json
Check 'user' and 'password' in mysql-zod.json