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
Schema-first, one source of truth
Define models, relationships, indexes, policies, and extensions in one RSL document. The Rust client and the database catalog are both derived from it, so they cannot drift apart.
A generated, type-safe async client
Every model gets create, query, update, delete, and upsert builders with compile-time checked fields, predicates, eager loading, cursors, and streaming on Tokio.
Migrations you can review
Rent diffs the schema against the live database, classifies each change as safe, review, or destructive, writes append-only SQL, and seals it with checksums.
Policies and tenancy in the data layer
Row policies, tenant scoping, hooks, and interceptors apply to reads, writes, bulk operations, and both ends of every relationship, and fail closed.
PostgreSQL extensions as typed packages
pgvector, PostGIS, pgmq, pg_cron, pg_net, TimescaleDB, pg_search, pg_trgm, citext, pgcrypto, uuid-ossp, pg_jsonschema, pg_partman, and pgAudit, declared in the schema and preflighted before deploy.
Transactions, locking, and retries
Closure transactions with savepoints, optimistic locking with version fields, row locks, isolation options, and retry policies for serialization failures.
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 runComing 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.