Skip to content
Reference

rent.toml

rent.toml records where a project keeps its schema, generated client, and migrations, plus the database its local tooling talks to. rent init and rent new write it, so there is nothing to author by hand, and it stays editable afterwards.

Rent reads it from the project root, which is the current directory unless --root names another. A project without the file falls back to the defaults below, and rent doctor reports that it is running on defaults rather than on a recorded configuration.

Unknown keys are rejected rather than ignored, so a misspelled key is an error at the point of use instead of a setting that silently does nothing.

Paths

KeyDefaultWhat it does
schemarent/schema.rslRSL schema file, or a directory whose .rsl files merge in lexical path order
generatedrent/generatedDestination for the generated client, regenerated and committed
migrationsrent/migrationsAppend-only migration directory, including rent.sum and rent.generated.json
extension_manifests[]Community extension pack manifests used by extension preflight
crateunsetThe crate that owns the generated client when it is not the project root's own. rent new and rent init --crate set it

Paths are relative to the project root.

The final component of generated supplies the default Rust module name when rent init inserts a declaration: rent/generated becomes crate::generated, and rent/db becomes crate::db. An existing #[path] declaration may expose the client under another module name. Rent recognizes it by its resolved target. This also supports two clients whose output directories share a basename.

A configuration below its client crate can set crate = "../..", for example from rent/access/rent.toml. This identifies the enclosing crate without moving or creating a crate. Paths are normalized without requiring not-yet-generated files to exist.

Database

KeyDefaultWhat it does
dialectsqliteLocal tooling dialect: postgres, mysql, mariadb, or sqlite
url_envDATABASE_URLEnvironment variable holding the connection URL
backends["sqlite"]Backends the generated client compiles support for

Credentials never belong in this file. Rent resolves a connection URL from --database-url, then the variable named by url_env, then that variable in the project-root .env, in that order. A SQLite project with none of those set falls back to a local rent.db, which is why commands that must not create a database, such as rent doctor, report the check as skipped instead of connecting.

backends controls compiled support and should match the Cargo features the application enables. List more than one only when the same binary genuinely connects to several database families.

Generated types

KeyDefaultWhat it does
generate.enums.derive[]Derive paths every generated enum carries
generate.enums.attributes[]Outer attributes every generated enum carries
generate.types.derive[]Derive paths every generated value type carries
generate.types.attributes[]Outer attributes every generated value type carries
generate.models.derive[]Derive paths every generated model carries
generate.models.attributes[]Outer attributes every generated model carries

An attribute's {file} becomes the schema file that declares the type, relative to the schema directory and without .rsl. These items come before a type's own @@rent.derive and @@rent.attribute, and a type may not repeat one of them. Changing them marks the generated client stale, as a schema change does. See derives and attributes on generated types.

A complete file

schema = "rent/schema.rsl"
generated = "rent/generated"
migrations = "rent/migrations"
extension_manifests = []

[database]
dialect = "postgres"
url_env = "DATABASE_URL"
backends = ["postgres"]

Changing it later

Editing paths moves where Rent looks, not what already exists. After changing generated, the previous directory and the module declaration that points at it both remain. Delete the old directory and update the declaration in your crate root. Run rent doctor after any change to confirm the project still holds together.