Authkestra

Installation

Learn how to install Authkestra in your Rust project.

The easiest way to use Authkestra is via the facade crate with feature flags, allowing you to manage your authentication stack from a single dependency.

Using the Facade Crate

Add authkestra to your Cargo.toml with the features you need:

Cargo.toml
[dependencies]
# Use the facade with the features you need
authkestra = { version = "0.1.2", features = ["axum", "github"] }

# Async runtime
tokio = { version = "1", features = ["full"] }

# For environment variables
dotenvy = "0.15"

Feature Flags

Authkestra uses Cargo features to enable only what you need. This keeps compile times fast and binary sizes small.

Available Features

FeatureDescription
axumAxum framework integration with extractors and route helpers
actixActix-web framework integration
macrosDerive macros (e.g., AuthkestraFromRef) to reduce boilerplate
githubGitHub OAuth provider
googleGoogle OAuth provider
discordDiscord OAuth provider
oidcOpenID Connect support with discovery and validation
sessionSession persistence layer
tokenJWT signing, verification, and offline validation
guardAuthentication guard and multi-strategy orchestration
flowCore authentication flows (OAuth2, PKCE, Device Flow)

You can combine multiple features:

Cargo.toml
[dependencies]
authkestra = { version = "0.1.2", features = [
    "axum",
    "macros",
    "github",
    "google",
    "discord",
    "oidc",
    "session",
    "flow"
] }

If you need to enable a specific feature inside one of the sub-crates (e.g., if authkestra-session has a redis feature), you must add the sub-crate directly to your Cargo.toml as well, solely to enable that feature. Cargo will merge the feature flags.

Cargo.toml
[dependencies]
authkestra = { version = "0.1.2", features = ["session"] }
# Add the sub-crate directly to enable the extra feature
authkestra-session = { version = "0.1.1", features = ["redis"] }

Using Individual Crates

For advanced users, individual crates can be used independently:

CrateVersion
authkestra-core0.1.2
authkestra-flow0.1.2
authkestra-axum0.1.2
authkestra-actix0.1.2
authkestra-session0.1.2
authkestra-token0.1.2
authkestra-oidc0.1.2
authkestra-guard0.1.0
Cargo.toml
[dependencies]
authkestra-core = "0.1.2"
authkestra-flow = "0.1.2"
authkestra-axum = "0.1.2"
authkestra-providers-github = "0.1.2"
authkestra-session = { version = "0.1.2", features = ["sqlx-store"] }

When to use individual crates

Use individual crates when you need fine-grained control over versions, or when implementing custom providers or session stores that don't need the full stack.

Runtime Requirements

Authkestra is async-first and requires a Tokio runtime:

Cargo.toml
[dependencies]
tokio = { version = "1", features = ["full"] }

# Or minimal features for smaller binaries:
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }

Environment Variables

Most examples use dotenvy to load environment variables from a .env file. Make sure to add it to your dependencies if you're following along with the examples.

On this page