Type-Safe PostgreSQL ORM & Desktop Studio for Rust
Define your schema once. Generate strictly typed, compile-time safe Rust queries. Ship with transactional migrations and a native cross-platform Desktop Studio.
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
struct User {
id Int32 @id @default(autoincrement())
email String @unique
name String
active Boolean @default(true)
createdAt DateTime @default(now()) @map("created_at")
posts Post[]
}
struct Post {
id Int32 @id @default(autoincrement())
title String
content String?
userId Int32 @map("user_id")
user User @relation(fields: [userId], references: [id])
}
mod liteorm;
use lite_orm::{Database, Model};
use liteorm::{User, Post};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let db = Database::connect_env().await?;
// Type-safe SELECT with parameterized WHERE
let active_users = db
.all(User::select()
.where_(User::ACTIVE.equals(true))
.limit(20))
.await?;
// Safe deletion guarded against unconstrained drops
db.delete(Post::delete().where_(Post::USER_ID.equals(12))).await?;
Ok(())
}
-- Transactional, idempotent PostgreSQL migration
BEGIN;
CREATE TABLE "User" (
"id" SERIAL PRIMARY KEY,
"email" TEXT NOT NULL UNIQUE,
"name" TEXT NOT NULL,
"active" BOOLEAN NOT NULL DEFAULT true,
"created_at" TIMESTAMPTZ NOT NULL DEFAULT now()
);
CREATE TABLE "Post" (
"id" SERIAL PRIMARY KEY,
"title" TEXT NOT NULL,
"content" TEXT,
"user_id" INTEGER NOT NULL REFERENCES "User"("id")
);
COMMIT;
Engineered for Rust Reliability
Prisma's developer ergonomics fused with Rust's uncompromising safety and performance.
Guarded Mutations
Destructive mutations like UPDATE and DELETE strictly require filter predicates or an explicit override, preventing accidental database wipes.
Atomic Migrations
Every generated migration and its audit log execute inside a single PostgreSQL transaction with schema-scoped session advisory locks for zero race conditions.
Native Studio
100% native desktop management app built with Dioxus Desktop. No web server, zero JS bloat, and instantaneous live relation inspections.
Bi-Directional Sync
Run liteorm db pull to reverse-engineer existing PostgreSQL tables, native ENUMs, and array types into schemas, or liteorm db push to apply additive changes instantly.
Safe Parameterization
All query values use PostgreSQL bound parameters and never string concatenation. Full support for platform TLS via rustls.
Monochrome Precision
Distraction-free high-contrast duo-tone interface strictly built with #FFFEFA and #000000. Pure, focused, and crisp.
LiteORM Desktop Studio
Inspect, filter, and create database records natively on macOS, Linux, and Windows with real-time row counts and responsive data tables.
| ID | NAME | ACTIVE | RELATIONS | |
|---|---|---|---|---|
1 |
alice@liteorm.dev | Alice Vance | true | 3 Post |
2 |
bob@liteorm.dev | Bob Smith | true | 1 Post |
3 |
charlie@liteorm.dev | Charlie Brown | false | 0 Post |
Get Started in Seconds
Follow the standard schema-first workflow from zero to production.
Install CLI & Desktop Studio
Install the liteorm command-line tools and native Desktop Studio application globally via Cargo.
Initialize project and schema
Generate a starter liteorm.schema and .env file, or introspect an existing database.
liteorm db pull # Or reverse-engineer existing PostgreSQL database
Sync and Migrate with PostgreSQL
Directly push additive changes during prototyping, or generate versioned transactional migrations.
liteorm migrate dev # Versioned transactional migration
Generate Rust models and launch Studio
Compile schema definitions into strictly typed Rust structs and launch the cross-platform desktop UI.
liteorm studio # Launches native Desktop Studio