CLI tool to auto-generate TypeScript entity functions from a MySQL database schema. Version 0.4.0, updates are occasional. Produces typed CRUD functions using @sinclair/typebox for schema validation and ajv/ajv-formats for runtime validation. Key differentiator: generates both types and validation logic from live database tables in one command, with support for MySQL 5.6 and 5.7. Relies on mariadb driver. Suitable for Node.js/TypeScript projects already using TypeBox and AJV.
npm install atp-gen-mysql-entities-cliNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to install and run the CLI to generate entity files into the default './entities' directory.
If using MySQL 5.6, stick with versions <0.2.4. For 5.7+, use >=0.3.0.
Use short flags as documented. Check for future releases with long options.
Use environment variable MYSQL_PWD or a .env file instead of plaintext password argument.
Add @sinclair/typebox, ajv, and ajv-formats as dependencies in your project.
Verify MySQL host (--host), port (--port), username, and password. Grant SELECT on information_schema.TABLES and COLUMNS.
Use the correct IP or hostname. If local, use 'localhost' or '127.0.0.1'.
Install the peer dependency: npm install @sinclair/typebox