Prax ORM
Prax ORM is a modern, Prisma-inspired ORM for Rust with first-class async support. Built on top of tokio-postgres, sqlx, and other async database clients, Prax provides a type-safe, ergonomic API for database operations with compile-time guarantees.
⚠️ Work in Progress - Prax is currently under active development. See TODO.md for the implementation roadmap.
Features
- 🔒 Type-Safe Queries - Compile-time checked queries with zero runtime overhead
- ⚡ Async-First - Built on Tokio for high-performance async I/O
- 🎯 Fluent API - Intuitive query builder with method chaining
- 🔗 Relations - Eager and lazy loading with
includeandselect - 📦 Migrations - Schema diffing, SQL generation, and migration tracking
- 🛠️ Code Generation - Proc-macros for compile-time model generation
- 🗄️ Multi-Database - PostgreSQL, MySQL, and SQLite support
- 🔌 Framework Integration - First-class support for Armature, Axum, and Actix-web
Installation
Add Prax ORM to your Cargo.toml:
[]
= "0.3"
= { = "1", = ["full"] }
For specific database backends:
# PostgreSQL (default)
= { = "0.3", = ["postgres"] }
# MySQL
= { = "0.3", = ["mysql"] }
# SQLite
= { = "0.3", = ["sqlite"] }
# DuckDB (analytics)
= { = "0.3", = ["duckdb"] }
# ScyllaDB (high-performance Cassandra-compatible)
= "0.3"
# Armature framework integration
= "0.3"
Quick Start
Define Your Models
use *;
Connect and Query
use *;
async
Armature Framework Integration
Prax integrates seamlessly with Armature, providing dependency injection support:
use *;
use PraxModule;
Query Operations
Filtering
// Equals
equals
// Contains, starts with, ends with
contains
starts_with
ends_with
// Comparisons
gt
gte
lt
lte
// Logical operators
and!
or!
not!
// Nested relation filters
some
Pagination
// Offset-based
client.user.find_many.skip.take.exec.await?;
// Cursor-based
client.user.find_many.cursor.take.exec.await?;
Aggregations
let count = client.user.count.exec.await?;
let stats = client
.post
.aggregate
.count
.avg
.sum
.exec
.await?;
let grouped = client
.user
.group_by
.count
.exec
.await?;
Architecture
Prax ORM is organized as a workspace of focused crates:
prax-orm/
├── prax-schema/ # Schema parser and AST
├── prax-codegen/ # Proc-macro crate for code generation
├── prax-query/ # Query builder implementation
├── prax-postgres/ # PostgreSQL (tokio-postgres) engine
├── prax-mysql/ # MySQL (mysql_async) engine
├── prax-sqlite/ # SQLite (rusqlite) engine
├── prax-duckdb/ # DuckDB analytical engine
├── prax-scylladb/ # ScyllaDB (Cassandra-compatible) engine
├── prax-migrate/ # Migration engine
├── prax-cli/ # CLI tool (prax-orm-cli)
├── prax-armature/ # Armature framework integration
├── prax-axum/ # Axum framework integration
├── prax-actix/ # Actix-web framework integration
└── src/ # Main crate (prax-orm) re-exporting everything
CLI
Prax ORM includes a CLI for schema management and migrations:
# Install the CLI
# Initialize a new Prax project
# Generate client from schema
# Create a migration
# Apply migrations
# Reset database
# Introspect existing database
Comparison
| Feature | Prax ORM | Diesel | SeaORM | SQLx |
|---|---|---|---|---|
| Async Support | ✅ | ❌ | ✅ | ✅ |
| Type-Safe Queries | ✅ | ✅ | ✅ | ✅ |
| Schema DSL | ✅ | ❌ | ❌ | ❌ |
| Migrations | ✅ | ✅ | ✅ | ✅ |
| Relations | ✅ | ✅ | ✅ | ❌ |
| Code Generation | ✅ | ❌ | ✅ | ❌ |
| Fluent API | ✅ | ❌ | ✅ | ❌ |
| Multi-Tenancy | ✅ | ❌ | ❌ | ❌ |
| Built-in Caching | ✅ | ❌ | ❌ | ❌ |
| DuckDB Support | ✅ | ❌ | ❌ | ❌ |
| ScyllaDB Support | ✅ | ❌ | ❌ | ❌ |
Contributing
Contributions are welcome! Please read the contributing guidelines before submitting a pull request.
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Copyright (c) 2025 Pegasus Heavy Industries LLC
Acknowledgments
Prax ORM is heavily inspired by: