---
import DocsLayout from '../layouts/DocsLayout.astro';
import CodeBlock from '../components/CodeBlock.astro';
import { githubUrl, githubIcon } from '../nav';
const schemaCode = `model User {
id Int @id @auto
email String @unique
name String?
posts Post[]
profile Profile?
createdAt DateTime @default(now())
}
model Post {
id Int @id @auto
title String
content String?
published Boolean @default(false)
author User @relation(fields: [authorId], references: [id])
authorId Int
}`;
const queryCode = `use prax::prelude::*;
#[tokio::main]
async fn main() -> Result<()> {
let client = PraxClient::new().await?;
// Find all published posts with their authors
let posts = client
.post()
.find_many()
.where(post::published::equals(true))
.include(post::author::fetch())
.order_by(post::created_at::desc())
.exec()
.await?;
for post in posts {
println!("{} by {}", post.title, post.author.name);
}
Ok(())
}`;
const createExample = `use prax_query::{data, connect};
// Create a user with nested posts
let user = client
.user()
.create(data! {
email: "alice@example.com",
name: "Alice",
posts: vec![
data! { title: "Hello World", content: "My first post!" },
data! { title: "Rust is Awesome", published: true },
],
})
.exec()
.await?;`;
const filterExample = `// Complex filtering with AND, OR, NOT
let users = client
.user()
.find_many()
.where(user::AND(vec![
user::email::ends_with("@example.com"),
user::OR(vec![
user::name::contains("Admin"),
user::posts::some(post::published::equals(true)),
]),
]))
.skip(10)
.take(20)
.exec()
.await?;`;
const installCode = `[dependencies]
prax-orm = "0.11"
tokio = { version = "1", features = ["full"] }`;
---
<DocsLayout>
<div class="min-h-screen">
<!-- Hero Section -->
<section class="relative overflow-hidden">
<div class="absolute inset-0 bg-gradient-to-br from-primary-900/20 via-background to-background"></div>
<div class="relative max-w-6xl mx-auto px-6 py-24 lg:py-32">
<div class="text-center">
<div class="flex flex-wrap gap-2 justify-center mb-8">
<div class="inline-flex items-center gap-2 px-4 py-2 rounded-full bg-primary-500/10 text-primary-400 text-sm font-medium">
<svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24">
<path d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"></path>
</svg>
Built for Rust • Inspired by Prisma
</div>
<div class="inline-flex items-center gap-2 px-4 py-2 rounded-full bg-success-500/10 text-success-400 text-sm font-medium">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"></path>
</svg>
3x faster than Diesel for simple filters
</div>
</div>
<h1 class="text-5xl lg:text-7xl font-bold mb-6 bg-gradient-to-r from-primary-400 via-primary-300 to-accent-400 bg-clip-text text-transparent">
Prax ORM
</h1>
<p class="text-xl lg:text-2xl text-muted max-w-3xl mx-auto mb-12">
A next-generation, type-safe ORM for Rust with a beautiful schema language,
powerful query builder, and first-class async support.
</p>
<div class="flex flex-col sm:flex-row gap-4 justify-center">
<a href="/quickstart"
class="inline-flex items-center gap-2 px-8 py-4 bg-primary-600 hover:bg-primary-500 text-white font-semibold rounded-xl transition-colors">
Get Started
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7l5 5m0 0l-5 5m5-5H6"></path>
</svg>
</a>
<a href={githubUrl} target="_blank"
class="inline-flex items-center gap-2 px-8 py-4 bg-surface-elevated hover:bg-surface border border-border text-foreground font-semibold rounded-xl transition-colors">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24">
<path d={githubIcon}></path>
</svg>
View on GitHub
</a>
</div>
</div>
</div>
</section>
<!-- Code Preview -->
<section class="max-w-6xl mx-auto px-6 -mt-8">
<div class="grid lg:grid-cols-2 gap-6">
<div>
<h3 class="text-sm font-semibold text-muted uppercase tracking-wider mb-3">Schema Definition</h3>
<CodeBlock code={schemaCode} lang="prax" filename="prax/schema.prax" />
</div>
<div>
<h3 class="text-sm font-semibold text-muted uppercase tracking-wider mb-3">Type-Safe Queries</h3>
<CodeBlock code={queryCode} lang="rust" filename="main.rs" />
</div>
</div>
</section>
<!-- Features -->
<section class="max-w-6xl mx-auto px-6 py-24">
<div class="text-center mb-16">
<h2 class="text-3xl lg:text-4xl font-bold mb-4">Why Prax?</h2>
<p class="text-lg text-muted max-w-2xl mx-auto">
Everything you need to build robust, scalable database applications in Rust.
</p>
</div>
<div class="grid md:grid-cols-2 lg:grid-cols-3 gap-8">
<!-- Feature 1 -->
<div class="p-6 rounded-2xl bg-surface border border-border hover:border-primary-500/50 transition-colors">
<div class="w-12 h-12 rounded-xl bg-primary-500/10 flex items-center justify-center mb-4">
<svg class="w-6 h-6 text-primary-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"></path>
</svg>
</div>
<h3 class="text-xl font-semibold mb-2">Type Safety</h3>
<p class="text-muted">
Catch errors at compile time with fully typed queries. No runtime surprises.
</p>
</div>
<!-- Feature 2 -->
<div class="p-6 rounded-2xl bg-surface border border-border hover:border-primary-500/50 transition-colors">
<div class="w-12 h-12 rounded-xl bg-success-500/10 flex items-center justify-center mb-4">
<svg class="w-6 h-6 text-success-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"></path>
</svg>
</div>
<h3 class="text-xl font-semibold mb-2">Blazing Fast</h3>
<p class="text-muted">
1.7ns filter creation, 64-byte cache-friendly layout. 6x faster than Diesel for SQL building.
</p>
</div>
<!-- Feature 3 -->
<div class="p-6 rounded-2xl bg-surface border border-border hover:border-primary-500/50 transition-colors">
<div class="w-12 h-12 rounded-xl bg-accent-500/10 flex items-center justify-center mb-4">
<svg class="w-6 h-6 text-accent-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4"></path>
</svg>
</div>
<h3 class="text-xl font-semibold mb-2">Multi-Database</h3>
<p class="text-muted">
PostgreSQL, MySQL, SQLite, MongoDB, MSSQL, and DuckDB support.
</p>
</div>
<!-- Feature 4 -->
<div class="p-6 rounded-2xl bg-surface border border-border hover:border-primary-500/50 transition-colors">
<div class="w-12 h-12 rounded-xl bg-warning-500/10 flex items-center justify-center mb-4">
<svg class="w-6 h-6 text-warning-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"></path>
</svg>
</div>
<h3 class="text-xl font-semibold mb-2">Beautiful Schema</h3>
<p class="text-muted">
Intuitive schema language inspired by Prisma. Easy to read and write.
</p>
</div>
<!-- Feature 5 -->
<div class="p-6 rounded-2xl bg-surface border border-border hover:border-primary-500/50 transition-colors">
<div class="w-12 h-12 rounded-xl bg-error-500/10 flex items-center justify-center mb-4">
<svg class="w-6 h-6 text-error-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"></path>
</svg>
</div>
<h3 class="text-xl font-semibold mb-2">Migrations</h3>
<p class="text-muted">
Automatic schema diffing and migration generation. No manual SQL required.
</p>
</div>
<!-- Feature 6 -->
<div class="p-6 rounded-2xl bg-surface border border-border hover:border-primary-500/50 transition-colors">
<div class="w-12 h-12 rounded-xl bg-info-500/10 flex items-center justify-center mb-4">
<svg class="w-6 h-6 text-info-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4"></path>
</svg>
</div>
<h3 class="text-xl font-semibold mb-2">Raw SQL Escape</h3>
<p class="text-muted">
Full control when you need it with type-safe raw SQL queries.
</p>
</div>
<!-- Feature 7 -->
<div class="p-6 rounded-2xl bg-surface border border-border hover:border-primary-500/50 transition-colors">
<div class="w-12 h-12 rounded-xl bg-purple-500/10 flex items-center justify-center mb-4">
<svg class="w-6 h-6 text-purple-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4"></path>
</svg>
</div>
<h3 class="text-xl font-semibold mb-2">Multi-Tenancy</h3>
<p class="text-muted">
Zero-allocation tenant context, RLS integration, and sharded caching.
</p>
</div>
<!-- Feature 8 -->
<div class="p-6 rounded-2xl bg-surface border border-border hover:border-primary-500/50 transition-colors">
<div class="w-12 h-12 rounded-xl bg-cyan-500/10 flex items-center justify-center mb-4">
<svg class="w-6 h-6 text-cyan-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8m-9 4h4"></path>
</svg>
</div>
<h3 class="text-xl font-semibold mb-2">Data Caching</h3>
<p class="text-muted">
In-memory LRU cache, Redis support, and tiered L1/L2 caching.
</p>
</div>
<!-- Feature 9 -->
<div class="p-6 rounded-2xl bg-surface border border-border hover:border-primary-500/50 transition-colors">
<div class="w-12 h-12 rounded-xl bg-orange-500/10 flex items-center justify-center mb-4">
<svg class="w-6 h-6 text-orange-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 17v-2m3 2v-4m3 4v-6m2 10H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"></path>
</svg>
</div>
<h3 class="text-xl font-semibold mb-2">Memory Profiling</h3>
<p class="text-muted">
Allocation tracking, leak detection, and CI integration.
</p>
</div>
</div>
</section>
<!-- Quick Example -->
<section class="bg-surface border-y border-border">
<div class="max-w-6xl mx-auto px-6 py-24">
<div class="text-center mb-16">
<h2 class="text-3xl lg:text-4xl font-bold mb-4">Simple Yet Powerful</h2>
<p class="text-lg text-muted max-w-2xl mx-auto">
From simple CRUD to complex queries with relations, Prax has you covered.
</p>
</div>
<div class="space-y-8">
<div>
<h3 class="text-lg font-semibold mb-4">Create with Relations</h3>
<CodeBlock code={createExample} lang="rust" />
</div>
<div>
<h3 class="text-lg font-semibold mb-4">Query with Filters</h3>
<CodeBlock code={filterExample} lang="rust" />
</div>
</div>
</div>
</section>
<!-- CTA -->
<section class="max-w-6xl mx-auto px-6 py-24 text-center">
<h2 class="text-3xl lg:text-4xl font-bold mb-4">Ready to Get Started?</h2>
<p class="text-lg text-muted max-w-2xl mx-auto mb-8">
Add Prax to your Rust project and start building type-safe database applications today.
</p>
<CodeBlock code={installCode} lang="toml" filename="Cargo.toml" />
<div class="mt-8">
<a href="/quickstart"
class="inline-flex items-center gap-2 px-8 py-4 bg-primary-600 hover:bg-primary-500 text-white font-semibold rounded-xl transition-colors">
Read the Docs
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7l5 5m0 0l-5 5m5-5H6"></path>
</svg>
</a>
</div>
</section>
<!-- Footer -->
<footer class="border-t border-border bg-surface">
<div class="max-w-6xl mx-auto px-6 py-12">
<div class="flex flex-col md:flex-row justify-between items-center gap-4">
<div class="flex items-center gap-3">
<div class="w-8 h-8 bg-gradient-to-br from-primary-500 to-primary-700 rounded-lg flex items-center justify-center">
<span class="text-white font-bold">P</span>
</div>
<span class="font-semibold">Prax ORM</span>
</div>
<p class="text-sm text-muted">
Built with 🦀 by <a href="https://pegasusheavy.com" class="text-primary-400 hover:underline">Pegasus Heavy Industries</a>
</p>
<div class="flex items-center gap-4">
<a href={githubUrl} target="_blank" class="text-muted hover:text-foreground transition-colors">
<svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24">
<path d={githubIcon}></path>
</svg>
</a>
</div>
</div>
</div>
</footer>
</div>
</DocsLayout>