A lightweight and flexible query maker library for building raw SQL queries in JavaScript and TypeScript. Current stable version 0.7.1 (frequent releases). Focuses on type-safe query construction with minimal abstraction, supporting SELECT, INSERT, UPDATE, DELETE, and Postgres features like RETURNING. Requires zod v4+, class-validator, and class-transformer as peer dependencies. Differentiator: offers raw SQL control with optional runtime validation via Zod schemas, and full TypeScript support.
npm install sqmNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Builds a simple SELECT query with parameters, showcases the fluent API and automatic parameterization.
Use import, set "type": "module" in package.json, or use dynamic import().
Update join calls to use two arguments: table and condition.
Always chain calls and use the result of .build() only once.
Install class-validator and class-transformer alongside sqm.
Convert project to ESM or use dynamic import().
Use import instead of require, or set "type": "module" in package.json.
Run: npm install class-validator class-transformer
Assign the result of .build() to a variable and use that; do not chain further after .build().
Switch to ES module syntax (export, import).