rent
Getting started

Choose a database

Rent supports three SQL protocols: PostgreSQL, MySQL, and SQLite. MariaDB uses the MySQL protocol and the same mysql Cargo feature.

Create a project with one backend selected:

rent new social-app --database postgres
cd social-app

docker compose up -d --wait
rent doctor

rent new writes the matching rent.toml, Cargo feature, connection example, and, except for SQLite, a local Compose service. A SQLite project is immediately usable and stores rent.db beside the application.

Compile only what you deploy

The generated manifest disables Rent's defaults and enables one database:

[dependencies]
rent = {
  path = "/path/to/rent/crates/rent",
  default-features = false,
  features = ["postgres"],
}

Available database features are postgres, mysql, and sqlite. Select several only when the same binary must connect to several database families:

features = ["postgres", "sqlite"]

Code generation follows database.backends in rent.toml, so generated models do not mention disabled SQLx row types:

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

Changing the list requires both a Cargo feature change and rent generate.

Connection URLs

postgres://app:secret@db.internal:5432/application
mysql://app:secret@db.internal:3306/application
sqlite://application.db?mode=rwc

Keep credentials outside rent.toml. Put DATABASE_URL in the project-root .env for local development. Rent checks an explicit command override, the process environment, and then .env, in that order. The conventional variable name is DATABASE_URL, but url_env can select another name when an existing application requires it.

The generated client selects the correct driver from the URL:

let database_url = std::env::var("DATABASE_URL")?;
let client = generated::client::Client::connect(&database_url).await?;

Use Client::connect_with when you need to tune pool limits or timeouts. Applications no longer need to repeat a dialect enum beside a URL that already identifies the database.

Development containers versus supported databases

Docker Compose is a development and conformance convenience, not a runtime requirement. A production application connects to any compatible server by URL. Supabase, TimescaleDB, and ParadeDB images appear in extension tests because they are PostgreSQL distributions; they do not add new Rent dialects.

Continue with define a schema or review production deployment.

On this page