Skip to content

High-performance SQL parser and AST analyzer written in TypeScript. Provides fast parsing and advanced transformation capabilities.

License

Notifications You must be signed in to change notification settings

mk3008/rawsql-ts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1,705 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rawsql-ts

License: MIT

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.

Packages

Core

Package Version Description
rawsql-ts npm SQL parser and AST transformer. Zero dependencies, browser-ready.

Contract

Package Version Description
@rawsql-ts/sql-contract npm Type-safe result mapping for raw SQL queries. Driver and validator agnostic.

Testing

Package Version Description
@rawsql-ts/testkit-core npm Fixture-backed CTE rewriting and schema validation engine. Driver-agnostic ZTD foundation.
@rawsql-ts/testkit-postgres npm Postgres-specific CTE rewriting and fixture validation. Works with any executor.
@rawsql-ts/adapter-node-pg npm Adapter connecting pg (node-postgres) to testkit-postgres.
@rawsql-ts/testkit-sqlite npm SQLite-specific CTE rewriting and fixture validation. In-memory testing with better-sqlite3.

Documentation

Package Version Description
@rawsql-ts/ddl-docs-cli npm CLI that generates Markdown table definition docs from DDL files.
@rawsql-ts/ddl-docs-vitepress npm Scaffold generator for VitePress-based database schema documentation sites.

CLI

Package Version Description
@rawsql-ts/ztd-cli npm DB-agnostic scaffolding and DDL helpers for Zero Table Dependency projects.

Architecture

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

Quick Start

npm install rawsql-ts

See the Core Package Documentation for usage examples and API reference.

Online Demo

Try rawsql-ts in your browser

License

MIT

About

High-performance SQL parser and AST analyzer written in TypeScript. Provides fast parsing and advanced transformation capabilities.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

  •  

Contributors