torii 0.2.0

A modular authentication ecosystem for Rust applications
Documentation

Torii

Torii is a powerful authentication framework for Rust applications that gives you complete control over your users' data. Unlike hosted solutions like Auth0, Clerk, or WorkOS that store user information in their cloud, Torii lets you own and manage your authentication stack while providing modern auth features through a flexible plugin system.

With Torii, you get powerful authentication capabilities like:

  • Password-based authentication
  • Social OAuth/OpenID Connect
  • Passkey/WebAuthn support

Combined with full data sovereignty and the ability to store user data wherever you choose.

Storage Support

Torii currently supports the following storage backends:

  • SQLite
  • PostgreSQL
  • MySQL (In Development)

Warning

This project is in early development and is not production-ready. The API is subject to change without notice. As this project has not undergone security audits, it should not be used in production environments.

Example

use torii::Torii;
use torii_storage_sqlite::SqliteStorage;
use std::sync::Arc;

#[tokio::main]
async fn main() {
    let user_storage = Arc::new(SqliteStorage::new(pool.clone()));
    let session_storage = Arc::new(SqliteStorage::new(pool.clone()));

    let torii = Torii::new(user_storage, session_storage)
        .with_password_plugin()
        .with_oauth_provider(Provider::google(
            "client_id",
            "client_secret",
            "redirect_uri"
        ))
        .with_passkey_plugin("rp_id", "rp_origin");
}