rate-sql is a lightweight SQL query builder for Node.js and the browser, currently at version 0.2.0. It provides a programmatic way to construct SQL queries with support for parameterization, joins, and subqueries. Different from ORMs like Sequelize or Knex, rate-sql focuses on minimal overhead and zero dependencies. Its release cadence is irregular as it is still in early development. Ideal for developers who want direct SQL control with a clean API and TypeScript types included.
npm install rate-sqlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to create a simple SELECT query with parameterized WHERE clause and retrieve the generated SQL text and values.
Update code to destructure .text and .values from the result.
Replace .raw('SELECT * FROM table') with .sql`SELECT * FROM table`.Clone the instance before building if you need to reuse it.
Provide a polyfill for globalThis or use a bundler that injects it.
Run 'npm install rate-sql' and ensure import is correct: import RateSQL from 'rate-sql'.
Use ESM import: import RateSQL from 'rate-sql'; then new RateSQL().
Call .build() before destructuring: const result = query.build(); const { text, values } = result;