{"id":35066649,"url":"https://github.com/pegasusheavy/prax","last_synced_at":"2026-01-20T16:52:14.526Z","repository":{"id":329636820,"uuid":"1117825629","full_name":"pegasusheavy/prax","owner":"pegasusheavy","description":"🦀 Type-safe, async-first ORM for Rust. Prisma-like schema, fluent queries, multi-database support.","archived":false,"fork":false,"pushed_at":"2025-12-21T18:04:03.000Z","size":4127,"stargazers_count":0,"open_issues_count":25,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-22T20:44:06.144Z","etag":null,"topics":["async","database","mongodb","mysql","orm","postgres","postgresql","prisma","query-builder","rust","sql","sqlite","tokio","type-safe","typescript-alternative"],"latest_commit_sha":null,"homepage":"https://docs.rs/prax","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pegasusheavy.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["pegasusheavy"]}},"created_at":"2025-12-16T21:47:07.000Z","updated_at":"2025-12-21T17:30:31.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/pegasusheavy/prax","commit_stats":null,"previous_names":["pegasusheavy/prax"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/pegasusheavy/prax","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pegasusheavy%2Fprax","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pegasusheavy%2Fprax/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pegasusheavy%2Fprax/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pegasusheavy%2Fprax/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pegasusheavy","download_url":"https://codeload.github.com/pegasusheavy/prax/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pegasusheavy%2Fprax/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28078028,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-27T02:00:05.897Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async","database","mongodb","mysql","orm","postgres","postgresql","prisma","query-builder","rust","sql","sqlite","tokio","type-safe","typescript-alternative"],"created_at":"2025-12-27T11:31:32.106Z","updated_at":"2026-01-20T16:52:14.520Z","avatar_url":"https://github.com/pegasusheavy.png","language":"Rust","funding_links":["https://github.com/sponsors/pegasusheavy"],"categories":[],"sub_categories":[],"readme":"# Prax ORM\n\n\u003cp align=\"center\"\u003e\n  \u003cstrong\u003eA next-generation, type-safe ORM for Rust\u003c/strong\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://crates.io/crates/prax-orm\"\u003e\u003cimg src=\"https://img.shields.io/crates/v/prax-orm.svg\" alt=\"crates.io\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://docs.rs/prax-orm\"\u003e\u003cimg src=\"https://docs.rs/prax-orm/badge.svg\" alt=\"docs.rs\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/pegasusheavy/prax-orm/actions\"\u003e\u003cimg src=\"https://github.com/pegasusheavy/prax-orm/workflows/CI/badge.svg\" alt=\"CI\"\u003e\u003c/a\u003e\n  \u003cimg src=\"https://img.shields.io/badge/rust-1.85%2B-blue.svg\" alt=\"Rust 1.85+\"\u003e\n  \u003ca href=\"#license\"\u003e\u003cimg src=\"https://img.shields.io/badge/license-MIT%2FApache--2.0-blue.svg\" alt=\"License\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"#features\"\u003eFeatures\u003c/a\u003e •\n  \u003ca href=\"#installation\"\u003eInstallation\u003c/a\u003e •\n  \u003ca href=\"#quick-start\"\u003eQuick Start\u003c/a\u003e •\n  \u003ca href=\"#documentation\"\u003eDocumentation\u003c/a\u003e •\n  \u003ca href=\"#license\"\u003eLicense\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n**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.\n\n\u003e ⚠️ **Work in Progress** - Prax is currently under active development. See [TODO.md](./TODO.md) for the implementation roadmap.\n\n## Features\n\n- 🔒 **Type-Safe Queries** - Compile-time checked queries with zero runtime overhead\n- ⚡ **Async-First** - Built on Tokio for high-performance async I/O\n- 🎯 **Fluent API** - Intuitive query builder with method chaining\n- 🔗 **Relations** - Eager and lazy loading with `include` and `select`\n- 📦 **Migrations** - Schema diffing, SQL generation, and migration tracking\n- 🛠️ **Code Generation** - Proc-macros for compile-time model generation\n- 🗄️ **Multi-Database** - PostgreSQL, MySQL, and SQLite support\n- 🔌 **Framework Integration** - First-class support for [Armature](https://github.com/pegasusheavy/armature), Axum, and Actix-web\n\n## Installation\n\nAdd Prax ORM to your `Cargo.toml`:\n\n```toml\n[dependencies]\nprax-orm = \"0.3\"\ntokio = { version = \"1\", features = [\"full\"] }\n```\n\nFor specific database backends:\n\n```toml\n# PostgreSQL (default)\nprax-orm = { version = \"0.3\", features = [\"postgres\"] }\n\n# MySQL\nprax-orm = { version = \"0.3\", features = [\"mysql\"] }\n\n# SQLite\nprax-orm = { version = \"0.3\", features = [\"sqlite\"] }\n\n# DuckDB (analytics)\nprax-orm = { version = \"0.3\", features = [\"duckdb\"] }\n\n# ScyllaDB (high-performance Cassandra-compatible)\nprax-scylladb = \"0.3\"\n\n# Armature framework integration\nprax-armature = \"0.3\"\n```\n\n## Quick Start\n\n### Define Your Models\n\n```rust\nuse prax::prelude::*;\n\n#[derive(Model)]\n#[prax(table = \"users\")]\npub struct User {\n    #[prax(id, auto_increment)]\n    pub id: i32,\n\n    #[prax(unique)]\n    pub email: String,\n\n    pub name: Option\u003cString\u003e,\n\n    #[prax(default = \"now()\")]\n    pub created_at: DateTime\u003cUtc\u003e,\n\n    #[prax(relation(has_many))]\n    pub posts: Vec\u003cPost\u003e,\n}\n\n#[derive(Model)]\n#[prax(table = \"posts\")]\npub struct Post {\n    #[prax(id, auto_increment)]\n    pub id: i32,\n\n    pub title: String,\n\n    pub content: String,\n\n    #[prax(relation(belongs_to))]\n    pub author: User,\n\n    pub author_id: i32,\n}\n```\n\n### Connect and Query\n\n```rust\nuse prax::prelude::*;\n\n#[tokio::main]\nasync fn main() -\u003e Result\u003c(), prax::Error\u003e {\n    // Connect to database\n    let client = PraxClient::new(\"postgresql://localhost/mydb\").await?;\n\n    // Find many with filtering and relations\n    let users = client\n        .user()\n        .find_many()\n        .where(user::email::contains(\"@example.com\"))\n        .include(user::posts::fetch())\n        .order_by(user::created_at::desc())\n        .take(10)\n        .exec()\n        .await?;\n\n    // Create a new user\n    let user = client\n        .user()\n        .create(user::Create {\n            email: \"hello@example.com\".into(),\n            name: Some(\"Alice\".into()),\n            ..Default::default()\n        })\n        .exec()\n        .await?;\n\n    // Update with filtering\n    let updated = client\n        .user()\n        .update_many()\n        .where(user::created_at::lt(Utc::now() - Duration::days(30)))\n        .data(user::Update {\n            name: Some(\"Inactive User\".into()),\n            ..Default::default()\n        })\n        .exec()\n        .await?;\n\n    // Transactions\n    client\n        .transaction(|tx| async move {\n            let user = tx.user().create(/* ... */).exec().await?;\n            tx.post().create(/* ... */).exec().await?;\n            Ok(())\n        })\n        .await?;\n\n    Ok(())\n}\n```\n\n### Armature Framework Integration\n\nPrax integrates seamlessly with [Armature](https://github.com/pegasusheavy/armature), providing dependency injection support:\n\n```rust\nuse armature::prelude::*;\nuse prax_armature::PraxModule;\n\n#[module_impl]\nimpl DatabaseModule {\n    #[provider(singleton)]\n    async fn prax_client() -\u003e Arc\u003cPraxClient\u003e {\n        Arc::new(\n            PraxClient::new(\"postgresql://localhost/mydb\")\n                .await\n                .expect(\"Database connection failed\")\n        )\n    }\n}\n\n#[controller(\"/users\")]\nimpl UserController {\n    #[get(\"/\")]\n    async fn list(\n        \u0026self,\n        #[inject] db: Arc\u003cPraxClient\u003e,\n    ) -\u003e Result\u003cJson\u003cVec\u003cUser\u003e\u003e, HttpError\u003e {\n        let users = db.user().find_many().exec().await?;\n        Ok(Json(users))\n    }\n}\n```\n\n## Query Operations\n\n### Filtering\n\n```rust\n// Equals\nuser::email::equals(\"alice@example.com\")\n\n// Contains, starts with, ends with\nuser::name::contains(\"alice\")\nuser::email::starts_with(\"admin\")\nuser::email::ends_with(\"@company.com\")\n\n// Comparisons\nuser::age::gt(18)\nuser::age::gte(21)\nuser::age::lt(65)\nuser::created_at::lte(Utc::now())\n\n// Logical operators\nand![\n    user::age::gte(18),\n    user::status::equals(\"active\")\n]\n\nor![\n    user::role::equals(\"admin\"),\n    user::role::equals(\"moderator\")\n]\n\nnot!(user::banned::equals(true))\n\n// Nested relation filters\nuser::posts::some(post::published::equals(true))\n```\n\n### Pagination\n\n```rust\n// Offset-based\nclient.user().find_many().skip(20).take(10).exec().await?;\n\n// Cursor-based\nclient.user().find_many().cursor(user::id::equals(100)).take(10).exec().await?;\n```\n\n### Aggregations\n\n```rust\nlet count = client.user().count().exec().await?;\n\nlet stats = client\n    .post()\n    .aggregate()\n    .count()\n    .avg(post::views)\n    .sum(post::likes)\n    .exec()\n    .await?;\n\nlet grouped = client\n    .user()\n    .group_by(user::country)\n    .count()\n    .exec()\n    .await?;\n```\n\n## Architecture\n\nPrax ORM is organized as a workspace of focused crates:\n\n```\nprax-orm/\n├── prax-schema/         # Schema parser and AST\n├── prax-codegen/        # Proc-macro crate for code generation\n├── prax-query/          # Query builder implementation\n├── prax-postgres/       # PostgreSQL (tokio-postgres) engine\n├── prax-mysql/          # MySQL (mysql_async) engine\n├── prax-sqlite/         # SQLite (rusqlite) engine\n├── prax-duckdb/         # DuckDB analytical engine\n├── prax-scylladb/       # ScyllaDB (Cassandra-compatible) engine\n├── prax-migrate/        # Migration engine\n├── prax-cli/            # CLI tool (prax-orm-cli)\n├── prax-armature/       # Armature framework integration\n├── prax-axum/           # Axum framework integration\n├── prax-actix/          # Actix-web framework integration\n└── src/                 # Main crate (prax-orm) re-exporting everything\n```\n\n## CLI\n\nPrax ORM includes a CLI for schema management and migrations:\n\n```bash\n# Install the CLI\ncargo install prax-orm-cli\n\n# Initialize a new Prax project\nprax init\n\n# Generate client from schema\nprax generate\n\n# Create a migration\nprax migrate dev --name add_users_table\n\n# Apply migrations\nprax migrate deploy\n\n# Reset database\nprax migrate reset\n\n# Introspect existing database\nprax db pull\n```\n\n## Comparison\n\n| Feature | Prax ORM | Diesel | SeaORM | SQLx |\n|---------|----------|--------|--------|------|\n| Async Support | ✅ | ❌ | ✅ | ✅ |\n| Type-Safe Queries | ✅ | ✅ | ✅ | ✅ |\n| Schema DSL | ✅ | ❌ | ❌ | ❌ |\n| Migrations | ✅ | ✅ | ✅ | ✅ |\n| Relations | ✅ | ✅ | ✅ | ❌ |\n| Code Generation | ✅ | ❌ | ✅ | ❌ |\n| Fluent API | ✅ | ❌ | ✅ | ❌ |\n| Multi-Tenancy | ✅ | ❌ | ❌ | ❌ |\n| Built-in Caching | ✅ | ❌ | ❌ | ❌ |\n| DuckDB Support | ✅ | ❌ | ❌ | ❌ |\n| ScyllaDB Support | ✅ | ❌ | ❌ | ❌ |\n\n## Contributing\n\nContributions are welcome! Please read the contributing guidelines before submitting a pull request.\n\n## License\n\nLicensed under either of:\n\n- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n\nCopyright (c) 2025 Pegasus Heavy Industries LLC\n\n## Acknowledgments\n\nPrax ORM is heavily inspired by:\n\n- **[Prisma](https://www.prisma.io/)** - For pioneering the modern ORM developer experience\n- **[Diesel](https://diesel.rs/)** - For proving type-safe database access in Rust is possible\n- **[SeaORM](https://www.sea-ql.org/SeaORM/)** - For async ORM patterns in Rust\n- **[Armature](https://github.com/pegasusheavy/armature)** - Our companion HTTP framework\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpegasusheavy%2Fprax","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpegasusheavy%2Fprax","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpegasusheavy%2Fprax/lists"}