Schemats generates TypeScript interface definitions from PostgreSQL or MySQL database schemas. Version 4.9.1 is the latest stable release, with irregular release cadence. It supports generating types for all tables in a schema or specific tables, and provides both CLI and programmatic API. Key differentiators include config file support, type-safe query results integration with pg-promise, and handling of custom types.
npm install nu-schematsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Installs Schemats globally, generates TypeScript interfaces for a specific table, and imports them for type-safe database queries.
Upgrade Node.js to version 10 or later.
Update CLI commands to not use --type. Connection string must include 'postgres://' or 'mysql://'.
Always specify -t <table> or use -s <schema> to limit scope.
Use multiple -t flags instead: -t users -t posts
Ensure mysql2 is installed: npm install mysql2
Consider renaming properties manually or using a post-processing script.
npm install pg
Verify database is running and connection string is correct: postgres://user:pass@host:port/db
Provide a valid connection string: -c postgres://localhost/mydb
Use -s to specify the correct schema name