Registry / database / rate-sql

rate-sql

JSON →
library0.2.0jsnpmunverified

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.

database
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ESM-only; CommonJS require will fail in Node < 22 or without proper configuration.

import RateSQL from 'rate-sql'

Named export is PascalCase; common mistake is using camelCase.

import { QueryBuilder } from 'rate-sql'

SQLFragment is a type, prefer TypeScript type-only import to avoid runtime overhead.

import type { SQLFragment } from 'rate-sql'

Shows how to create a simple SELECT query with parameterized WHERE clause and retrieve the generated SQL text and values.

import RateSQL from 'rate-sql'; const sql = new RateSQL(); const query = sql .select('id', 'name') .from('users') .where('age', '>', 18) .build(); console.log(query.text); // 'SELECT id, name FROM users WHERE age > $1' console.log(query.values); // [18]
Debug
Known footguns
breakingIn v0.2.0, the build() method returns { text, values } instead of the previous raw SQL string.
deprecatedThe .raw() method is deprecated and will be removed in v1.0. Use .sql`` template literal instead.
gotchaCalling .build() twice on the same query instance yields the same result; the builder is immutable after build.
gotchaIn browser environments, window is used for global object; if not available, the library throws an error.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
12 hits · last 30 days
bingbot
5
gptbot
3
ahrefsbot
1
Resources