.reylo.yaml

The keys of Reylo's project file

Configure Reylo in a .reylo.yaml (or .reylo.yml) file beside package.json. Every key is optional:

.reylo.yaml
# the dev database Reylo reads your schema from (the default)
direct_url: ${DATABASE_URL}
# the .env files Reylo reads (the default)
env: [.env.local, .env]
# a parameter whose type cannot be inferred is an error (the default)
allow_untyped_params: false
# a Postgres array column holds one dimension (the default)
allow_nested_arrays: false
# a comment naming each query's file, for your database's monitoring (the default)
sqlcommenter: true
# the directory of Reylo's files: schema.sql, the migrations and its cache (the default)
dir: reylo

Reylo uses the nearest package.json at or above the directory it runs in. One in your home directory doesn't count.

direct_url

The dev database Reylo reads your schema from. It defaults to DATABASE_URL, and its scheme names the dialect:

.env
# or postgresql://
DATABASE_URL=postgres://localhost:5432/app
# or mariadb://
DATABASE_URL=mysql://root@localhost:3306/app
# the path starts at package.json
DATABASE_URL=sqlite:./app.db
# or clickhouse+https://, the URL of the HTTP interface
DATABASE_URL=clickhouse+http://default@localhost:8123/app

Point it at a direct connection, not a pooler. A pooler in transaction mode, such as PgBouncer, can fail to describe a query. You can interpolate other variables from your environment to construct a connection string.

.reylo.yaml
# the default is ${DATABASE_URL}
direct_url: postgres://${DB_USER}:${DB_PASSWORD}@${DB_HOST}:5432/app

A variable can fall back, as in a shell, when it is unset or empty:

.reylo.yaml
direct_url: ${BUILD_DATABASE_URL:-${DATABASE_URL}}

To keep a password out of every file, use $(…). It runs a command, such as a password manager's, and puts what it prints in its place. Reylo runs it once per editor session or build, and again when a login is refused.

.reylo.yaml
# or $(aws rds generate-db-auth-token …) for a short-lived token
direct_url: postgres://app:$(op read op://dev/db/password)@db:5432/app

A type check or build reads this database, while .run() uses the client you pass in. Apply your migrations first in CI and on your host. To type-check a script against production directly:

DATABASE_URL="$PRODUCTION_URL" node --import reylo/register report.ts

The type check reads TLS settings from the URL in direct_url:

.env
# postgres: encrypted, no certificate check
DATABASE_URL=postgres://…/app?sslmode=require
# postgres: the certificate and host checked
DATABASE_URL=postgres://…/app?sslmode=verify-full
# mysql: encrypted, no certificate check
DATABASE_URL=mysql://…/app?ssl-mode=REQUIRED
# mysql: the certificate and host checked
DATABASE_URL=mysql://…/app?ssl-mode=VERIFY_IDENTITY

The defaults, and the other settings each reads:

  • With no setting, a Postgres connection is encrypted where the server offers it, and a MySQL connection isn't.
  • Postgres also reads libpq's sslrootcert, sslcert, sslkey and channel_binding, and node-postgres's ssl=true.
  • MySQL also reads mysql2's ssl JSON setting and Prisma's sslaccept=strict.
  • A certificate is also checked against the certificates NODE_EXTRA_CA_CERTS names, as Node checks it.

env

The .env files Reylo reads, relative to .reylo.yaml. The first file that sets a variable wins, and the environment wins over every file.

.reylo.yaml
# the default is [.env.local, .env]
env: [.env.development, .env]

Reylo reads them as dotenv does. A # outside quotes starts a comment, so quote a value that holds one:

.env
# or mysql://… or sqlite:./path/to/your.db, etc
DATABASE_URL="postgres://app:pa#ss@localhost:5432/app" # the dev database

allow_untyped_params

Whether a parameter whose type cannot be inferred may stay unknown.

By default it's an error that says to cast it.

.reylo.yaml
# the default is false
allow_untyped_params: true

allow_nested_arrays

Whether a Postgres array column may hold nested arrays.

Postgres doesn't track an array's dimensions. By default Reylo types an array column as one-dimensional, and .run() throws on a deeper value. With this set, the column is a NestedArray<T> of any depth.

.reylo.yaml
# the default is false
allow_nested_arrays: true

sqlcommenter

Reylo appends a sqlcommenter comment naming each query's file, so tools like Datadog and PlanetScale can group queries by source. Set sqlcommenter: false to omit it:

.reylo.yaml
# the default is true
sqlcommenter: false

On SQLite, the comment opens the query instead. The query's .sql property leaves the comment out. By default, Postgres receives:

What Postgres receives for queries/get_user.sql, by default
select id, name, email from  where id = $1::int /*file='queries%2Fget_user.sql'*/

dir

The directory beside .reylo.yaml that holds Reylo's files. You commit its migrations, and its .cache/ keeps itself out of git.

.reylo.yaml
# the default is reylo
dir: db

shadow_url

The server where migrations build their shadow databases, for a database whose own server refuses create database:

.reylo.yaml
# the default is the database's own server
shadow_url: ${SHADOW_URL}
Released under the MIT License. Copyright © 2026 Colin McDonnell.

On this page

reylosql/reylo