Skip to main content

Overview

The Wacht Rust SDK provides a type-safe client for all Wacht platform APIs and authentication middleware for Axum web applications.

Features

API Client

  • All 72 Backend Endpoints - Full coverage of Wacht platform APIs
  • Type-Safe Models - Typed request/response structures
  • Async/Await - Async support with Tokio
  • Automatic Retries - Built-in retry logic

Authentication Middleware

  • JWT Validation - JWT token validation
  • Multiple Algorithms - Support for HS256/384/512, RS256/384/512, ES256/384
  • Permission System - Permission checks at route and handler level
  • Axum Integration - Integration with Axum web framework

Developer Tools

  • Global Client - HTTP client with connection pooling
  • Environment Configuration - Setup via environment variables
  • Error Handling - Detailed error types
  • Tracing Support - Observability with tracing crate

Architecture

wacht
├── API Modules (Users, Organizations, Workspaces, etc.)
├── Authentication Middleware
│   ├── JWT Validation Layer
│   ├── Permission Layers
│   └── Request Extractors
├── Global Client Configuration
└── Error Handling

Use Cases

Backend Services

  • User management systems
  • Organization and workspace administration
  • AI agent orchestration
  • Analytics and reporting services

API Gateways

  • Validate JWT tokens from Wacht
  • Enforce permissions at the gateway level
  • Route requests based on user context
  • Multi-tenant request routing

Microservices

  • Service-to-service authentication
  • Permission-based access control
  • Async task processing

Comparison with React SDK

While the React SDK focuses on frontend authentication flows and UI components, the Rust SDK provides:
FeatureReact SDKRust SDK
TargetFrontend applicationsBackend services
AuthenticationClient-side flowsJWT validation middleware
API AccessLimited frontend APIsAll backend APIs
ComponentsUI componentsMiddleware layers
State ManagementReact hooksStateless validation
Use CaseUser-facing appsServices & APIs

Getting Started

The SDK is designed to get you up and running quickly:
  1. Add the dependency to your Cargo.toml
  2. Set environment variables for API key and host
  3. Initialize the SDK in your main function
  4. Start making API calls or add auth middleware
Continue to the Installation guide to begin using the Wacht Rust SDK.