ruprizzle
A schema-first ORM for Rust that combines the best parts of Prisma and Drizzle:
- Prisma's declarative schema as the single source of truth, with a generated typed client, automatic migration diffing, and nested relation loading.
- Drizzle's SQL transparency — no hidden query engine, no sidecar binary, and
.to_sql()on every builder so you always know what is being sent to the database.
PostgreSQL, MySQL/MariaDB, and SQLite 3+ are supported behind a dialect trait, so more
backends are additive. Built on sqlx for
the wire protocol and pooling; we do not write a driver. Native driver features
are also available: sqlite-rusqlite for synchronous SQLite and an experimental
postgres-tokio-postgres for PostgreSQL.
Status
The current published version is 1.5.1 — the first stable release, live on
crates.io since 2026-09-13 for every crate in the workspace, including
ruprizzle-turso and ruprizzle-d1. Run scripts/check-release-state.sh to
confirm this against the registry rather than taking this page's word for it.
1.0.0, 1.0.1 and 1.5.0 are git tags, not releases: their publish runs
failed before uploading, so the tags are kept as evidence of the attempts rather
than moved. 1.0.0-rc.1 remains on crates.io as the previous published version.
Upgrading from 1.0.0-rc.1? Most applications need no code changes. See
Upgrading from 1.0.0-rc.1 to 1.5.1, and pin
"=1.0.0-rc.1" until you are ready, because "1.0.0-rc.1" also matches 1.6.0.
The core P0–P8 implementation is complete and MySQL/MariaDB support is shipped.
The public API is covered by semantic versioning from 1.5.1 onward.
The v1.1–v1.5 feature line shipped as 1.5.1 — array
filters, full-text search, soft deletes, offline query checking, nested writes,
tree hierarchies, OpenTelemetry, read-replica routing, query caching, PostGIS and
Ruprizzle Studio. See What's new in v1.1–v1.5. The current
release is 1.6.0: Studio authentication, with_deleted() on hierarchies, background
replica health checks and the K11 rename fix — see What's new in 1.6.
Known gap: the Turso/D1 live smoke tests have not yet been run against the hosted services.
Two things were waived on the way here, both in writing rather than by omission:
the W4-02 48-hour rusqlite soak, accepted on 15.56 h / 1.46 B ops / 0 errors
(see SoakReport.md), and the two-week RC feedback window, because
no external consumer existed to provide the feedback (see
Stability).
See Stability for the semver policy and the public-dependency list
— notably, the 1.0 line is pinned to sqlx 0.8 — and
Known limitations for deliberate boundaries.
Quick example
// schema.ruprizzle
datasource db {
provider = "postgres"
url = env("DATABASE_URL")
}
generator client {
output = "src/db"
module_name = "db"
}
model User {
id Uuid @id @default(uuid7())
email String @unique
posts Post[]
createdAt DateTime @default(now()) @map("created_at")
@@map("users")
}
model Post {
id Uuid @id @default(uuid7())
title String
authorId Uuid @map("author_id")
author User @relation(fields: [authorId], references: [id], onDelete: Cascade)
@@map("posts")
}
#![allow(unused)] fn main() { // Drizzle flavour: the call shape mirrors the SQL. let admins = db .user() .find_many() .filter(user::EMAIL.ends_with("@acme.com")) .order_by(user::CREATED_AT.desc()) .limit(20) .fetch_all() .await?; // Prisma flavour: relation-aware, one query per level — never N+1. let users = db .user() .find_many() .include(user::posts().filter(post::PUBLISHED.eq(true)).take(5)) .fetch_all() .await?; }
Wrong-typed and cross-model filters are compile errors, not runtime ones:
#![allow(unused)] fn main() { user::EMAIL.eq(42) // error: expected String, found i32 db.post().find_many().filter(user::EMAIL.eq("")) // error: expected Filter<Post>, found Filter<User> }
Install
cargo install ruprizzle-cli # the `ruprizzle` command
cargo add ruprizzle # the runtime crate your app uses
In a new or existing project:
ruprizzle init --provider postgres
# Edit schema.ruprizzle, then:
ruprizzle migrate dev --name init
Add the generated module to src/lib.rs or src/main.rs:
#![allow(unused)] fn main() { mod db; }
Workflow
| Step | Command |
|---|---|
| Scaffold a project | ruprizzle init --provider postgres|postgresql|sqlite|mysql|mariadb |
| Generate the client | ruprizzle generate |
| Auto-watch in dev | ruprizzle generate --watch |
| Create & apply a migration | ruprizzle migrate dev --name <name> |
| Apply migrations in CI/prod | ruprizzle migrate deploy |
| Check migration status | ruprizzle migrate status |
| Mark a migration applied | ruprizzle migrate resolve <id> |
| Reset and replay migrations | ruprizzle migrate reset --force |
| Squash migration history | ruprizzle migrate squash --force |
| Validate for CI | ruprizzle validate |
| Canonicalise schema | ruprizzle format |
| Introspect an existing database | ruprizzle db pull |
| Seed fixture data | ruprizzle db seed |
| Prototype schema push | ruprizzle db push |
| Run the language server | ruprizzle lsp |
| Offline query check | ruprizzle check --manifest <path> |
migrate dev and migrate deploy are deliberately separate: the production
command never diffs or writes migration files, so habit cannot carry a dangerous
prototyping invocation into CI.
Why another Rust ORM?
| Feature | ruprizzle | Diesel | SeaORM | sqlx | prax | Prisma | Drizzle |
|---|---|---|---|---|---|---|---|
| Schema-first code generation | ✅ | partial | ❌ | ❌ | ✅ | ✅ | ❌ |
Type-safe nested include | ✅ | ❌ | partial | ❌ | ✅ | ✅ | ✅ |
| SQL-first query API | ✅ | ❌ | ❌ | ✅ | partial | partial | ✅ |
| Migrations from schema diff | ✅ | ❌ | partial | ❌ | ✅ | ✅ | partial |
| Compile-time query checking | ✅ | ✅ | ❌ | ✅ | ✅ | N/A | ❌ |
Native driver backends (no sqlx::Any) | ✅ | ✅ | ❌ | N/A | ✅ | ❌ | ❌ |
| Advanced SQL (CTEs, subqueries, set ops) | ✅ | partial | partial | ✅ | partial | partial | partial |
The trade-off is intentional: ruprizzle targets teams that want a single source of truth in the schema file, compile-time type safety across relations, and the ability to drop down to raw SQL without leaving the query builder.
Repository layout
| Crate | Role | Phase |
|---|---|---|
crates/core | IR, spans, diagnostics | ✅ P0 |
crates/parser | Schema DSL → validated IR | ✅ P1 |
crates/dialect | DbDialect trait, Postgres + MySQL + SQLite | ✅ P2 |
crates/codegen | IR → Rust source | ✅ P3 |
crates/runtime | ruprizzle, the crate your app depends on | ✅ P4 |
crates/migrate | Snapshot, diff, plan, apply | ✅ P6 |
crates/cli | The ruprizzle binary | ✅ P7 |
crates/lsp | Language server for schema.ruprizzle | ✅ P8 |
crates/check | Offline / compile-time query checking | ✅ P8 |
crates/testkit | Dual-database test harness | ✅ P0 |