Zyvor
Define your database once. Get type-safe Rust for free.
Zyvor is a schema-driven ORM for Rust. You write a .zyvor schema file, and the
CLI generates readable Rust — models, entities, typed fields, relations, and
CRUD input types. No derive macros to learn, no hidden magic.
The workflow
schema.zyvor → zyvor CLI → generated Rust → your app → PostgreSQL
You never hand-write a model struct, a column list, or a CREATE TABLE again.
What you get
- Typed fields —
User::age.gte(18)instead of"age >= ?" - Relations — 1:N, N:1, 1:1, M:M with eager loading, including nested
- Migrations — generated, checksum-tracked, auto-numbered, auto-applied
- Readable output — every generated file is plain Rust you can open and inspect
Two crates, one workflow
| Crate | What it does | How to get it |
|---|---|---|
zyvor | Runtime: query builder, CRUD, relations | cargo add zyvor |
zyvor-cli | Toolchain: parser, generator, migrations | cargo install zyvor-cli |
The CLI generates code for the runtime. It doesn’t reimplement it. Your app
depends on zyvor; the CLI is a build-time tool you install once.
A taste
model User {
id Int @id @default(autoincrement())
name String
email String @unique
posts Post[]
}
#![allow(unused)]
fn main() {
let users = User::find()
.with(User::posts)
.where_(User::name.eq("Ali Khan"))
.all(&pool)
.await?;
for user in &users {
println!("{} has {} posts", user.name, user.posts.len());
}
}
That’s a real join-free eager load: one query for users, one for their posts. No N+1.
Current scope (v0.1)
Being honest about what works is a feature, not a weakness.
Working and tested: PostgreSQL, CRUD + bulk operations, transactions, all four relation shapes, 2-level nested eager loading, migration generation with diffing and tracking, automatic database creation, Axum integration.
Not yet: SQLite/MySQL, rollbacks, comparison operators on Boolean /
DateTime / nullable fields, multi-column ORDER BY, CTE / UNION.
The full list lives in Known Limitations. Read it before you commit — it’s short and it will save you an afternoon.
Where to go next
- Installation — two commands and one version rule that matters
- Quick Start — empty folder to working database in five commands