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, SQLite, MSSQL, MongoDB, DuckDB, ScyllaDB
- 🧠 Vector Search - pgvector integration for AI/ML embeddings and similarity search
- 🔌 Framework Integration - First-class support for Armature, Axum, and Actix-web
- 🏢 Multi-Tenancy - Row-level security, schema-based, and database-based isolation
- 📥 Schema Import - Migrate from Prisma, Diesel, or SeaORM
Installation
Add Prax ORM to your Cargo.toml:
[]
= "0.6"
= { = "1", = ["full"] }
For specific database backends:
# PostgreSQL (default)
= { = "0.6", = ["postgres"] }
# MySQL
= { = "0.6", = ["mysql"] }
# SQLite
= { = "0.6", = ["sqlite"] }
# MSSQL
= "0.6"
# MongoDB
= "0.6"
# DuckDB (analytics)
= "0.6"
# ScyllaDB (high-performance Cassandra-compatible)
= "0.6"
# pgvector (AI/ML vector search)
= "0.6"
# Armature framework integration
= "0.6"
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?;
Vector Similarity Search (pgvector)
use *;
// Create an embedding from your ML model output
let query = new;
// Find the 10 most similar documents
let search = new
.query
.metric
.limit
.build;
// Hybrid search: combine vector similarity with full-text search
let hybrid = new
.vector_column
.text_column
.query_vector
.query_text
.vector_weight
.text_weight
.limit
.build;
// Manage HNSW indexes
let index = hnsw
.metric
.config
.concurrent
.build?;
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 + optimizations
├── prax-postgres/ # PostgreSQL (tokio-postgres) engine
├── prax-mysql/ # MySQL (mysql_async) engine
├── prax-sqlite/ # SQLite (rusqlite) engine
├── prax-mssql/ # MSSQL (tiberius) engine
├── prax-mongodb/ # MongoDB engine
├── prax-duckdb/ # DuckDB analytical engine
├── prax-scylladb/ # ScyllaDB (Cassandra-compatible) engine
├── prax-pgvector/ # pgvector integration (embeddings, vector search)
├── prax-sqlx/ # SQLx backend with compile-time checks
├── prax-migrate/ # Migration engine
├── prax-import/ # Import from Prisma/Diesel/SeaORM
├── 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 | ✅ | ❌ | ❌ | ❌ |
| Vector Search (pgvector) | ✅ | ❌ | ❌ | ❌ |
| Schema Import | ✅ | ❌ | ❌ | ❌ |
| 7+ Database Backends | ✅ | ❌ | ❌ | ❌ |
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-2026 Pegasus Heavy Industries LLC
Acknowledgments
Prax ORM is heavily inspired by: