A monorepo for rawsql-ts — a toolkit that treats raw SQL as a first-class citizen, enhancing maintainability and reusability through high-performance AST parsing and programmatic manipulation.
By parsing SQL into abstract syntax trees, rawsql-ts enables type-safe query building, static validation, and transparent result mapping — all while preserving the expressiveness and control of handwritten SQL. AST-based rewriting also powers Zero Table Dependency (ZTD) testing, which transforms application queries to run against in-memory fixtures instead of physical tables, enabling deterministic unit tests without database setup overhead.
Designed to complement — not replace — your SQL expertise.
Note
This project is currently in beta. APIs may change until the v1.0 release.
| Package | Version | Description |
|---|---|---|
| rawsql-ts | SQL parser and AST transformer. Zero dependencies, browser-ready. |
| Package | Version | Description |
|---|---|---|
| @rawsql-ts/sql-contract | Type-safe result mapping for raw SQL queries. Driver and validator agnostic. |
| Package | Version | Description |
|---|---|---|
| @rawsql-ts/testkit-core | Fixture-backed CTE rewriting and schema validation engine. Driver-agnostic ZTD foundation. | |
| @rawsql-ts/testkit-postgres | Postgres-specific CTE rewriting and fixture validation. Works with any executor. | |
| @rawsql-ts/adapter-node-pg | Adapter connecting pg (node-postgres) to testkit-postgres. |
|
| @rawsql-ts/testkit-sqlite | SQLite-specific CTE rewriting and fixture validation. In-memory testing with better-sqlite3. |
| Package | Version | Description |
|---|---|---|
| @rawsql-ts/ddl-docs-cli | CLI that generates Markdown table definition docs from DDL files. | |
| @rawsql-ts/ddl-docs-vitepress | Scaffold generator for VitePress-based database schema documentation sites. |
| Package | Version | Description |
|---|---|---|
| @rawsql-ts/ztd-cli | DB-agnostic scaffolding and DDL helpers for Zero Table Dependency projects. |
rawsql-ts (core)
├── @rawsql-ts/sql-contract
├── @rawsql-ts/testkit-core
│ ├── @rawsql-ts/testkit-postgres
│ │ └── @rawsql-ts/adapter-node-pg
│ └── @rawsql-ts/testkit-sqlite
├── @rawsql-ts/ddl-docs-cli
│ └── @rawsql-ts/ddl-docs-vitepress
└── @rawsql-ts/ztd-cli
npm install rawsql-tsSee the Core Package Documentation for usage examples and API reference.
MIT