Better Auth in Rust

Installation

Add Better Auth to your Rust project.

Add the Dependency

Cargo.toml
[dependencies]
better-auth = "0.6"
tokio = { version = "1", features = ["full"] }

Feature Flags

Enable additional functionality with feature flags:

Cargo.toml
[dependencies]
better-auth = { version = "0.6", features = ["axum", "sqlx-postgres", "derive"] }
FeatureDescription
axumAxum web framework integration with route mounting and session extractors
deriveCustom entity derive macros (AuthUser, MemoryUser, etc.) for custom types
sqlx-postgresPostgreSQL database support via SQLx with connection pooling

No features are enabled by default. The core library works with the in-memory database adapter and the framework-agnostic request/response types.

Minimum Supported Rust Version

Better Auth requires Rust 1.85 or later (Rust 2024 edition).

On this page