Expand description
§Better Auth - Rust
A comprehensive authentication framework for Rust, inspired by Better-Auth.
§Quick Start
ⓘ
use better_auth::{AuthConfig, AuthSchema, BetterAuth};
use better_auth::plugins::EmailPasswordPlugin;
use better_auth::seaorm::{Database, SeaOrmStore};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = AuthConfig::new("your-secret-key-that-is-at-least-32-chars");
let database = Database::connect("sqlite::memory:").await?;
let store = SeaOrmStore::<AppAuthSchema>::new(config.clone(), database);
let auth = BetterAuth::<AppAuthSchema>::new(config)
.store(store)
.plugin(EmailPasswordPlugin::new())
.build()
.await?;
Ok(())
}Modules§
- config
- Configuration types beyond the root
AuthConfigentrypoint. - Email provider interfaces and development helpers.
- error
- Error types and result aliases for Better Auth.
- hooks
- Request-hook utilities shared across Better Auth integrations.
- integrations
- Framework integrations.
- middleware
- Middleware traits and configuration types.
- plugin
- Plugin authoring interfaces and shared runtime types.
- plugins
- Built-in plugins and plugin-specific configuration modules.
- prelude
- Common traits and data types used by handlers, tests, hooks, and direct dispatch.
- schema
- Schema traits and derive macros for app-owned auth models.
- store
- Storage traits and cache adapters used by Better Auth.
- wire
- Wire-facing response view models.
Structs§
- Auth
Builder - Initial builder for configuring BetterAuth.
- Auth
Config - Main configuration for BetterAuth
- Better
Auth
Enums§
- Auth
Error - Authentication framework error types.
Traits§
- Auth
Schema - App-owned auth schema declaration.