fastauth
Authentication for Rust web apps, modelled on Better Auth: one builder call gives you email and password sign-in, social login, sessions, and a plugin system for two-factor, organizations, passkeys, API keys and the rest. It runs on sqlx and axum out of the box, and the plugin API is checked by the compiler.
Status: v0.1. Core, axum, sqlx (Postgres and SQLite), the derive macros, GitHub and Google sign-in, two-factor and the CLI are published on crates.io and tested, including against Better Auth's own client. Some pages in
docs/still describe planned features (organization, passkey, admin, actix, Redis); docs/01 lists what ships.
use *;
use ;
use ;
pub type AppAuth = >;
async
async
If you remove TwoFactor from the builder, session.user.plugin::<TwoFactor, _>()
stops compiling and tells you which plugin is missing.
Docs
| Page | What it covers |
|---|---|
| Overview | Goals, non-goals, crate layout, feature flags, the main design decisions |
| Quickstart | From cargo new to sign-up, sign-in and a protected route |
| Configuration | Every builder option: secrets, email and password, social providers, sessions, cookies, rate limits |
| Sessions and the server API | Extractors, typed user fields, calling auth from your own code |
| Plugins | Using plugins, and writing one: schema, endpoints, hooks, events, errors, dependencies |
| Databases | The adapter trait, typed models, sqlx, migrations, writing an adapter |
| HTTP integrations | axum, actix-web, raw tower, the outgoing HTTP client, writing an integration |
| Internals | How it works: the type-level plugin list, the build step, the request path, the session hot path |
| Security | Tokens, cookies, password hashing, CSRF, OAuth, rate limiting, secret rotation |
| Open questions | Decisions that need an owner before v0.1 |
| Better Auth's client | Using better-auth/client with fastauth, the tested version, known gaps |
Agent skill
skills/use-fastauth teaches coding agents to use fastauth
in their own apps: setup, axum, migrations, user fields, the first-party plugins, the server
API, custom plugins and tests, plus the compiler errors they'll meet. Every code sample in it
compiles against main. Copy the folder into your agent's skills directory (for Claude Code,
.claude/skills/use-fastauth/).