Rod

Rod v0.1.0

The Write-Once, Validate-Anywhere Schema Library.

Introduction

Rod is a high-performance, cross-platform schema validation library powered by Rust. It allows you to define validation logic once and run it consistently across your entire stack.

One Schema, Three Runtimes

In modern full-stack development, validation logic is often duplicated across languages. Rod moves that logic into a shared Rust Core, providing native speed and byte-level consistency.

// Direct native execution in your Axum/Actix backend
let schema = rod_obj! {
    email: string().email(),
    age: number().min(18.0)
};
// High-performance WASM in the Browser or Node.js
const schema = rod.object({
    email: rod.string().email(),
    age: rod.number().min(18)
});
// Native PyO3 extension for data pipelines/scripts
schema = rod.object({
    "email": rod.string().email(),
    "age": rod.number().min(18)
})

Why Rod?

  • Eliminate Schema Drift: Guarantee that your Frontend, Backend, and Data tools use the exact same validation rules.
  • Zero-Copy Core: Validates directly against host memory layouts (V8 Heap, Python Dicts, or Rust Structs).
  • Zod-Inspired API: Familiar fluent builder pattern for all developers.
  • Batch Optimization: Specialized APIs for massive datasets (100k+ items) that bypass language-boundary overhead.

Performance Profile

EnvironmentBest Use CasePerformance
Native RustHigh-performance backends🚀 Ultra Fast
JavaScriptConsistent Web Apps⚠️ Moderate (FFI Overhead)
PythonCross-platform scripts⚠️ Moderate (FFI Overhead)

Rod prioritizes correctness and portability. While the Rust core is nanosecond-fast, calling it from JS or Python involves a "Bridge Tax." For high-frequency small object validation in pure JS, Zod remains a great choice. Choose Rod when consistency is your primary requirement.

On this page