NewIntroducing Reylo Migrate — SQL-first schema and migrations

Import SQL into TypeScript, fully typed

Reylo infers type information from SQL queries, against a live database.

$npm i reylo
Read the docs
get_author.sql
select u.id, u.name, count(p.id)::int as post_count
from users u
left join posts p on p.user_id = u.id
where u.id = :id::int
group by u.id

Works with

PostgresMySQLSQLiteSupabaseNeonPlanetScale
Amazon RDSGoogle Cloud SQLAzure DatabaseCloudflare D1Turso

The full power of SQL in the palm of your hand

No lossy DSL and no CRUD-limited ORM. Reylo gives you (and your agents) back the freedom to write complex queries without sacrificing DRY.

Query
select u.name, p.title
from users u
left join posts p on p.user_id = u.id
where u.id = :user_id::int
Params
{ user_id: number }
Returns
{ name: string; title: string | null }[]

A left join makes the joined table's columns nullable.

Why Reylo

The full power of SQL

Any syntax, function or operator your database supports, from window functions to JSON aggregation and returning clauses.

No hand-written types

Parameters, columns, nullability and cardinality come from the database's own analysis of each query.

Checked against your database

A misspelled column is a type error at its line and column, and so is a wrong argument to .run().

Agent-friendly

A query and its types are one file. An agent edits the SQL, and the types follow, with nothing else to update.

Postgres, MySQL and SQLite

Each in its own dialect, on Neon, Supabase, PlanetScale, Cloudflare D1, Turso and more.

Your own driver

Runs on pg, postgres.js, Bun.sql, Neon, mysql2, mariadb, PlanetScale, better-sqlite3, node:sqlite, libSQL, Cloudflare D1 and more, or through Drizzle and Knex.

Ship faster with Reylo

$npm i reylo
Read the docs