Skip to content
Using Rent

Command-line workflow

The rent command is the front door to a Rent project. You use it to create an application, generate the client, inspect the interpreted schema, review database changes, browse local data, and apply migrations.

The everyday loop

Create a complete application with SQLite, a starter entity, generated code, and project configuration:

rent new social-app
cd social-app

rent doctor
rent migrate dev --name initial
cargo run

Or add Rent to a crate you already have:

rent init --database postgres User Post Comment

rent init writes rent.toml, creates the declarations, generates the typed client, and declares that client in your crate root, so the project is usable straight away. Adding more entities later needs no flag:

rent init Comment

After editing rent/schema.rsl, regenerate it:

rent generate
cargo check

During active schema work, keep generation running in another terminal:

rent dev

Review how Rent interpreted the schema:

rent describe
Post
  Table: posts
  Fields:
    id: i64
    title: String (1 validator(s))
  Indexes:
    authorId: [authorId]
  Relations:
    author: User (one, required)

Classify the proposed database work without changing anything:

rent migrate preflight

For local development, create, apply, and verify the migration in one command:

rent migrate dev --name create_blog

For a controlled deployment, preview the SQL, create a reviewable migration file, and apply that exact file:

rent migrate diff

rent migrate plan --name create_blog

rent migrate validate

rent migrate apply
Migration: create_blog

Created ./rent/migrations/20260910023750_create_blog.sql
Changes   3 operations
Checksum  84ec0a3f7d1b9c5e2a8f4d6b0c3e7a9f1d5b8c2e4a6f0d3b7c9e1a5f8d2b4c6e
Valid: 1 migration verified.
Applied 20260910023750_create_blog (3 statements)

When a deployment needs an authored backfill rather than a schema diff, create an editable migration and seal it after writing the SQL:

rent migrate create --name backfill_post_summaries

# Edit the timestamped backfill_post_summaries migration.

rent migrate seal
rent migrate validate

The next drift check should be empty. That fixed point proves the live database matches the desired catalog:

rent migrate drift
Verified: No schema drift.

Browse the resulting development data in a local, read-only web interface:

rent studio

Studio binds only to your loopback interface. Enable cell editing deliberately with --allow-writes.

If the schema declares PostgreSQL extensions, check the destination server before planning their lifecycle:

rent extension check --provider self-hosted

rent extension status

Where to go deeper

The complete CLI guide gives each command its own page:

Those pages include complete options, multiple scenarios, expected output, and safety behavior.