arium 0.1.0

Framework-agnostic authentication engine (passwords, sessions, OAuth, MFA, RBAC, API tokens, audit) for axum + sqlx apps.
Documentation

Crates.io Docs.rs CI License

arium

Framework-agnostic authentication engine for axum + sqlx fullstack apps.

arium owns the auth domain — password hashing, sessions, OAuth, MFA/TOTP, email verification + password reset, RBAC, API tokens, and an audit log — plus the install helper that bolts the whole thing onto an axum::Router. It has no UI-framework dependency; framework adapters such as arium-dioxus wrap these primitives in their own server fns + UI.

Typical server-side usage:

use arium::{
    AuthConfig, Mailer, install, migrator,
    oauth::{github::GithubProvider, OAuthRegistry},
};

let pool = sqlx::sqlite::SqlitePoolOptions::new()
    .connect_with("sqlite://./app.db?mode=rwc".parse()?)
    .await?;
migrator().run(&pool).await?;

let mut oauth = OAuthRegistry::new(pool.clone())?;
if let Some(gh) = GithubProvider::from_env()? {
    oauth = oauth.with_provider(gh);
}

let cfg = AuthConfig::builder(pool.clone(), Mailer::from_env()?)
    .oauth(oauth)
    .build()?;

// `router` is any `axum::Router` (e.g. your framework's server router).
let router = install(router, cfg).await?;

Installation

[dependencies]
arium = "0.1"

arium requires exactly one database backend. sqlite is on by default; for PostgreSQL, disable defaults and select postgres:

[dependencies]
arium = { version = "0.1", default-features = false, features = ["postgres", "oauth-github", "mfa", "mail", "ratelimit", "tokens"] }
Feature Default Enables
sqlite yes SQLite backend (pick exactly one backend)
postgres no PostgreSQL backend (pick exactly one backend)
oauth-github yes GitHub OAuth provider + routes
mfa yes TOTP MFA setup and challenge
mail yes Email verification & password reset (Mailer)
ratelimit yes Per-IP rate limiting on auth routes
tokens yes API token issuance and validation

Without mail, AuthConfig::builder takes the pool alone. Full API reference on docs.rs.

License

Licensed under either of:

at your option.