better_auth/lib.rs
1//! # Better Auth - Rust
2//!
3//! A comprehensive authentication framework for Rust, inspired by Better-Auth.
4//!
5//! ## Quick Start
6//!
7//! ```rust,ignore
8//! use better_auth::{AuthConfig, AuthSchema, BetterAuth};
9//! use better_auth::plugins::EmailPasswordPlugin;
10//! use better_auth::seaorm::{Database, SeaOrmStore};
11//!
12//! #[tokio::main]
13//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
14//! let config = AuthConfig::new("your-secret-key-that-is-at-least-32-chars");
15//! let database = Database::connect("sqlite::memory:").await?;
16//! let store = SeaOrmStore::<AppAuthSchema>::new(config.clone(), database);
17//!
18//! let auth = BetterAuth::<AppAuthSchema>::new(config)
19//! .store(store)
20//! .plugin(EmailPasswordPlugin::new())
21//! .build()
22//! .await?;
23//!
24//! Ok(())
25//! }
26//! ```
27
28#![cfg_attr(
29 test,
30 allow(
31 unused_results,
32 unreachable_pub,
33 reason = "test code intentionally discards setup return values and exposes helpers broadly"
34 )
35)]
36
37extern crate self as better_auth;
38
39mod core;
40#[cfg(feature = "axum")]
41mod handlers;
42
43pub mod config;
44pub mod email;
45pub mod error;
46pub mod hooks;
47pub mod integrations;
48pub mod middleware;
49pub mod plugin;
50pub mod plugins;
51pub mod prelude;
52pub mod schema;
53#[cfg(feature = "seaorm2")]
54pub mod seaorm;
55pub mod store;
56pub mod wire;
57
58pub use better_auth_core::{AuthConfig, AuthError, AuthResult, AuthSchema};
59pub use core::{AuthBuilder, BetterAuth};
60
61#[doc(hidden)]
62pub use better_auth_core as __private_core;