Skip to content

Introduction

ORMs are almost always the best choice for developers wanting type-safety with their databases, but sometimes you can’t use them. Maybe you can’t ship the migrations due to some constraint, maybe you need a self-contained bundle or binary, maybe you just want ownership of the queries.

SQTS is a way to keep writing real SQL while getting the confidence of type-safe application code.

Most teams want direct control over their queries, but still want help catching mistakes before runtime. You write your migrations as SQL, write your operations in .sqts files (almost SQL), and SQTS will compile it into model types and callable operation functions.

With SQTS, you can:

  • Keep SQL as SQL, instead of rewriting your data layer around an ORM query builder (ish).
  • Define migrations in SQL and get types for free.
  • Map query results into clean, predictable object shapes.
  • Use a configurable adapter so SQTS can fit your runtime setup and database connection.
  • Supports read and write operations, with support for transactions and multiple statements in a single operation.

SQTS is especially useful when you care about portability, explicit control, and long-term maintainability of your queries.

If you already like writing SQL by hand, SQTS helps you keep that workflow while adding safety and consistency around it.