Expand description
Multi-tenant primitives for Rust services.
The core is free of web-framework and database dependencies. Adapters are
opt-in through features: axum, postgres, postgres-rls, redis,
encryption, impersonation, testing.
Current tenant lives in a Tokio task-local, never in process global state.
Re-exports§
pub use bootstrapper::Bootstrapper;pub use commands::Purge;pub use config::DatabaseMode;pub use config::MaintenanceBypass;pub use config::TenancyConfig;pub use context::current_context;pub use context::TenantContext;pub use error::TenancyError;pub use event::TenancyEvent;pub use event::TenancyListener;pub use manager::Tenancy;pub use manager::TenancyBuilder;pub use manager::TenancyHandle;pub use migrations::TENANCY_MIGRATION;pub use multi_db::DatabaseConfig;pub use ports::CacheStore;pub use ports::Encryptor;pub use ports::JobQueue;pub use ports::Loader;pub use ports::ScopedCache;pub use ports::ScopedSession;pub use ports::ScopedStorage;pub use ports::SessionStore;pub use ports::Storage;pub use ports::TenantJob;pub use repository::TenantRepository;pub use resolver::RequestInfo;pub use resolver::TenantKey;pub use resolver::TenantResolver;pub use tenant::normalize_host;pub use tenant::validate_slug;pub use tenant::ConfigValue;pub use tenant::Domain;pub use tenant::Tenant;pub use tenant::TenantConfig;pub use tenant::TenantId;
Modules§
- bootstrapper
- Bootstrapper contract: hooks executed when a tenant lifecycle starts and ends.
- commands
- Tenant scoped command helpers for workers and CLI entry points.
- config
- Tenancy configuration.
- context
- Task-local tenant context and its typed slot store.
- error
- Error type shared by every tenancy operation.
- event
- Tenant lifecycle events and listeners.
- maintenance
- Per-tenant maintenance mode.
- manager
- Tenancy handle, lifecycle and task-local context management.
- migrations
- Central database schema for tenants, domains and configuration.
- multi_
db - Multi-database tenancy: configuration plus the
postgrescontract. - ports
- Ports implemented by the host application: cache, storage, sessions, queue and encryption.
- repository
- Tenant persistence contract.
- resolver
- Tenant resolution from incoming requests.
- tenant
- Tenant domain model: identifier, domains, configuration and the tenant itself.