rent

The type-safe Rust ORM for PostgreSQL.

Rent is a schema-first Rust ORM and database toolkit. Define your models once, generate a statically typed async client, plan reviewed SQL migrations, and use PostgreSQL extensions such as pgvector, PostGIS, pgmq, and TimescaleDB as typed Rust packages. PostgreSQL first, with MySQL, MariaDB, and SQLite on the same client.

Schema in, Rust out

Write the schema once. Rent generates the client.

Models, relationships, and even pgvector columns are declared in RSL, a declarative schema language that reads the way modern ORM schemas do. Running rent generate replaces the Rust client atomically, so a field that no longer exists is a compile error, not a runtime surprise.

model User {
  id    BigInt @id
  name  String
  posts Post[]

  @@map("users")
}

model Post {
  id        BigInt  @id
  title     String
  author_id BigInt
  author    User    @relation(fields: [author_id], references: [id])
  embedding pgvector.Vector?

  @@map("posts")
}

Typed queries, typed extensions

Every query is checked by the Rust compiler.

Fluent builders for CRUD, filters, eager loading, pagination, and vector search. One mutation per save(), rows returned from the same statement on PostgreSQL and SQLite, and raw SQL when you want it.

let ada = client
    .create_user_from(NewUser { name: "Ada".to_owned() })
    .save()
    .await?;

let posts = client
    .post()
    .title_contains("typed")
    .with_author(|author| author)
    .order_by_desc(post::fields::ID)
    .limit(20)
    .all()
    .await?;

let nearest = client
    .post()
    .nearest_cosine(post::fields::EMBEDDING, &query)
    .limit(5)
    .all()
    .await?;

What you get

A complete data layer for Rust services

One model, one flow

From schema to reviewed migration to running application.

Rent validates the RSL document, generates the Rust client, and derives the desired database catalog from that same source. It compares the catalog with the live database, then plans and applies SQL you have read.

rent new social-app --database postgres
cd social-app
rent migrate dev --name initial
cargo run

Coming from another ORM

How Rent compares

Coming from Prisma, Ent, SQLx, Diesel, or SeaORM? These pages show what changes and what stays, feature by feature.

Private preview

The docs are public. The source is by invitation.

Rent is in private preview while the first public release is prepared. Read what is available today, then ask for access or get in touch.

Start with SQLite, ship on PostgreSQL.

The getting-started guide takes four commands and no Docker. The tutorial grows the same schema through relationships, transactions, tenancy, migrations, and extensions.