> ## Documentation Index
> Fetch the complete documentation index at: https://rydantic.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Install the crate and parse, validate and serialize your first Rust model.

Parse a JSON document, normalize its fields and return a validated Rust value. This is the starting point for every integration.

DefineParse & validateSerialize

## Choose your version

> [!NOTE]
>
> These examples target **Rydantic 0.7.0 stable**. Review the [release notes](/reference/releases) for the breaking explicit-derive contract when upgrading from 0.6.0. For older deployments, use the [0.6.0 tagged guide](https://github.com/trotsky1997/Rydantic/tree/v0.6.0).

## Add the dependency

```toml Cargo.toml theme={"system"}
[dependencies]
rydantic = "=0.7.0"
```

## Define your first model

```rust src/main.rs theme={"system"}
use rydantic::{Model, SchemaMode};

#[derive(Debug, Model)]
#[model(extra = "forbid")]
struct User {
    #[model(trim, min_length = 3, max_length = 30)]
    name: String,

    #[model(coerce, ge = 18, le = 120)]
    age: u8,

    #[model(trim, lowercase, email)]
    email: String,

    #[model(default)]
    tags: Vec<String>,

    note: Option<String>,
}

fn main() -> Result<(), rydantic::ValidationErrors> {
    let user = User::parse_json(
        r#"{"name":" Alice ","age":"25","email":" ALICE@EXAMPLE.COM "}"#,
    )?;

    assert_eq!(user.name, "Alice");
    assert_eq!(user.age, 25);
    assert_eq!(user.email, "alice@example.com");
    println!("{}", user.dump_json()?);

    let schema = User::json_schema(SchemaMode::Output);
    assert!(schema.is_object());
    Ok(())
}
```

`Model` also generates Serde's `Serialize` and `Deserialize` implementations. Derive `Model` once per model. Deserialization runs full validation, and serialization revalidates the current object.

## Run an example

From the source checkout, run the model or tool-call examples:

```sh theme={"system"}
cargo run -p rydantic --example user
cargo run -p rydantic --example tool_call
cargo run -p rydantic --example tool_call -- --schema
cargo run -p rydantic --example tool_call -- '{"kind":"ping"}'
```

## Next steps

> **[Validation rules](/models/validation)**
>
> Explore constraints, defaults and normalization.

> **[Follow the tutorials](/tutorials/overview)**
>
> Build a model, CRUD API and typed AI agent step by step.

> **[Run an example](/examples/overview)**
>
> Find feature flags, complete programs and expected output.

> **[Optional integrations](/reference/features)**
>
> Enable HTTP, SQL, Cap’n Proto and other features.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.