# hiddentao/squel

:office: SQL query string builder for Javascript

Repository: https://github.com/hiddentao/squel
Canonical: https://ross.abutalabs.com/products/squel
Homepage: https://hiddentao.github.io/squel
Language: TypeScript
License: MIT
License Family: permissive
Last push: 2026-08-09T18:28:05+00:00

## Health v2 (maintenance only)
Score: 75/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 96, release rhythm 35, longevity 100
- inputs: {"age_days": 5370, "days_push": 24, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1570, forks 230 (observed 2026-08-28T04:05:05.323154+00:00)

## What it is
Squel is a lightweight SQL query string builder library for JavaScript and TypeScript with a fluent, method-chaining API. It generates standard SELECT/INSERT/UPDATE/DELETE statements plus dialect-aware features (CTEs, UPSERT, MERGE, RETURNING, window functions) for MySQL, PostgreSQL, SQLite, and MS SQL Server, running in both Node.js and the browser.

## Use cases
- build sql queries in javascript without string concatenation
- sql query builder for node.js or typescript
- generate parameterized sql queries with safe value escaping
- build postgres upsert or mssql merge queries programmatically
- write cte and window function queries with a fluent js api
- construct sql statements dynamically at runtime in the browser
- avoid sql injection from brittle string substitution when assembling queries

## When to choose
- You need to construct SQL query strings programmatically with a clean, fluent API but do not want a full ORM
- You want a tiny (~8 KB) dependency that works in both Node.js and the browser
- You need dialect-specific SQL features like Postgres UPSERT, SQL Server MERGE, RETURNING/OUTPUT clauses, or window functions
- You want a library you can extend with custom query blocks or commands

## When to avoid
- You need to actually connect to and execute queries against a database - squel only builds SQL strings and ships no drivers
- You need full ORM capabilities such as migrations, schema management, or result mapping (consider Knex or a dedicated ORM)
- You intend to generate queries in the browser and execute them server-side, which is an unsafe pattern the project explicitly warns against

## Facets
- artifact type: library
- maturity: active
- function: database
- domain: databases, backend, web-development, developer-tools
- platform: browser, cross-platform
- tags: sql, query-builder, query-string-builder, typescript, javascript, mysql, postgresql, mssql, sqlite, fluent-api, method-chaining, parameterized-queries, cte, window-functions, esm, npm, nodejs

## Member repositories
- hiddentao/squel (main) score 75

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:05:05.323154+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T03:58:33.866891+00:00, confidence not recorded.
  - readme: https://github.com/hiddentao/squel (fetched 2026-08-28T04:05:05.323154+00:00, sha 15d8950372c9)
  - homepage: https://hiddentao.github.io/squel (fetched 2026-08-29T11:28:18.304926+00:00, sha 61fb6e08f8fe)
  - registry_npm: https://registry.npmjs.org/squel (fetched 2026-08-29T11:28:18.315097+00:00, sha 1a27f4772d1f)
- Data as of 2026-08-30T08:39:29.467469+00:00.
